Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]
Groups > linux.kernel > #1455750
| From | Michal Nazarewicz <mina86@mina86.com> |
|---|---|
| Newsgroups | linux.kernel |
| Subject | Re: [PATCH 0984/1285] Replace numeric parameter like 0444 with macro |
| Date | 2016-08-03 13:20 +0200 |
| Message-ID | <s22nn-1Pn-7@gated-at.bofh.it> (permalink) |
| References | <s1IoG-5bC-19@gated-at.bofh.it> <s1IoG-5bC-17@gated-at.bofh.it> <s22nn-1Pn-9@gated-at.bofh.it> |
| Organization | http://mina86.com/ |
On Wed, Aug 03 2016, Oliver Neukum wrote: > Before we think about that, the basic question whether > > S_IRUSR | S_IWUSR | S_IRGRP | S_IROTH > > is clearer and easier to read than > > 0644 > > must be decided. I would saz no, it is not. I was about to write the same thing. I dislike magic numbers just like the next guy, but this replaces a compact representation of the permissions with a long string of hard to read, awkwardly abbreviated strings. On personal note, I can never remember whether ‘u’ means user and ‘o’ means other or ‘u’ means users and ‘o’ means ‘owner’. In cited case this is somehow averted because both USR and OTH are present, but what does ‘S_IRWXU’ mean is a mystery to me. To my mind, the macros make sense only when testing for particular bit being set. Something like: if (mode & S_IRUSR && check_if_user_can_read()) success; could be argued as better than ‘mode & 0400’ but even than the awkward abbreviation doesn’t help. Again, ‘PERM_USER_READABLE’ would be much better (also for the reason mentioned above). -- Best regards ミハウ “𝓶𝓲𝓷𝓪86” ナザレヴイツ «If at first you don’t succeed, give up skydiving»
Back to linux.kernel | Previous | Next — Previous in thread | Next in thread | Find similar | Unroll thread
Re: [PATCH 0984/1285] Replace numeric parameter like 0444 with macro Felipe Balbi <felipe.balbi@linux.intel.com> - 2016-08-02 16:00 +0200 Re: [PATCH 0984/1285] Replace numeric parameter like 0444 with macro Marcel Holtmann <marcel@holtmann.org> - 2016-08-02 16:10 +0200 Re: [PATCH 0984/1285] Replace numeric parameter like 0444 with macro Marcel Holtmann <marcel@holtmann.org> - 2016-08-02 16:10 +0200 Re: [PATCH 0984/1285] Replace numeric parameter like 0444 with macro Michal Nazarewicz <mina86@mina86.com> - 2016-08-03 13:20 +0200 Re: [PATCH 0984/1285] Replace numeric parameter like 0444 with macro Oliver Neukum <oneukum@suse.com> - 2016-08-03 14:30 +0200
csiph-web