summaryrefslogtreecommitdiff
path: root/fs/nfsd/nfs4state.c
diff options
context:
space:
mode:
authorJ. Bruce Fields <bfields@citi.umich.edu>2008-01-14 13:12:19 -0500
committerJ. Bruce Fields <bfields@citi.umich.edu>2008-02-01 16:42:07 -0500
commit8838dc43d6544570e8969a74ddc4a0d21abffde6 (patch)
treef3082dd80293fe5279d8ff993d2e0c17a0a2f2b4 /fs/nfsd/nfs4state.c
parentb39c18fce003bb2d5a51a4734d8fdd2c81fa1a78 (diff)
downloadlinux-3.10-8838dc43d6544570e8969a74ddc4a0d21abffde6.tar.gz
linux-3.10-8838dc43d6544570e8969a74ddc4a0d21abffde6.tar.bz2
linux-3.10-8838dc43d6544570e8969a74ddc4a0d21abffde6.zip
nfsd4: clean up access_valid, deny_valid checks.
Document these checks a little better and inline, as suggested by Neil Brown (note both functions have two callers). Remove an obviously bogus check while we're there (checking whether unsigned value is negative). Signed-off-by: J. Bruce Fields <bfields@citi.umich.edu> Cc: Neil Brown <neilb@suse.de>
Diffstat (limited to 'fs/nfsd/nfs4state.c')
-rw-r--r--fs/nfsd/nfs4state.c13
1 files changed, 9 insertions, 4 deletions
diff --git a/fs/nfsd/nfs4state.c b/fs/nfsd/nfs4state.c
index c4b10a1e6c3..f6744bc03da 100644
--- a/fs/nfsd/nfs4state.c
+++ b/fs/nfsd/nfs4state.c
@@ -1157,14 +1157,19 @@ find_file(struct inode *ino)
return NULL;
}
-static int access_valid(u32 x)
+static inline int access_valid(u32 x)
{
- return (x > 0 && x < 4);
+ if (x < NFS4_SHARE_ACCESS_READ)
+ return 0;
+ if (x > NFS4_SHARE_ACCESS_BOTH)
+ return 0;
+ return 1;
}
-static int deny_valid(u32 x)
+static inline int deny_valid(u32 x)
{
- return (x >= 0 && x < 5);
+ /* Note: unlike access bits, deny bits may be zero. */
+ return x <= NFS4_SHARE_DENY_BOTH;
}
static void