diff options
author | Thomas Graf <tgraf@suug.ch> | 2006-11-14 22:46:02 -0500 |
---|---|---|
committer | David S. Miller <davem@sunset.davemloft.net> | 2006-12-03 00:22:42 -0500 |
commit | 17c157c889f4b07258af6bfec9e4e9dcf3c00178 (patch) | |
tree | f17be049a40b5742ca7e67094d6a7063146568d5 /net/netlabel/netlabel_mgmt.c | |
parent | 81878d27fdd297a33f3cfcf29483fe1abaf26dec (diff) |
[GENL]: Add genlmsg_put_reply() to simplify building reply headers
By modyfing genlmsg_put() to take a genl_family and by adding
genlmsg_put_reply() the process of constructing the netlink
and generic netlink headers is simplified.
Signed-off-by: Thomas Graf <tgraf@suug.ch>
Acked-by: Paul Moore <paul.moore@hp.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
Diffstat (limited to 'net/netlabel/netlabel_mgmt.c')
-rw-r--r-- | net/netlabel/netlabel_mgmt.c | 34 |
1 files changed, 10 insertions, 24 deletions
diff --git a/net/netlabel/netlabel_mgmt.c b/net/netlabel/netlabel_mgmt.c index 784693735e0d..e8c80f33f3d7 100644 --- a/net/netlabel/netlabel_mgmt.c +++ b/net/netlabel/netlabel_mgmt.c | |||
@@ -188,12 +188,9 @@ static int netlbl_mgmt_listall_cb(struct netlbl_dom_map *entry, void *arg) | |||
188 | struct netlbl_domhsh_walk_arg *cb_arg = arg; | 188 | struct netlbl_domhsh_walk_arg *cb_arg = arg; |
189 | void *data; | 189 | void *data; |
190 | 190 | ||
191 | data = netlbl_netlink_hdr_put(cb_arg->skb, | 191 | data = genlmsg_put(cb_arg->skb, NETLINK_CB(cb_arg->nl_cb->skb).pid, |
192 | NETLINK_CB(cb_arg->nl_cb->skb).pid, | 192 | cb_arg->seq, &netlbl_mgmt_gnl_family, |
193 | cb_arg->seq, | 193 | NLM_F_MULTI, NLBL_MGMT_C_LISTALL); |
194 | netlbl_mgmt_gnl_family.id, | ||
195 | NLM_F_MULTI, | ||
196 | NLBL_MGMT_C_LISTALL); | ||
197 | if (data == NULL) | 194 | if (data == NULL) |
198 | goto listall_cb_failure; | 195 | goto listall_cb_failure; |
199 | 196 | ||
@@ -359,12 +356,8 @@ static int netlbl_mgmt_listdef(struct sk_buff *skb, struct genl_info *info) | |||
359 | ans_skb = nlmsg_new(NLMSG_DEFAULT_SIZE, GFP_KERNEL); | 356 | ans_skb = nlmsg_new(NLMSG_DEFAULT_SIZE, GFP_KERNEL); |
360 | if (ans_skb == NULL) | 357 | if (ans_skb == NULL) |
361 | return -ENOMEM; | 358 | return -ENOMEM; |
362 | data = netlbl_netlink_hdr_put(ans_skb, | 359 | data = genlmsg_put_reply(ans_skb, info, &netlbl_mgmt_gnl_family, |
363 | info->snd_pid, | 360 | 0, NLBL_MGMT_C_LISTDEF); |
364 | info->snd_seq, | ||
365 | netlbl_mgmt_gnl_family.id, | ||
366 | 0, | ||
367 | NLBL_MGMT_C_LISTDEF); | ||
368 | if (data == NULL) | 361 | if (data == NULL) |
369 | goto listdef_failure; | 362 | goto listdef_failure; |
370 | 363 | ||
@@ -422,12 +415,9 @@ static int netlbl_mgmt_protocols_cb(struct sk_buff *skb, | |||
422 | int ret_val = -ENOMEM; | 415 | int ret_val = -ENOMEM; |
423 | void *data; | 416 | void *data; |
424 | 417 | ||
425 | data = netlbl_netlink_hdr_put(skb, | 418 | data = genlmsg_put(skb, NETLINK_CB(cb->skb).pid, cb->nlh->nlmsg_seq, |
426 | NETLINK_CB(cb->skb).pid, | 419 | &netlbl_mgmt_gnl_family, NLM_F_MULTI, |
427 | cb->nlh->nlmsg_seq, | 420 | NLBL_MGMT_C_PROTOCOLS); |
428 | netlbl_mgmt_gnl_family.id, | ||
429 | NLM_F_MULTI, | ||
430 | NLBL_MGMT_C_PROTOCOLS); | ||
431 | if (data == NULL) | 421 | if (data == NULL) |
432 | goto protocols_cb_failure; | 422 | goto protocols_cb_failure; |
433 | 423 | ||
@@ -495,12 +485,8 @@ static int netlbl_mgmt_version(struct sk_buff *skb, struct genl_info *info) | |||
495 | ans_skb = nlmsg_new(NLMSG_DEFAULT_SIZE, GFP_KERNEL); | 485 | ans_skb = nlmsg_new(NLMSG_DEFAULT_SIZE, GFP_KERNEL); |
496 | if (ans_skb == NULL) | 486 | if (ans_skb == NULL) |
497 | return -ENOMEM; | 487 | return -ENOMEM; |
498 | data = netlbl_netlink_hdr_put(ans_skb, | 488 | data = genlmsg_put_reply(ans_skb, info, &netlbl_mgmt_gnl_family, |
499 | info->snd_pid, | 489 | 0, NLBL_MGMT_C_VERSION); |
500 | info->snd_seq, | ||
501 | netlbl_mgmt_gnl_family.id, | ||
502 | 0, | ||
503 | NLBL_MGMT_C_VERSION); | ||
504 | if (data == NULL) | 490 | if (data == NULL) |
505 | goto version_failure; | 491 | goto version_failure; |
506 | 492 | ||