diff options
author | Jamal Hadi Salim <hadi@cyberus.ca> | 2006-12-04 22:31:51 -0500 |
---|---|---|
committer | David S. Miller <davem@sunset.davemloft.net> | 2006-12-06 21:38:41 -0500 |
commit | 334c29a64507dda187565dd0db0403de3d70ec8b (patch) | |
tree | a01eb4f714f598806e6362f6c291e5dc77e29463 /net/netlink | |
parent | 620034c84d1d939717bdfbe02c51a3fee43541c3 (diff) |
[GENETLINK]: Move command capabilities to flags.
This patch moves command capabilities to command flags. Other than
being cleaner, saves several bytes.
We increment the nlctrl version so as to signal to user space that
to not expect the attributes. We will try to be careful
not to do this too often ;->
Signed-off-by: Jamal Hadi Salim <hadi@cyberus.ca>
Signed-off-by: David S. Miller <davem@davemloft.net>
Diffstat (limited to 'net/netlink')
-rw-r--r-- | net/netlink/genetlink.c | 18 |
1 files changed, 8 insertions, 10 deletions
diff --git a/net/netlink/genetlink.c b/net/netlink/genetlink.c index b9b03747c1f3..b5df749cba8f 100644 --- a/net/netlink/genetlink.c +++ b/net/netlink/genetlink.c | |||
@@ -143,6 +143,13 @@ int genl_register_ops(struct genl_family *family, struct genl_ops *ops) | |||
143 | goto errout; | 143 | goto errout; |
144 | } | 144 | } |
145 | 145 | ||
146 | if (ops->dumpit) | ||
147 | ops->flags |= GENL_CMD_CAP_DO; | ||
148 | if (ops->doit) | ||
149 | ops->flags |= GENL_CMD_CAP_DUMP; | ||
150 | if (ops->policy) | ||
151 | ops->flags |= GENL_CMD_CAP_HASPOL; | ||
152 | |||
146 | genl_lock(); | 153 | genl_lock(); |
147 | list_add_tail(&ops->ops_list, &family->ops_list); | 154 | list_add_tail(&ops->ops_list, &family->ops_list); |
148 | genl_unlock(); | 155 | genl_unlock(); |
@@ -387,7 +394,7 @@ static void genl_rcv(struct sock *sk, int len) | |||
387 | static struct genl_family genl_ctrl = { | 394 | static struct genl_family genl_ctrl = { |
388 | .id = GENL_ID_CTRL, | 395 | .id = GENL_ID_CTRL, |
389 | .name = "nlctrl", | 396 | .name = "nlctrl", |
390 | .version = 0x1, | 397 | .version = 0x2, |
391 | .maxattr = CTRL_ATTR_MAX, | 398 | .maxattr = CTRL_ATTR_MAX, |
392 | }; | 399 | }; |
393 | 400 | ||
@@ -425,15 +432,6 @@ static int ctrl_fill_info(struct genl_family *family, u32 pid, u32 seq, | |||
425 | NLA_PUT_U32(skb, CTRL_ATTR_OP_ID, ops->cmd); | 432 | NLA_PUT_U32(skb, CTRL_ATTR_OP_ID, ops->cmd); |
426 | NLA_PUT_U32(skb, CTRL_ATTR_OP_FLAGS, ops->flags); | 433 | NLA_PUT_U32(skb, CTRL_ATTR_OP_FLAGS, ops->flags); |
427 | 434 | ||
428 | if (ops->policy) | ||
429 | NLA_PUT_FLAG(skb, CTRL_ATTR_OP_POLICY); | ||
430 | |||
431 | if (ops->doit) | ||
432 | NLA_PUT_FLAG(skb, CTRL_ATTR_OP_DOIT); | ||
433 | |||
434 | if (ops->dumpit) | ||
435 | NLA_PUT_FLAG(skb, CTRL_ATTR_OP_DUMPIT); | ||
436 | |||
437 | nla_nest_end(skb, nest); | 435 | nla_nest_end(skb, nest); |
438 | } | 436 | } |
439 | 437 | ||