[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <20151126140001.GA14223@orbit.nwl.cc>
Date: Thu, 26 Nov 2015 15:00:01 +0100
From: Phil Sutter <phil@....cc>
To: Hannes Frederic Sowa <hannes@...essinduktion.org>
Cc: Stephen Hemminger <shemming@...cade.com>, netdev@...r.kernel.org
Subject: Re: [iproute PATCH RFC] libnetlink: introduce DECLARE_NLREQ
On Thu, Nov 26, 2015 at 02:56:30PM +0100, Hannes Frederic Sowa wrote:
> > +#define DECLARE_NLREQ(name, hdrname, payload, tailroom) \
> > + struct { \
> > + struct nlmsghdr hdrname; \
> > + payload; \
> > + char __b[tailroom] __attribute__((aligned(NLMSG_ALIGNTO))); \
> > + } name = { .hdrname = { \
> > + .nlmsg_len = (unsigned long)&name.__b - (unsigned long)&name, \
>
> offsetof(typeof(name), __b) ?
Ah, thanks! I already considered offsetof(), but the fact it needs a
type name and the declared struct is anonymous appeared unsolvable to
me. Good to know typeof() can be used this way!
Thanks, Phil
--
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