Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]
Groups > linux.kernel > #1455709
| From | Willy Tarreau <w@1wt.eu> |
|---|---|
| Newsgroups | linux.kernel |
| Subject | Re: [PATCH] Add file permission mode helpers |
| Date | 2016-08-03 11:30 +0200 |
| Message-ID | <s20EV-Iw-1@gated-at.bofh.it> (permalink) |
| References | <s1OX7-1dt-9@gated-at.bofh.it> <s1Zzb-8wu-1@gated-at.bofh.it> <s1ZIR-8a-7@gated-at.bofh.it> <s20bU-i1-21@gated-at.bofh.it> |
| Organization | linux.* mail to news gateway |
On Wed, Aug 03, 2016 at 10:39:03AM +0200, Ingo Molnar wrote: > > > While the weird permissions in this: > > > > > > + __ATTR(l1, PERM_r__r__r__, driver_show_l4, NULL); > > > + __ATTR(l3, PERM_r__r__rw_, driver_show_l4, NULL); > > > + __ATTR(l2, PERM_sr__r__r__, driver_show_l4, NULL); > > > + __ATTR(l4, PERM_r__r__r__, driver_show_l4, NULL); > > > > > > Wouln't even build, because the dangerous patterns of PERM_r__r__rw_ or > > > PERM_sr__r__r__ are not defined to begin with. > > > > Because of that, odds are people will just stick to the octal numbers, > > because they think they want something other than the ones you defined > > for foolish reasons :) > > For code I maintain I'd insist on contributors using the human readable versions, > because in the past I've mixed up octals (and the symbolic helpers we have today) > myself and I find the 'ls -l' format much easier to read because that's the > primary file permission format I see every day working on code. FWIW, the only "human readable" ones for me are the octal ones, which are also the same as those I'm using every day with "chmod" or "find" and that I find hard to get wrong. But I agree that the PERM_* idea above are a nice alternative since they match the "ls -l" output, and you can even add the directory flag there with "d" like "ls" does. You could also have PERM_0444 and similar for those who are more at ease with the octal numers without defining the few ones that are definitely wrong, as a safety belt. > > That being said, I do like them much better than the macros we have today, which > > I always have to go and look up every time I see them... > > Same here! Same for me. I never use S_I* and never know where to look for their definitions when I see them. Willy
Back to linux.kernel | Previous | Next — Previous in thread | Next in thread | Find similar | Unroll thread
Please don't replace numeric parameter like 0444 with macro Linus Torvalds <torvalds@linux-foundation.org> - 2016-08-02 23:00 +0200
Re: Please don't replace numeric parameter like 0444 with macro Rob Landley <rob@landley.net> - 2016-08-03 00:00 +0200
[PATCH] checkpatch: Look for symbolic permissions and suggest octal instead Joe Perches <joe@perches.com> - 2016-08-03 01:50 +0200
Re: [PATCH] checkpatch: Look for symbolic permissions and suggest octal instead Joe Perches <joe@perches.com> - 2016-08-03 02:40 +0200
Re: [PATCH] checkpatch: Look for symbolic permissions and suggest octal instead Al Viro <viro@ZenIV.linux.org.uk> - 2016-08-03 04:10 +0200
Re: Please don't replace numeric parameter like 0444 with macro Al Viro <viro@ZenIV.linux.org.uk> - 2016-08-03 02:50 +0200
Re: Please don't replace numeric parameter like 0444 with macro Konstantin Khlebnikov <koct9i@gmail.com> - 2016-08-03 10:10 +0200
Re: Please don't replace numeric parameter like 0444 with macro Richard Weinberger <richard.weinberger@gmail.com> - 2016-08-03 10:40 +0200
[PATCH] Add file permission mode helpers Ingo Molnar <mingo@kernel.org> - 2016-08-03 10:20 +0200
Re: [PATCH] Add file permission mode helpers Greg Kroah-Hartman <gregkh@linuxfoundation.org> - 2016-08-03 10:30 +0200
Re: [PATCH] Add file permission mode helpers Ingo Molnar <mingo@kernel.org> - 2016-08-03 11:00 +0200
Re: [PATCH] Add file permission mode helpers Willy Tarreau <w@1wt.eu> - 2016-08-03 11:30 +0200
Re: [PATCH] Add file permission mode helpers Marcel Holtmann <marcel@holtmann.org> - 2016-08-03 12:00 +0200
Re: [PATCH] Add file permission mode helpers Joe Perches <joe@perches.com> - 2016-08-03 17:50 +0200
Re: [PATCH] Add file permission mode helpers Pavel Machek <pavel@ucw.cz> - 2016-08-03 19:00 +0200
csiph-web