summaryrefslogtreecommitdiffstats
path: root/sys/net/if.c
diff options
context:
space:
mode:
authorrwatson <rwatson@FreeBSD.org>2009-06-26 00:36:47 +0000
committerrwatson <rwatson@FreeBSD.org>2009-06-26 00:36:47 +0000
commitc4ac6ab020126b381316fa8dcb627571af2683c8 (patch)
treec6f326c31b77486b02c2c684052c2a2a25bf0cf6 /sys/net/if.c
parent6bcc6a84131914c0690ee04211ea2d70f7271ca8 (diff)
downloadFreeBSD-src-c4ac6ab020126b381316fa8dcb627571af2683c8.zip
FreeBSD-src-c4ac6ab020126b381316fa8dcb627571af2683c8.tar.gz
Define four wrapper functions for interface address locking,
if_addr_rlock() and if_addr_runlock() for regular address lists, and if_maddr_rlock() and if_maddr_runlock() for multicast address lists. We will use these in various kernel modules to avoid encoding specific type and locking strategy information into modules that currently use IF_ADDR_LOCK() and IF_ADDR_UNLOCK() directly. MFC after: 6 weeks
Diffstat (limited to 'sys/net/if.c')
-rw-r--r--sys/net/if.c34
1 files changed, 34 insertions, 0 deletions
diff --git a/sys/net/if.c b/sys/net/if.c
index 58ab679..c41390a 100644
--- a/sys/net/if.c
+++ b/sys/net/if.c
@@ -1419,6 +1419,40 @@ if_rtdel(struct radix_node *rn, void *arg)
}
/*
+ * 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);
+}
+
+/*
* Reference count functions for ifaddrs.
*/
void
OpenPOWER on IntegriCloud