All of lore.kernel.org
 help / color / mirror / Atom feed
From: jamal <hadi@cyberus.ca>
To: Thomas Graf <tgraf@suug.ch>
Cc: davem@davemloft.net, netdev@vger.kernel.org
Subject: [RFC][GENETLINK] move command capabilities  to flags
Date: Sat, 02 Dec 2006 06:56:52 -0500	[thread overview]
Message-ID: <1165060612.3564.8.camel@localhost> (raw)

[-- Attachment #1: Type: text/plain, Size: 110 bytes --]


Dave,
If there is no objections on this approach, please apply this patch.
Against net-2.6.20

cheers,
jamal

[-- Attachment #2: genl_capab_flags --]
[-- Type: text/plain, Size: 1997 bytes --]

This patch moves command capabilities to command flags. Other than
being cleaner, saves several bytes.

Signed-off-by: Jamal Hadi Salim <hadi@cyberus.ca>

---
commit b6ac8f41bdd2edd9d215e376efa47261e9b118a1
tree fec2a968aad15264b30e2d550cb0c6f7939d4c93
parent 4bacaeb2cea3c6684f9b3acc54f71958bb2c25c5
author Jamal Hadi Salim <hadi@cyberus.ca> Sat, 02 Dec 2006 06:54:55 -0500
committer Jamal Hadi Salim <hadi@cyberus.ca> Sat, 02 Dec 2006 06:54:55 -0500

 include/linux/genetlink.h |    3 +++
 net/netlink/genetlink.c   |   16 +++++++---------
 2 files changed, 10 insertions(+), 9 deletions(-)

diff --git a/include/linux/genetlink.h b/include/linux/genetlink.h
index 9049dc6..3bd75c2 100644
--- a/include/linux/genetlink.h
+++ b/include/linux/genetlink.h
@@ -17,6 +17,9 @@ struct genlmsghdr {
 #define GENL_HDRLEN	NLMSG_ALIGN(sizeof(struct genlmsghdr))
 
 #define GENL_ADMIN_PERM		0x01
+#define GENL_CMD_CAP_DO		0x02
+#define GENL_CMD_CAP_DUMP	0x04
+#define GENL_CMD_CAP_HASPOL	0x08
 
 /*
  * List of reserved static generic netlink identifiers:
diff --git a/net/netlink/genetlink.c b/net/netlink/genetlink.c
index cc874f0..adfc203 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)
 		goto errout;
 	}
 
+	if (ops->dumpit)
+		ops->flags |= GENL_CMD_CAP_DO;
+	if (ops->doit)
+		ops->flags |= GENL_CMD_CAP_DUMP;
+	if (ops->policy)
+		ops->flags |= GENL_CMD_CAP_HASPOL;
+
 	genl_lock();
 	list_add_tail(&ops->ops_list, &family->ops_list);
 	genl_unlock();
@@ -425,15 +432,6 @@ static int ctrl_fill_info(struct genl_family *family, u32 pid, u32 seq,
 			NLA_PUT_U32(skb, CTRL_ATTR_OP_ID, ops->cmd);
 			NLA_PUT_U32(skb, CTRL_ATTR_OP_FLAGS, ops->flags);
 
-			if (ops->policy)
-				NLA_PUT_FLAG(skb, CTRL_ATTR_OP_POLICY);
-
-			if (ops->doit)
-				NLA_PUT_FLAG(skb, CTRL_ATTR_OP_DOIT);
-
-			if (ops->dumpit)
-				NLA_PUT_FLAG(skb, CTRL_ATTR_OP_DUMPIT);
-
 			nla_nest_end(skb, nest);
 		}
 

             reply	other threads:[~2006-12-02 11:56 UTC|newest]

Thread overview: 9+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2006-12-02 11:56 jamal [this message]
2006-12-04  9:20 ` [RFC][GENETLINK] move command capabilities to flags Thomas Graf
2006-12-04 13:01   ` jamal
2006-12-04 16:31     ` Thomas Graf
2006-12-04 17:48       ` jamal
2006-12-04 18:00         ` Thomas Graf
2006-12-04 21:07           ` jamal
2006-12-04 21:23             ` Thomas Graf
2006-12-05  3:32               ` David Miller

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=1165060612.3564.8.camel@localhost \
    --to=hadi@cyberus.ca \
    --cc=davem@davemloft.net \
    --cc=netdev@vger.kernel.org \
    --cc=tgraf@suug.ch \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.