From: "J. Bruce Fields" <bfields@fieldses.org>
To: Jim Rees <rees@umich.edu>
Cc: linux-nfs@vger.kernel.org, Leonardo Borda <leonardoborda@gmail.com>
Subject: Re: [PATCH] nfsd4: permit read opens of executable-only files
Date: Thu, 25 Aug 2011 14:52:34 -0400 [thread overview]
Message-ID: <20110825185234.GE1114@fieldses.org> (raw)
In-Reply-To: <20110825173147.GA5286@merit.edu>
On Thu, Aug 25, 2011 at 01:31:47PM -0400, Jim Rees wrote:
> J. Bruce Fields wrote:
>
> #define NFSD_MAY_BYPASS_GSS_ON_ROOT 256
> #define NFSD_MAY_NOT_BREAK_LEASE 512
> #define NFSD_MAY_BYPASS_GSS 1024
> +#define NFSD_MAY_READ_IF_EXEC 2048
>
> Not the fault of your patch, but it seems odd, unreadable, and error-prone
> that these flag bits are defined in terms of base-10 numbers.
Odd is the one thing it isn't.
I guess 1 << n would be easier but hex makes the mask line up nicer.
So there. ?
--b.
commit a9fd873383e3affa5ba7017713fa46949147d418
Author: J. Bruce Fields <bfields@redhat.com>
Date: Thu Aug 25 14:23:39 2011 -0400
nfsd: prettify NFSD_MAY_* flag definitions
Cc: Jim Rees <rees@umich.edu>
Signed-off-by: J. Bruce Fields <bfields@redhat.com>
diff --git a/fs/nfsd/vfs.h b/fs/nfsd/vfs.h
index a22e40e..503f3bf 100644
--- a/fs/nfsd/vfs.h
+++ b/fs/nfsd/vfs.h
@@ -10,22 +10,22 @@
/*
* Flags for nfsd_permission
*/
-#define NFSD_MAY_NOP 0
-#define NFSD_MAY_EXEC 1 /* == MAY_EXEC */
-#define NFSD_MAY_WRITE 2 /* == MAY_WRITE */
-#define NFSD_MAY_READ 4 /* == MAY_READ */
-#define NFSD_MAY_SATTR 8
-#define NFSD_MAY_TRUNC 16
-#define NFSD_MAY_LOCK 32
-#define NFSD_MAY_MASK 63
+#define NFSD_MAY_NOP 0
+#define NFSD_MAY_EXEC 0x001 /* == MAY_EXEC */
+#define NFSD_MAY_WRITE 0x002 /* == MAY_WRITE */
+#define NFSD_MAY_READ 0x004 /* == MAY_READ */
+#define NFSD_MAY_SATTR 0x008
+#define NFSD_MAY_TRUNC 0x010
+#define NFSD_MAY_LOCK 0x020
+#define NFSD_MAY_MASK 0x03f
/* extra hints to permission and open routines: */
-#define NFSD_MAY_OWNER_OVERRIDE 64
-#define NFSD_MAY_LOCAL_ACCESS 128 /* IRIX doing local access check on device special file*/
-#define NFSD_MAY_BYPASS_GSS_ON_ROOT 256
-#define NFSD_MAY_NOT_BREAK_LEASE 512
-#define NFSD_MAY_BYPASS_GSS 1024
-#define NFSD_MAY_READ_IF_EXEC 2048
+#define NFSD_MAY_OWNER_OVERRIDE 0x040
+#define NFSD_MAY_LOCAL_ACCESS 0x080 /* for device special files */
+#define NFSD_MAY_BYPASS_GSS_ON_ROOT 0x100
+#define NFSD_MAY_NOT_BREAK_LEASE 0x200
+#define NFSD_MAY_BYPASS_GSS 0x400
+#define NFSD_MAY_READ_IF_EXEC 0x800
#define NFSD_MAY_CREATE (NFSD_MAY_EXEC|NFSD_MAY_WRITE)
#define NFSD_MAY_REMOVE (NFSD_MAY_EXEC|NFSD_MAY_WRITE|NFSD_MAY_TRUNC)
next prev parent reply other threads:[~2011-08-25 18:52 UTC|newest]
Thread overview: 9+ messages / expand[flat|nested] mbox.gz Atom feed top
2011-08-25 16:19 [PATCH] nfsd4: permit read opens of executable-only files J. Bruce Fields
2011-08-25 17:31 ` Jim Rees
2011-08-25 18:52 ` J. Bruce Fields [this message]
2011-08-25 19:48 ` Jim Rees
2011-08-25 19:49 ` Jim Rees
2011-12-07 22:42 ` Chris J Arges
2011-12-08 21:21 ` J. Bruce Fields
2011-12-13 17:38 ` Chris J Arges
2011-12-13 18:26 ` J. Bruce Fields
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=20110825185234.GE1114@fieldses.org \
--to=bfields@fieldses.org \
--cc=leonardoborda@gmail.com \
--cc=linux-nfs@vger.kernel.org \
--cc=rees@umich.edu \
/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
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.