Re: [PATCH v6 1/3] seccomp: kill the seccomp_t typedef

From: Will Drewry
Date: Mon Feb 06 2012 - 11:13:48 EST


On Fri, Feb 3, 2012 at 7:05 PM, Linus Torvalds
<torvalds@xxxxxxxxxxxxxxxxxxxx> wrote:
> On Fri, Feb 3, 2012 at 3:16 PM, Will Drewry <wad@xxxxxxxxxxxx> wrote:
>>
>> task_struct {
>>  ...
>>  struct seccomp seccomp;
>> }
>>
>> was as ideal.  I've noticed that almost all of the duplicate names in
>> the task struct use redundancy to differentiate the naming, but I'm
>> happy enough to rename if appropriate.
>
> The redundant "struct xyz_struct" naming is traditional, but we try to
> avoid it these days. The reason for it is that I long long ago was a
> bit confused about the C namespace rules, so for the longest time I
> made struct names unique for no really good reason. The struct/union
> namespace is separate from the other namespaces, so trying to make
> things unique really has no good reason.
>
> And obviously "struct task_struct" is one of those very old things,
> and then the "struct xyz_struct" naming kind of spread from there.
>
> I think "struct seccomp" is fine, and even if "struct x x" looks a bit
> odd, it's at least _less_ repetition than "struct x_struct x" which is
> just really repetitive.
>
> That said, just to make "grep" easier, please do the whole "struct
> xyz" always together, and always with just a single space in between
> them, so that
>
>   git grep "struct xyz"
>
> does the right thing. And for the same reason, when declaring a
> struct, people should always use "struct xyz {", with that exact
> spacing. The exact details of spacing obviously has no semantic
> meaning, but making it easy to grep for use and for definition is
> really convenient.

Thanks for the background and explanation!
will
--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.tux.org/lkml/