]> git.openfabrics.org - ~emulex/infiniband.git/commitdiff
NFS: get rid of some needless code obfuscation in xdr_encode_sattr().
authorTrond Myklebust <Trond.Myklebust@netapp.com>
Tue, 3 Jan 2006 08:55:54 +0000 (09:55 +0100)
committerTrond Myklebust <Trond.Myklebust@netapp.com>
Fri, 6 Jan 2006 19:58:57 +0000 (14:58 -0500)
Signed-off-by: Trond Myklebust <Trond.Myklebust@netapp.com>
fs/nfs/nfs2xdr.c

index 59049e864ca7818288559a91625526a45ec081db..7fc0560c89c99187e8a7a8b386f69712aa19b347 100644 (file)
@@ -146,23 +146,23 @@ xdr_decode_fattr(u32 *p, struct nfs_fattr *fattr)
        return p;
 }
 
-#define SATTR(p, attr, flag, field) \
-        *p++ = (attr->ia_valid & flag) ? htonl(attr->field) : ~(u32) 0
 static inline u32 *
 xdr_encode_sattr(u32 *p, struct iattr *attr)
 {
-       SATTR(p, attr, ATTR_MODE, ia_mode);
-       SATTR(p, attr, ATTR_UID, ia_uid);
-       SATTR(p, attr, ATTR_GID, ia_gid);
-       SATTR(p, attr, ATTR_SIZE, ia_size);
+       const u32 not_set = __constant_htonl(0xFFFFFFFF);
+
+       *p++ = (attr->ia_valid & ATTR_MODE) ? htonl(attr->ia_mode) : not_set;
+       *p++ = (attr->ia_valid & ATTR_UID) ? htonl(attr->ia_uid) : not_set;
+       *p++ = (attr->ia_valid & ATTR_GID) ? htonl(attr->ia_gid) : not_set;
+       *p++ = (attr->ia_valid & ATTR_SIZE) ? htonl(attr->ia_size) : not_set;
 
        if (attr->ia_valid & ATTR_ATIME_SET) {
                p = xdr_encode_time(p, &attr->ia_atime);
        } else if (attr->ia_valid & ATTR_ATIME) {
                p = xdr_encode_current_server_time(p, &attr->ia_atime);
        } else {
-               *p++ = ~(u32) 0;
-               *p++ = ~(u32) 0;
+               *p++ = not_set;
+               *p++ = not_set;
        }
 
        if (attr->ia_valid & ATTR_MTIME_SET) {
@@ -170,12 +170,11 @@ xdr_encode_sattr(u32 *p, struct iattr *attr)
        } else if (attr->ia_valid & ATTR_MTIME) {
                p = xdr_encode_current_server_time(p, &attr->ia_mtime);
        } else {
-               *p++ = ~(u32) 0;        
-               *p++ = ~(u32) 0;
+               *p++ = not_set; 
+               *p++ = not_set;
        }
        return p;
 }
-#undef SATTR
 
 /*
  * NFS encode functions