From: Phil Sutter <phil@nwl.cc>
To: Hannes Frederic Sowa <hannes@stressinduktion.org>
Cc: Stephen Hemminger <shemming@brocade.com>, netdev@vger.kernel.org
Subject: Re: [iproute PATCH RFC] libnetlink: introduce DECLARE_NLREQ
Date: Thu, 26 Nov 2015 15:00:01 +0100 [thread overview]
Message-ID: <20151126140001.GA14223@orbit.nwl.cc> (raw)
In-Reply-To: <87oaegx3sh.fsf@stressinduktion.org>
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
next prev parent reply other threads:[~2015-11-26 14:00 UTC|newest]
Thread overview: 7+ messages / expand[flat|nested] mbox.gz Atom feed top
2015-11-26 13:26 [iproute PATCH RFC] libnetlink: introduce DECLARE_NLREQ Phil Sutter
2015-11-26 13:56 ` Hannes Frederic Sowa
2015-11-26 14:00 ` Phil Sutter [this message]
2015-11-29 20:07 ` Stephen Hemminger
2015-11-29 21:40 ` Phil Sutter
2015-11-30 15:47 ` Phil Sutter
2015-11-30 17:20 ` Stephen Hemminger
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=20151126140001.GA14223@orbit.nwl.cc \
--to=phil@nwl.cc \
--cc=hannes@stressinduktion.org \
--cc=netdev@vger.kernel.org \
--cc=shemming@brocade.com \
/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 a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).