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/netlink | |
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/netlink')
-rw-r--r-- | net/netlink/genetlink.c | 17 |
1 files changed, 8 insertions, 9 deletions
diff --git a/net/netlink/genetlink.c b/net/netlink/genetlink.c index 0249a56a9aa..8903ef93db5 100644 --- a/net/netlink/genetlink.c +++ b/net/netlink/genetlink.c | |||
@@ -384,6 +384,13 @@ static void genl_rcv(struct sock *sk, int len) | |||
384 | * Controller | 384 | * Controller |
385 | **************************************************************************/ | 385 | **************************************************************************/ |
386 | 386 | ||
387 | static struct genl_family genl_ctrl = { | ||
388 | .id = GENL_ID_CTRL, | ||
389 | .name = "nlctrl", | ||
390 | .version = 0x1, | ||
391 | .maxattr = CTRL_ATTR_MAX, | ||
392 | }; | ||
393 | |||
387 | static int ctrl_fill_info(struct genl_family *family, u32 pid, u32 seq, | 394 | static int ctrl_fill_info(struct genl_family *family, u32 pid, u32 seq, |
388 | u32 flags, struct sk_buff *skb, u8 cmd) | 395 | u32 flags, struct sk_buff *skb, u8 cmd) |
389 | { | 396 | { |
@@ -392,8 +399,7 @@ static int ctrl_fill_info(struct genl_family *family, u32 pid, u32 seq, | |||
392 | void *hdr; | 399 | void *hdr; |
393 | int idx = 1; | 400 | int idx = 1; |
394 | 401 | ||
395 | hdr = genlmsg_put(skb, pid, seq, GENL_ID_CTRL, 0, flags, cmd, | 402 | hdr = genlmsg_put(skb, pid, seq, &genl_ctrl, flags, cmd); |
396 | family->version); | ||
397 | if (hdr == NULL) | 403 | if (hdr == NULL) |
398 | return -1; | 404 | return -1; |
399 | 405 | ||
@@ -562,13 +568,6 @@ static struct genl_ops genl_ctrl_ops = { | |||
562 | .policy = ctrl_policy, | 568 | .policy = ctrl_policy, |
563 | }; | 569 | }; |
564 | 570 | ||
565 | static struct genl_family genl_ctrl = { | ||
566 | .id = GENL_ID_CTRL, | ||
567 | .name = "nlctrl", | ||
568 | .version = 0x1, | ||
569 | .maxattr = CTRL_ATTR_MAX, | ||
570 | }; | ||
571 | |||
572 | static int __init genl_init(void) | 571 | static int __init genl_init(void) |
573 | { | 572 | { |
574 | int i, err; | 573 | int i, err; |