[PATCH] knfsd: nfsd4: fix some open argument tests
authorJ. Bruce Fields <bfields@citi.umich.edu>
Fri, 30 Jun 2006 08:56:16 +0000 (01:56 -0700)
committerLinus Torvalds <torvalds@g5.osdl.org>
Fri, 30 Jun 2006 18:25:40 +0000 (11:25 -0700)
These tests always returned true; clearly that wasn't what was intended.

In keeping with kernel style, make them functions instead of macros while
we're at it.

Signed-off-by: J. Bruce Fields <bfields@citi.umich.edu>
Signed-off-by: Neil Brown <neilb@suse.de>
Signed-off-by: Andrew Morton <akpm@osdl.org>
Signed-off-by: Linus Torvalds <torvalds@osdl.org>
fs/nfsd/nfs4state.c

index 4810577347cf1fa19df202b488e74af994aa0876..591dc6ba6e19769fb128583ee1075c0bb586ffcf 100644 (file)
@@ -1237,8 +1237,15 @@ find_file(struct inode *ino)
        return NULL;
 }
 
-#define TEST_ACCESS(x) ((x > 0 || x < 4)?1:0)
-#define TEST_DENY(x) ((x >= 0 || x < 5)?1:0)
+static int access_valid(u32 x)
+{
+       return (x > 0 && x < 4);
+}
+
+static int deny_valid(u32 x)
+{
+       return (x >= 0 && x < 5);
+}
 
 static void
 set_access(unsigned int *access, unsigned long bmap) {
@@ -1745,7 +1752,8 @@ nfsd4_process_open2(struct svc_rqst *rqstp, struct svc_fh *current_fh, struct nf
        int status;
 
        status = nfserr_inval;
-       if (!TEST_ACCESS(open->op_share_access) || !TEST_DENY(open->op_share_deny))
+       if (!access_valid(open->op_share_access)
+                       || !deny_valid(open->op_share_deny))
                goto out;
        /*
         * Lookup file; if found, lookup stateid and check open request,
@@ -2317,7 +2325,8 @@ nfsd4_open_downgrade(struct svc_rqst *rqstp, struct svc_fh *current_fh, struct n
                        (int)current_fh->fh_dentry->d_name.len,
                        current_fh->fh_dentry->d_name.name);
 
-       if (!TEST_ACCESS(od->od_share_access) || !TEST_DENY(od->od_share_deny))
+       if (!access_valid(od->od_share_access)
+                       || !deny_valid(od->od_share_deny))
                return nfserr_inval;
 
        nfs4_lock_state();