aboutsummaryrefslogtreecommitdiffstats
path: root/fs/nfs
diff options
context:
space:
mode:
authorTrond Myklebust <Trond.Myklebust@netapp.com>2009-03-11 14:10:26 -0400
committerTrond Myklebust <Trond.Myklebust@netapp.com>2009-03-11 14:10:26 -0400
commitf26c7a78876ccd6c9b477ab4ca127aa1a4ef68c7 (patch)
tree6a51ae1f642883a1c63616d7872ec6f7d87e20e7 /fs/nfs
parentbca794785c2c12ecddeb09e70165b8ff80baa6ae (diff)
NFSv4: Clean up decode_getfattr()
Signed-off-by: Trond Myklebust <Trond.Myklebust@netapp.com>
Diffstat (limited to 'fs/nfs')
-rw-r--r--fs/nfs/nfs4xdr.c78
1 files changed, 57 insertions, 21 deletions
diff --git a/fs/nfs/nfs4xdr.c b/fs/nfs/nfs4xdr.c
index c1906d2a226..43c6e50ff17 100644
--- a/fs/nfs/nfs4xdr.c
+++ b/fs/nfs/nfs4xdr.c
@@ -2996,55 +2996,91 @@ static int decode_getfattr(struct xdr_stream *xdr, struct nfs_fattr *fattr, cons
2996 umode_t fmode = 0; 2996 umode_t fmode = 0;
2997 uint64_t fileid; 2997 uint64_t fileid;
2998 2998
2999 if ((status = decode_op_hdr(xdr, OP_GETATTR)) != 0) 2999 status = decode_op_hdr(xdr, OP_GETATTR);
3000 if (status < 0)
3000 goto xdr_error; 3001 goto xdr_error;
3001 if ((status = decode_attr_bitmap(xdr, bitmap)) != 0) 3002
3003 status = decode_attr_bitmap(xdr, bitmap);
3004 if (status < 0)
3002 goto xdr_error; 3005 goto xdr_error;
3003 3006
3004 if ((status = decode_attr_length(xdr, &attrlen, &savep)) != 0) 3007 status = decode_attr_length(xdr, &attrlen, &savep);
3008 if (status < 0)
3005 goto xdr_error; 3009 goto xdr_error;
3006 3010
3007 3011
3008 if ((status = decode_attr_type(xdr, bitmap, &type)) != 0) 3012 status = decode_attr_type(xdr, bitmap, &type);
3013 if (status < 0)
3009 goto xdr_error; 3014 goto xdr_error;
3010 fattr->mode = nfs_type2fmt[type]; 3015 fattr->mode = nfs_type2fmt[type];
3011 3016
3012 if ((status = decode_attr_change(xdr, bitmap, &fattr->change_attr)) != 0) 3017 status = decode_attr_change(xdr, bitmap, &fattr->change_attr);
3018 if (status < 0)
3013 goto xdr_error; 3019 goto xdr_error;
3014 if ((status = decode_attr_size(xdr, bitmap, &fattr->size)) != 0) 3020
3021 status = decode_attr_size(xdr, bitmap, &fattr->size);
3022 if (status < 0)
3015 goto xdr_error; 3023 goto xdr_error;
3016 if ((status = decode_attr_fsid(xdr, bitmap, &fattr->fsid)) != 0) 3024
3025 status = decode_attr_fsid(xdr, bitmap, &fattr->fsid);
3026 if (status < 0)
3017 goto xdr_error; 3027 goto xdr_error;
3018 if ((status = decode_attr_fileid(xdr, bitmap, &fattr->fileid)) != 0) 3028
3029 status = decode_attr_fileid(xdr, bitmap, &fattr->fileid);
3030 if (status < 0)
3019 goto xdr_error; 3031 goto xdr_error;
3020 if ((status = decode_attr_fs_locations(xdr, bitmap, container_of(fattr, 3032
3033 status = decode_attr_fs_locations(xdr, bitmap, container_of(fattr,
3021 struct nfs4_fs_locations, 3034 struct nfs4_fs_locations,
3022 fattr))) != 0) 3035 fattr));
3036 if (status < 0)
3023 goto xdr_error; 3037 goto xdr_error;
3024 if ((status = decode_attr_mode(xdr, bitmap, &fmode)) != 0) 3038
3039 status = decode_attr_mode(xdr, bitmap, &fmode);
3040 if (status < 0)
3025 goto xdr_error; 3041 goto xdr_error;
3026 fattr->mode |= fmode; 3042 fattr->mode |= fmode;
3027 if ((status = decode_attr_nlink(xdr, bitmap, &fattr->nlink)) != 0) 3043
3044 status = decode_attr_nlink(xdr, bitmap, &fattr->nlink);
3045 if (status < 0)
3028 goto xdr_error; 3046 goto xdr_error;
3029 if ((status = decode_attr_owner(xdr, bitmap, server->nfs_client, &fattr->uid)) != 0) 3047
3048 status = decode_attr_owner(xdr, bitmap, server->nfs_client, &fattr->uid);
3049 if (status < 0)
3030 goto xdr_error; 3050 goto xdr_error;
3031 if ((status = decode_attr_group(xdr, bitmap, server->nfs_client, &fattr->gid)) != 0) 3051
3052 status = decode_attr_group(xdr, bitmap, server->nfs_client, &fattr->gid);
3053 if (status < 0)
3032 goto xdr_error; 3054 goto xdr_error;
3033 if ((status = decode_attr_rdev(xdr, bitmap, &fattr->rdev)) != 0) 3055
3056 status = decode_attr_rdev(xdr, bitmap, &fattr->rdev);
3057 if (status < 0)
3034 goto xdr_error; 3058 goto xdr_error;
3035 if ((status = decode_attr_space_used(xdr, bitmap, &fattr->du.nfs3.used)) != 0) 3059
3060 status = decode_attr_space_used(xdr, bitmap, &fattr->du.nfs3.used);
3061 if (status < 0)
3036 goto xdr_error; 3062 goto xdr_error;
3037 if ((status = decode_attr_time_access(xdr, bitmap, &fattr->atime)) != 0) 3063
3064 status = decode_attr_time_access(xdr, bitmap, &fattr->atime);
3065 if (status < 0)
3038 goto xdr_error; 3066 goto xdr_error;
3039 if ((status = decode_attr_time_metadata(xdr, bitmap, &fattr->ctime)) != 0) 3067
3068 status = decode_attr_time_metadata(xdr, bitmap, &fattr->ctime);
3069 if (status < 0)
3040 goto xdr_error; 3070 goto xdr_error;
3041 if ((status = decode_attr_time_modify(xdr, bitmap, &fattr->mtime)) != 0) 3071
3072 status = decode_attr_time_modify(xdr, bitmap, &fattr->mtime);
3073 if (status < 0)
3042 goto xdr_error; 3074 goto xdr_error;
3043 if ((status = decode_attr_mounted_on_fileid(xdr, bitmap, &fileid)) != 0) 3075
3076 status = decode_attr_mounted_on_fileid(xdr, bitmap, &fileid);
3077 if (status < 0)
3044 goto xdr_error; 3078 goto xdr_error;
3045 if (fattr->fileid == 0 && fileid != 0) 3079 if (fattr->fileid == 0 && fileid != 0)
3046 fattr->fileid = fileid; 3080 fattr->fileid = fileid;
3047 if ((status = verify_attr_len(xdr, savep, attrlen)) == 0) 3081
3082 status = verify_attr_len(xdr, savep, attrlen);
3083 if (status == 0)
3048 fattr->valid = NFS_ATTR_FATTR_V4; 3084 fattr->valid = NFS_ATTR_FATTR_V4;
3049xdr_error: 3085xdr_error:
3050 dprintk("%s: xdr returned %d\n", __func__, -status); 3086 dprintk("%s: xdr returned %d\n", __func__, -status);