[haiku-commits] r33714 - in haiku/trunk/src/libs/compat/freebsd_network: . compat/net

  • From: pulkomandy@xxxxxxxxx
  • To: haiku-commits@xxxxxxxxxxxxx
  • Date: Wed, 21 Oct 2009 22:26:40 +0200 (CEST)

Author: pulkomandy
Date: 2009-10-21 22:26:40 +0200 (Wed, 21 Oct 2009)
New Revision: 33714
Changeset: http://dev.haiku-os.org/changeset/33714/haiku

Modified:
   haiku/trunk/src/libs/compat/freebsd_network/compat/net/if_var.h
   haiku/trunk/src/libs/compat/freebsd_network/if.c
Log:
Added new methods introduced in freebsd head that encapsulate macros to allow 
better binary compatibility if the locking way ever changes. These are not 
really useful, but needed for newer drivers sourcecode.


Modified: haiku/trunk/src/libs/compat/freebsd_network/compat/net/if_var.h
===================================================================
--- haiku/trunk/src/libs/compat/freebsd_network/compat/net/if_var.h     
2009-10-21 19:09:20 UTC (rev 33713)
+++ haiku/trunk/src/libs/compat/freebsd_network/compat/net/if_var.h     
2009-10-21 20:26:40 UTC (rev 33714)
@@ -239,6 +239,16 @@
 #define        IF_ADDR_LOCK_DESTROY(if)        mtx_destroy(&(if)->if_addr_mtx)
 #define        IF_ADDR_LOCK(if)        mtx_lock(&(if)->if_addr_mtx)
 #define        IF_ADDR_UNLOCK(if)      mtx_unlock(&(if)->if_addr_mtx)
+
+/*
+ * Function variations on locking macros intended to be used by loadable
+ * kernel modules in order to divorce them from the internals of address list
+ * locking.
+ */
+void   if_addr_rlock(struct ifnet *ifp);       /* if_addrhead */
+void   if_addr_runlock(struct ifnet *ifp);     /* if_addrhead */
+void   if_maddr_rlock(struct ifnet *ifp);      /* if_multiaddrs */
+void   if_maddr_runlock(struct ifnet *ifp);    /* if_multiaddrs */
 #define        IF_ADDR_LOCK_ASSERT(if) mtx_assert(&(if)->if_addr_mtx, MA_OWNED)
 
 /*

Modified: haiku/trunk/src/libs/compat/freebsd_network/if.c
===================================================================
--- haiku/trunk/src/libs/compat/freebsd_network/if.c    2009-10-21 19:09:20 UTC 
(rev 33713)
+++ haiku/trunk/src/libs/compat/freebsd_network/if.c    2009-10-21 20:26:40 UTC 
(rev 33714)
@@ -413,3 +413,36 @@
        return 0;
 }
 
+/*
+ * Wrapper functions for struct ifnet address list locking macros.  These are
+ * used by kernel modules to avoid encoding programming interface or binary
+ * interface assumptions that may be violated when kernel-internal locking
+ * approaches change.
+ */
+void
+if_addr_rlock(struct ifnet *ifp)
+{
+
+       IF_ADDR_LOCK(ifp);
+}
+
+void
+if_addr_runlock(struct ifnet *ifp)
+{
+
+       IF_ADDR_UNLOCK(ifp);
+}
+
+void
+if_maddr_rlock(struct ifnet *ifp)
+{
+
+       IF_ADDR_LOCK(ifp);
+}
+
+void
+if_maddr_runlock(struct ifnet *ifp)
+{
+
+       IF_ADDR_UNLOCK(ifp);
+}


Other related posts:

  • » [haiku-commits] r33714 - in haiku/trunk/src/libs/compat/freebsd_network: . compat/net - pulkomandy