[<prev] [next>] [day] [month] [year] [list]
Message-ID: <202107310806.CD5D546DB7@keescook>
Date: Sat, 31 Jul 2021 08:10:20 -0700
From: Kees Cook <keescook@...omium.org>
To: Rasmus Villemoes <linux@...musvillemoes.dk>
Cc: "Williams, Dan J" <dan.j.williams@...el.com>, keithpac@...zon.com,
clang-built-linux@...glegroups.com, linux-kbuild@...r.kernel.org,
akpm@...ux-foundation.org, gregkh@...uxfoundation.org,
dri-devel@...ts.freedesktop.org, linux-cxl@...r.kernel.org,
linux-kernel@...r.kernel.org, linux-wireless@...r.kernel.org,
netdev@...r.kernel.org, linux-hardening@...r.kernel.org,
gustavoars@...nel.org, linux-staging@...ts.linux.dev,
linux-block@...r.kernel.org
Subject: Re: [PATCH 04/64] stddef: Introduce struct_group() helper macro
On Sat, Jul 31, 2021 at 07:24:44AM +0200, Rasmus Villemoes wrote:
> On Sat, Jul 31, 2021, 04:59 Kees Cook <keescook@...omium.org> wrote:
>
> > On Fri, Jul 30, 2021 at 10:19:20PM +0000, Williams, Dan J wrote:
> > > On Wed, 2021-07-28 at 14:59 -0700, Kees Cook wrote:
> >
> > > /**
> > > * struct_group(NAME, MEMBERS)
> > > *
> > > @@ -67,7 +73,10 @@ enum {
> > > * @NAME: The name of the mirrored sub-struct
> > > * @MEMBERS: The member declarations for the mirrored structs
> > > */
> > > -#define struct_group(NAME, MEMBERS) \
> > > +#define struct_group(NAME, MEMBERS...) \
> > > struct_group_attr(NAME, /* no attrs */, MEMBERS)
> > >
> > > +#define struct_group_typed(TYPE, NAME, MEMBERS...) \
> > > + struct_group_attr_typed(TYPE, NAME, /* no attrs */, MEMBERS)
> > > +
> > > #endif
> >
> > Awesome! My instinct is to expose the resulting API as:
> >
> > __struct_group(type, name, attrs, members...)
> >
> > struct_group(name, members...)
> > struct_group_attr(name, attrs, members...)
> > struct_group_typed(type, name, members...)
>
> Bikeshed: can we use proper nomenclature please. s/type/tag/,
> s/typed/tagged.
Ah! Thank you. I went looking for the spec on what these are called and
couldn't find it. "struct $tag" is the type, then, yes? So IIUC now:
| type | members | name
| tag
struct foo { int bar; } baz;
--
Kees Cook
Powered by blists - more mailing lists