Re: [PATCH] mm: Use octal not symbolic permissions

From: Joe Perches
Date: Wed Mar 28 2018 - 11:45:01 EST


On Wed, 2018-03-28 at 15:06 +0200, Michal Hocko wrote:
> On Mon 26-03-18 15:22:32, Joe Perches wrote:
> > mm/*.c files use symbolic and octal styles for permissions.
> >
> > Using octal and not symbolic permissions is preferred by many as more
> > readable.
> >
> > https://lkml.org/lkml/2016/8/2/1945
> >
> > Prefer the direct use of octal for permissions.
> >
> > Done using
> > $ scripts/checkpatch.pl -f --types=SYMBOLIC_PERMS --fix-inplace mm/*.c
> > and some typing.
> >
> > Before: $ git grep -P -w "0[0-7]{3,3}" mm | wc -l
> > 44
> > After: $ git grep -P -w "0[0-7]{3,3}" mm | wc -l
> > 86
>

> Ohh, I absolutely detest those symbolic names. I always have to check
> what they actually mean to be sure. Octal representation is quite
> natural to read. So for once I am really happy about such a clean up
> change.
>
> Btw. something like this should be quite easy to automate via
> coccinelle AFAIU.

checkpatch is currently better at this, for some
definition of better, than Coccinelle.

Julia and I had a discussion about it awhile ago.
https://lkml.org/lkml/2017/2/4/140

S_<FOO> groupings need to be combined and can
appear in arbitrary order.

Coccinelle would need the same octal addition in
some code path as checkpatch already has.

> > Miscellanea:
> >
> > o Whitespace neatening around these conversions.
> >
> > Signed-off-by: Joe Perches <joe@xxxxxxxxxxx>
>
> I hope I haven't overlooked any potential mismatch...

Doubtful as the conversion is completely automated.