aboutsummaryrefslogtreecommitdiffstats
path: root/net/netlink/af_netlink.h
diff options
context:
space:
mode:
authorAndrey Vagin <avagin@openvz.org>2013-03-21 12:33:47 -0400
committerDavid S. Miller <davem@davemloft.net>2013-03-21 12:38:02 -0400
commit0f29c768646809264d603574b4a1b15d2ff7ad79 (patch)
treefd0fdab9a15804cedb8f300a99889dfc9b6ac1a5 /net/netlink/af_netlink.h
parent953d276847b92524b34df8598bdaf30c9002c2b4 (diff)
net: prepare netlink code for netlink diag
Move a few declarations in a header. Acked-by: Pavel Emelyanov <xemul@parallels.com> Cc: "David S. Miller" <davem@davemloft.net> Cc: Eric Dumazet <edumazet@google.com> Cc: Pablo Neira Ayuso <pablo@netfilter.org> Cc: "Eric W. Biederman" <ebiederm@xmission.com> Cc: Gao feng <gaofeng@cn.fujitsu.com> Cc: Thomas Graf <tgraf@suug.ch> Signed-off-by: Andrey Vagin <avagin@openvz.org> Signed-off-by: David S. Miller <davem@davemloft.net>
Diffstat (limited to 'net/netlink/af_netlink.h')
-rw-r--r--net/netlink/af_netlink.h62
1 files changed, 62 insertions, 0 deletions
diff --git a/net/netlink/af_netlink.h b/net/netlink/af_netlink.h
new file mode 100644
index 000000000000..d9acb2a1d855
--- /dev/null
+++ b/net/netlink/af_netlink.h
@@ -0,0 +1,62 @@
1#ifndef _AF_NETLINK_H
2#define _AF_NETLINK_H
3
4#include <net/sock.h>
5
6#define NLGRPSZ(x) (ALIGN(x, sizeof(unsigned long) * 8) / 8)
7#define NLGRPLONGS(x) (NLGRPSZ(x)/sizeof(unsigned long))
8
9struct netlink_sock {
10 /* struct sock has to be the first member of netlink_sock */
11 struct sock sk;
12 u32 portid;
13 u32 dst_portid;
14 u32 dst_group;
15 u32 flags;
16 u32 subscriptions;
17 u32 ngroups;
18 unsigned long *groups;
19 unsigned long state;
20 wait_queue_head_t wait;
21 struct netlink_callback *cb;
22 struct mutex *cb_mutex;
23 struct mutex cb_def_mutex;
24 void (*netlink_rcv)(struct sk_buff *skb);
25 void (*netlink_bind)(int group);
26 struct module *module;
27};
28
29static inline struct netlink_sock *nlk_sk(struct sock *sk)
30{
31 return container_of(sk, struct netlink_sock, sk);
32}
33
34struct nl_portid_hash {
35 struct hlist_head *table;
36 unsigned long rehash_time;
37
38 unsigned int mask;
39 unsigned int shift;
40
41 unsigned int entries;
42 unsigned int max_shift;
43
44 u32 rnd;
45};
46
47struct netlink_table {
48 struct nl_portid_hash hash;
49 struct hlist_head mc_list;
50 struct listeners __rcu *listeners;
51 unsigned int flags;
52 unsigned int groups;
53 struct mutex *cb_mutex;
54 struct module *module;
55 void (*bind)(int group);
56 int registered;
57};
58
59extern struct netlink_table *nl_table;
60extern rwlock_t nl_table_lock;
61
62#endif