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 [email protected]
More majordomo info at  http://vger.kernel.org/majordomo-info.html

Reply via email to