diff options
Diffstat (limited to 'net/hsr/hsr_netlink.c')
-rw-r--r-- | net/hsr/hsr_netlink.c | 64 |
1 files changed, 22 insertions, 42 deletions
diff --git a/net/hsr/hsr_netlink.c b/net/hsr/hsr_netlink.c index 4e66bf61f585..5325af85eea6 100644 --- a/net/hsr/hsr_netlink.c +++ b/net/hsr/hsr_netlink.c | |||
@@ -90,8 +90,8 @@ static struct genl_family hsr_genl_family = { | |||
90 | .maxattr = HSR_A_MAX, | 90 | .maxattr = HSR_A_MAX, |
91 | }; | 91 | }; |
92 | 92 | ||
93 | static struct genl_multicast_group hsr_network_genl_mcgrp = { | 93 | static const struct genl_multicast_group hsr_mcgrps[] = { |
94 | .name = "hsr-network", | 94 | { .name = "hsr-network", }, |
95 | }; | 95 | }; |
96 | 96 | ||
97 | 97 | ||
@@ -129,7 +129,7 @@ void hsr_nl_ringerror(struct hsr_priv *hsr_priv, unsigned char addr[ETH_ALEN], | |||
129 | goto nla_put_failure; | 129 | goto nla_put_failure; |
130 | 130 | ||
131 | genlmsg_end(skb, msg_head); | 131 | genlmsg_end(skb, msg_head); |
132 | genlmsg_multicast(skb, 0, hsr_network_genl_mcgrp.id, GFP_ATOMIC); | 132 | genlmsg_multicast(&hsr_genl_family, skb, 0, 0, GFP_ATOMIC); |
133 | 133 | ||
134 | return; | 134 | return; |
135 | 135 | ||
@@ -163,7 +163,7 @@ void hsr_nl_nodedown(struct hsr_priv *hsr_priv, unsigned char addr[ETH_ALEN]) | |||
163 | goto nla_put_failure; | 163 | goto nla_put_failure; |
164 | 164 | ||
165 | genlmsg_end(skb, msg_head); | 165 | genlmsg_end(skb, msg_head); |
166 | genlmsg_multicast(skb, 0, hsr_network_genl_mcgrp.id, GFP_ATOMIC); | 166 | genlmsg_multicast(&hsr_genl_family, skb, 0, 0, GFP_ATOMIC); |
167 | 167 | ||
168 | return; | 168 | return; |
169 | 169 | ||
@@ -249,7 +249,7 @@ static int hsr_get_node_status(struct sk_buff *skb_in, struct genl_info *info) | |||
249 | &hsr_node_if2_age, | 249 | &hsr_node_if2_age, |
250 | &hsr_node_if2_seq); | 250 | &hsr_node_if2_seq); |
251 | if (res < 0) | 251 | if (res < 0) |
252 | goto fail; | 252 | goto nla_put_failure; |
253 | 253 | ||
254 | res = nla_put(skb_out, HSR_A_NODE_ADDR, ETH_ALEN, | 254 | res = nla_put(skb_out, HSR_A_NODE_ADDR, ETH_ALEN, |
255 | nla_data(info->attrs[HSR_A_NODE_ADDR])); | 255 | nla_data(info->attrs[HSR_A_NODE_ADDR])); |
@@ -306,15 +306,6 @@ fail: | |||
306 | return res; | 306 | return res; |
307 | } | 307 | } |
308 | 308 | ||
309 | static struct genl_ops hsr_ops_get_node_status = { | ||
310 | .cmd = HSR_C_GET_NODE_STATUS, | ||
311 | .flags = 0, | ||
312 | .policy = hsr_genl_policy, | ||
313 | .doit = hsr_get_node_status, | ||
314 | .dumpit = NULL, | ||
315 | }; | ||
316 | |||
317 | |||
318 | /* Get a list of MacAddressA of all nodes known to this node (other than self). | 309 | /* Get a list of MacAddressA of all nodes known to this node (other than self). |
319 | */ | 310 | */ |
320 | static int hsr_get_node_list(struct sk_buff *skb_in, struct genl_info *info) | 311 | static int hsr_get_node_list(struct sk_buff *skb_in, struct genl_info *info) |
@@ -398,12 +389,21 @@ fail: | |||
398 | } | 389 | } |
399 | 390 | ||
400 | 391 | ||
401 | static struct genl_ops hsr_ops_get_node_list = { | 392 | static const struct genl_ops hsr_ops[] = { |
402 | .cmd = HSR_C_GET_NODE_LIST, | 393 | { |
403 | .flags = 0, | 394 | .cmd = HSR_C_GET_NODE_STATUS, |
404 | .policy = hsr_genl_policy, | 395 | .flags = 0, |
405 | .doit = hsr_get_node_list, | 396 | .policy = hsr_genl_policy, |
406 | .dumpit = NULL, | 397 | .doit = hsr_get_node_status, |
398 | .dumpit = NULL, | ||
399 | }, | ||
400 | { | ||
401 | .cmd = HSR_C_GET_NODE_LIST, | ||
402 | .flags = 0, | ||
403 | .policy = hsr_genl_policy, | ||
404 | .doit = hsr_get_node_list, | ||
405 | .dumpit = NULL, | ||
406 | }, | ||
407 | }; | 407 | }; |
408 | 408 | ||
409 | int __init hsr_netlink_init(void) | 409 | int __init hsr_netlink_init(void) |
@@ -414,30 +414,13 @@ int __init hsr_netlink_init(void) | |||
414 | if (rc) | 414 | if (rc) |
415 | goto fail_rtnl_link_register; | 415 | goto fail_rtnl_link_register; |
416 | 416 | ||
417 | rc = genl_register_family(&hsr_genl_family); | 417 | rc = genl_register_family_with_ops_groups(&hsr_genl_family, hsr_ops, |
418 | hsr_mcgrps); | ||
418 | if (rc) | 419 | if (rc) |
419 | goto fail_genl_register_family; | 420 | goto fail_genl_register_family; |
420 | 421 | ||
421 | rc = genl_register_ops(&hsr_genl_family, &hsr_ops_get_node_status); | ||
422 | if (rc) | ||
423 | goto fail_genl_register_ops; | ||
424 | |||
425 | rc = genl_register_ops(&hsr_genl_family, &hsr_ops_get_node_list); | ||
426 | if (rc) | ||
427 | goto fail_genl_register_ops_node_list; | ||
428 | |||
429 | rc = genl_register_mc_group(&hsr_genl_family, &hsr_network_genl_mcgrp); | ||
430 | if (rc) | ||
431 | goto fail_genl_register_mc_group; | ||
432 | |||
433 | return 0; | 422 | return 0; |
434 | 423 | ||
435 | fail_genl_register_mc_group: | ||
436 | genl_unregister_ops(&hsr_genl_family, &hsr_ops_get_node_list); | ||
437 | fail_genl_register_ops_node_list: | ||
438 | genl_unregister_ops(&hsr_genl_family, &hsr_ops_get_node_status); | ||
439 | fail_genl_register_ops: | ||
440 | genl_unregister_family(&hsr_genl_family); | ||
441 | fail_genl_register_family: | 424 | fail_genl_register_family: |
442 | rtnl_link_unregister(&hsr_link_ops); | 425 | rtnl_link_unregister(&hsr_link_ops); |
443 | fail_rtnl_link_register: | 426 | fail_rtnl_link_register: |
@@ -447,10 +430,7 @@ fail_rtnl_link_register: | |||
447 | 430 | ||
448 | void __exit hsr_netlink_exit(void) | 431 | void __exit hsr_netlink_exit(void) |
449 | { | 432 | { |
450 | genl_unregister_mc_group(&hsr_genl_family, &hsr_network_genl_mcgrp); | ||
451 | genl_unregister_ops(&hsr_genl_family, &hsr_ops_get_node_status); | ||
452 | genl_unregister_family(&hsr_genl_family); | 433 | genl_unregister_family(&hsr_genl_family); |
453 | |||
454 | rtnl_link_unregister(&hsr_link_ops); | 434 | rtnl_link_unregister(&hsr_link_ops); |
455 | } | 435 | } |
456 | 436 | ||