aboutsummaryrefslogtreecommitdiffstats
path: root/net/tipc/netlink.c
diff options
context:
space:
mode:
authorLinus Torvalds <torvalds@linux-foundation.org>2009-06-15 12:40:05 -0400
committerLinus Torvalds <torvalds@linux-foundation.org>2009-06-15 12:40:05 -0400
commit2ed0e21b30b53d3a94e204196e523e6c8f732b56 (patch)
treede2635426477d86338a9469ce09ba0626052288f /net/tipc/netlink.c
parent0fa213310cd8fa7a51071cdcf130e26fa56e9549 (diff)
parent9cbc1cb8cd46ce1f7645b9de249b2ce8460129bb (diff)
Merge git://git.kernel.org/pub/scm/linux/kernel/git/davem/net-next-2.6
* git://git.kernel.org/pub/scm/linux/kernel/git/davem/net-next-2.6: (1244 commits) pkt_sched: Rename PSCHED_US2NS and PSCHED_NS2US ipv4: Fix fib_trie rebalancing Bluetooth: Fix issue with uninitialized nsh.type in DTL-1 driver Bluetooth: Fix Kconfig issue with RFKILL integration PIM-SM: namespace changes ipv4: update ARPD help text net: use a deferred timer in rt_check_expire ieee802154: fix kconfig bool/tristate muckup bonding: initialization rework bonding: use is_zero_ether_addr bonding: network device names are case sensative bonding: elminate bad refcount code bonding: fix style issues bonding: fix destructor bonding: remove bonding read/write semaphore bonding: initialize before registration bonding: bond_create always called with default parameters x_tables: Convert printk to pr_err netfilter: conntrack: optional reliable conntrack event delivery list_nulls: add hlist_nulls_add_head and hlist_nulls_del ...
Diffstat (limited to 'net/tipc/netlink.c')
-rw-r--r--net/tipc/netlink.c38
1 files changed, 16 insertions, 22 deletions
diff --git a/net/tipc/netlink.c b/net/tipc/netlink.c
index c387217bb230..3c57005e44d1 100644
--- a/net/tipc/netlink.c
+++ b/net/tipc/netlink.c
@@ -68,7 +68,7 @@ static int handle_cmd(struct sk_buff *skb, struct genl_info *info)
68 return 0; 68 return 0;
69} 69}
70 70
71static struct genl_family family = { 71static struct genl_family tipc_genl_family = {
72 .id = GENL_ID_GENERATE, 72 .id = GENL_ID_GENERATE,
73 .name = TIPC_GENL_NAME, 73 .name = TIPC_GENL_NAME,
74 .version = TIPC_GENL_VERSION, 74 .version = TIPC_GENL_VERSION,
@@ -76,39 +76,33 @@ static struct genl_family family = {
76 .maxattr = 0, 76 .maxattr = 0,
77}; 77};
78 78
79static struct genl_ops ops = { 79static struct genl_ops tipc_genl_ops = {
80 .cmd = TIPC_GENL_CMD, 80 .cmd = TIPC_GENL_CMD,
81 .doit = handle_cmd, 81 .doit = handle_cmd,
82}; 82};
83 83
84static int family_registered = 0; 84static int tipc_genl_family_registered;
85 85
86int tipc_netlink_start(void) 86int tipc_netlink_start(void)
87{ 87{
88 int res;
88 89
90 res = genl_register_family_with_ops(&tipc_genl_family,
91 &tipc_genl_ops, 1);
92 if (res) {
93 err("Failed to register netlink interface\n");
94 return res;
95 }
89 96
90 if (genl_register_family(&family)) 97 tipc_genl_family_registered = 1;
91 goto err;
92
93 family_registered = 1;
94
95 if (genl_register_ops(&family, &ops))
96 goto err_unregister;
97
98 return 0; 98 return 0;
99
100 err_unregister:
101 genl_unregister_family(&family);
102 family_registered = 0;
103 err:
104 err("Failed to register netlink interface\n");
105 return -EFAULT;
106} 99}
107 100
108void tipc_netlink_stop(void) 101void tipc_netlink_stop(void)
109{ 102{
110 if (family_registered) { 103 if (!tipc_genl_family_registered)
111 genl_unregister_family(&family); 104 return;
112 family_registered = 0; 105
113 } 106 genl_unregister_family(&tipc_genl_family);
107 tipc_genl_family_registered = 0;
114} 108}