diff options
author | Michał Mirosław <mirq-linux@rere.qmqm.pl> | 2009-05-21 06:34:05 -0400 |
---|---|---|
committer | David S. Miller <davem@davemloft.net> | 2009-05-21 19:50:23 -0400 |
commit | acb0a200ae48d95e3117608d0225a23e5efa283c (patch) | |
tree | 74e81fc4bffe2e182379b8ed773ba3c30bc8dd04 /net/tipc/netlink.c | |
parent | 502664eeaf880d364821521bbced7ae342f77f64 (diff) |
tipc: Use genl_register_family_with_ops()
Use genl_register_family_with_ops() instead of a copy. This also changes
netlink related variable names to be kernel-wide unique for consistency
with other users.
Signed-off-by: Michał Mirosław <mirq-linux@rere.qmqm.pl>
Signed-off-by: David S. Miller <davem@davemloft.net>
Diffstat (limited to 'net/tipc/netlink.c')
-rw-r--r-- | net/tipc/netlink.c | 38 |
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 | ||
71 | static struct genl_family family = { | 71 | static 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 | ||
79 | static struct genl_ops ops = { | 79 | static 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 | ||
84 | static int family_registered = 0; | 84 | static int tipc_genl_family_registered; |
85 | 85 | ||
86 | int tipc_netlink_start(void) | 86 | int 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 | ||
108 | void tipc_netlink_stop(void) | 101 | void 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 | } |