[<prev] [next>] [<thread-prev] [day] [month] [year] [list]
Message-ID: <20120910154243.215fbcab@nehalam.linuxnetplumber.net>
Date: Mon, 10 Sep 2012 15:42:43 -0700
From: Stephen Hemminger <shemminger@...tta.com>
To: Julian Anastasov <ja@....bg>
Cc: netdev@...r.kernel.org
Subject: Re: [PATCH 1/2] iproute2: add libgenl files
On Tue, 11 Sep 2012 00:54:00 +0300 (EEST)
Julian Anastasov <ja@....bg> wrote:
> > Why not an inline function, macro code is error prone.
>
> The problem is that we define every request with
> its own structure in GENL_DEFINE_REQUEST. We can use init
> func instead of macro only if we define some base structure,
> for example:
>
> struct genl_header_base {
> struct nlmsghdr n;
> struct genlmsghdr g;
> };
Ok, that makes sense. I prefer C99 style initializers
in general. Maybe:
#define GENL_INIT_REQUEST(family, hdrsize, ver, cmd_, flags) { \
.req = { \
.n = { \
.nlmsg_type = (family), \
.nlmsg_flags = (flags), \
.nlmsg_len = NLMSG_LENGTH(GENL_HDRLEN + (hdrsize)), \
} \
.g = { \
.cmd = (cmd), \
.version = (ver), \
} \
}
Or merge GENL_DEFINE_REQUEST and GENL_INIT_REQUEST.
These are all nits, and not that important, just want to make it as simple
as possible. So if you like it okay as it was, we can just use that.
--
To unsubscribe from this list: send the line "unsubscribe netdev" in
the body of a message to majordomo@...r.kernel.org
More majordomo info at http://vger.kernel.org/majordomo-info.html
Powered by blists - more mailing lists