4 #include <linux/rhashtable.h>
5 #include <linux/atomic.h>
6 #include <linux/workqueue.h>
9 #define NLGRPSZ(x) (ALIGN(x, sizeof(unsigned long) * 8) / 8)
10 #define NLGRPLONGS(x) (NLGRPSZ(x)/sizeof(unsigned long))
15 unsigned int frames_per_block;
16 unsigned int frame_size;
17 unsigned int frame_max;
19 unsigned int pg_vec_order;
20 unsigned int pg_vec_pages;
21 unsigned int pg_vec_len;
27 /* struct sock has to be the first member of netlink_sock */
35 unsigned long *groups;
37 size_t max_recvmsg_len;
38 wait_queue_head_t wait;
41 struct netlink_callback cb;
42 struct mutex *cb_mutex;
43 struct mutex cb_def_mutex;
44 void (*netlink_rcv)(struct sk_buff *skb);
45 int (*netlink_bind)(struct net *net, int group);
46 void (*netlink_unbind)(struct net *net, int group);
47 struct module *module;
49 struct rhash_head node;
51 struct work_struct work;
54 static inline struct netlink_sock *nlk_sk(struct sock *sk)
56 return container_of(sk, struct netlink_sock, sk);
59 struct netlink_table {
60 struct rhashtable hash;
61 struct hlist_head mc_list;
62 struct listeners __rcu *listeners;
65 struct mutex *cb_mutex;
66 struct module *module;
67 int (*bind)(struct net *net, int group);
68 void (*unbind)(struct net *net, int group);
69 bool (*compare)(struct net *net, struct sock *sock);
73 extern struct netlink_table *nl_table;
74 extern rwlock_t nl_table_lock;