linux-kernel.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Alexey Dobriyan <adobriyan@gmail.com>
To: linux-kernel@vger.kernel.org
Subject: [RFC] #define rwxr_xr_x 0755
Date: Fri, 28 Jul 2006 00:59:11 +0400	[thread overview]
Message-ID: <20060727205911.GB5356@martell.zuzino.mipt.ru> (raw)

Every time I try to decipher S_I* combos I cry in pain. Often I just
refer to include/linux/stat.h defines to find out what mode it is
because numbers are actually quickier to understand.

Compare and contrast:

	0644 vs S_IRUGO|S_IWUSR vs rw_r__r__

I'd say #2 really sucks.

Another rationale: "ls -l" is used pretty often and people are used to
its output so new defines would be very easy to understand.

Target usage sysfs attributes modes and similar stuff. Driver authors
would just write

	.attr = {.name = "state", .mode = r__r__r__ },

and be done with it.

I'm not sure you want to see

	if (mode & _w__w__w_)

somewhere in generic code, this is debatable, so I'll go with attribute
stuff first.

What people think? Should folks at Moscow call 03 ASAP?

--- a/fs/smbfs/inode.c
+++ b/fs/smbfs/inode.c
@@ -575,10 +575,8 @@ static int smb_fill_super(struct super_b
 		mnt->flags = (oldmnt->file_mode >> 9) | SMB_MOUNT_UID |
 			SMB_MOUNT_GID | SMB_MOUNT_FMODE | SMB_MOUNT_DMODE;
 	} else {
-		mnt->file_mode = S_IRWXU | S_IRGRP | S_IXGRP |
-				S_IROTH | S_IXOTH | S_IFREG;
-		mnt->dir_mode = S_IRWXU | S_IRGRP | S_IXGRP |
-				S_IROTH | S_IXOTH | S_IFDIR;
+		mnt->file_mode = rwxr_xr_x | S_IFREG;
+		mnt->dir_mode = rwxr_xr_x | S_IFDIR;
 		if (parse_options(mnt, raw_data))
 			goto out_bad_option;
 	}
--- a/include/linux/stat.h
+++ b/include/linux/stat.h
@@ -29,6 +29,8 @@ #define S_ISBLK(m)	(((m) & S_IFMT) == S_
 #define S_ISFIFO(m)	(((m) & S_IFMT) == S_IFIFO)
 #define S_ISSOCK(m)	(((m) & S_IFMT) == S_IFSOCK)
 
+#define rwxr_xr_x 0755
+
 #define S_IRWXU 00700
 #define S_IRUSR 00400
 #define S_IWUSR 00200


             reply	other threads:[~2006-07-27 20:59 UTC|newest]

Thread overview: 9+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2006-07-27 20:59 Alexey Dobriyan [this message]
2006-07-27 22:23 ` Björn Steinbrink
2006-07-28 16:34   ` Handle X
2006-07-28 16:48     ` Josef Sipek
2006-07-29  1:43       ` Dmitry Torokhov
2006-07-29  7:59         ` Jan Engelhardt
2006-07-28  3:22 ` Josef Sipek
2006-07-29 13:58 ` Johannes Weiner
2006-07-28  4:54 Albert Cahalan

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20060727205911.GB5356@martell.zuzino.mipt.ru \
    --to=adobriyan@gmail.com \
    --cc=linux-kernel@vger.kernel.org \
    --subject='Re: [RFC] #define rwxr_xr_x 0755' \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link

This is a public inbox, see mirroring instructions
on how to clone and mirror all data and code used for this inbox