Skip to content

Commit

Permalink
netlink: Export genl_lock() API for use by modules
Browse files Browse the repository at this point in the history
This lets kernel modules which use genl netlink APIs serialize netlink
processing.

Signed-off-by: James Chapman <[email protected]>
Reviewed-by: Randy Dunlap <[email protected]>
Signed-off-by: David S. Miller <[email protected]>
  • Loading branch information
j-c-h authored and davem330 committed Apr 3, 2010
1 parent 0d76751 commit f408e0c
Show file tree
Hide file tree
Showing 2 changed files with 12 additions and 2 deletions.
8 changes: 8 additions & 0 deletions include/linux/genetlink.h
Original file line number Diff line number Diff line change
Expand Up @@ -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 */
6 changes: 4 additions & 2 deletions net/netlink/genetlink.c
Original file line number Diff line number Diff line change
Expand Up @@ -20,15 +20,17 @@

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)
Expand Down

0 comments on commit f408e0c

Please sign in to comment.