netlink: Export genl_lock() API for use by modules
authorJames Chapman <jchapman@katalix.com>
Fri, 2 Apr 2010 06:19:05 +0000 (06:19 +0000)
committerDavid S. Miller <davem@davemloft.net>
Sat, 3 Apr 2010 21:56:05 +0000 (14:56 -0700)
This lets kernel modules which use genl netlink APIs serialize netlink
processing.

Signed-off-by: James Chapman <jchapman@katalix.com>
Reviewed-by: Randy Dunlap <randy.dunlap@oracle.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
include/linux/genetlink.h
net/netlink/genetlink.c

index b834ef6d59fa459ca793a004c311fe363e5a68fa..61549b26ad6f4dd114250ac00b170a1f734fd21b 100644 (file)
@@ -80,4 +80,12 @@ enum {
 
 #define CTRL_ATTR_MCAST_GRP_MAX (__CTRL_ATTR_MCAST_GRP_MAX - 1)
 
+#ifdef __KERNEL__
+
+/* All generic netlink requests are serialized by a global lock.  */
+extern void genl_lock(void);
+extern void genl_unlock(void);
+
+#endif /* __KERNEL__ */
+
 #endif /* __LINUX_GENERIC_NETLINK_H */
index a4b6e148c5dec4ceba8a4aa5ef964353433e2d6a..a28fda7420d9d2699cb0c0f7a6707ecd9bd0503c 100644 (file)
 
 static DEFINE_MUTEX(genl_mutex); /* serialization of message processing */
 
-static inline void genl_lock(void)
+void genl_lock(void)
 {
        mutex_lock(&genl_mutex);
 }
+EXPORT_SYMBOL(genl_lock);
 
-static inline void genl_unlock(void)
+void genl_unlock(void)
 {
        mutex_unlock(&genl_mutex);
 }
+EXPORT_SYMBOL(genl_unlock);
 
 #define GENL_FAM_TAB_SIZE      16
 #define GENL_FAM_TAB_MASK      (GENL_FAM_TAB_SIZE - 1)