提交 f26c7a78 编写于 作者: T Trond Myklebust

NFSv4: Clean up decode_getfattr()

Signed-off-by: NTrond Myklebust <Trond.Myklebust@netapp.com>
上级 bca79478
...@@ -2996,55 +2996,91 @@ static int decode_getfattr(struct xdr_stream *xdr, struct nfs_fattr *fattr, cons ...@@ -2996,55 +2996,91 @@ static int decode_getfattr(struct xdr_stream *xdr, struct nfs_fattr *fattr, cons
umode_t fmode = 0; umode_t fmode = 0;
uint64_t fileid; uint64_t fileid;
if ((status = decode_op_hdr(xdr, OP_GETATTR)) != 0) status = decode_op_hdr(xdr, OP_GETATTR);
if (status < 0)
goto xdr_error; goto xdr_error;
if ((status = decode_attr_bitmap(xdr, bitmap)) != 0)
status = decode_attr_bitmap(xdr, bitmap);
if (status < 0)
goto xdr_error; goto xdr_error;
if ((status = decode_attr_length(xdr, &attrlen, &savep)) != 0) status = decode_attr_length(xdr, &attrlen, &savep);
if (status < 0)
goto xdr_error; goto xdr_error;
if ((status = decode_attr_type(xdr, bitmap, &type)) != 0) status = decode_attr_type(xdr, bitmap, &type);
if (status < 0)
goto xdr_error; goto xdr_error;
fattr->mode = nfs_type2fmt[type]; fattr->mode = nfs_type2fmt[type];
if ((status = decode_attr_change(xdr, bitmap, &fattr->change_attr)) != 0) status = decode_attr_change(xdr, bitmap, &fattr->change_attr);
if (status < 0)
goto xdr_error; goto xdr_error;
if ((status = decode_attr_size(xdr, bitmap, &fattr->size)) != 0)
status = decode_attr_size(xdr, bitmap, &fattr->size);
if (status < 0)
goto xdr_error; goto xdr_error;
if ((status = decode_attr_fsid(xdr, bitmap, &fattr->fsid)) != 0)
status = decode_attr_fsid(xdr, bitmap, &fattr->fsid);
if (status < 0)
goto xdr_error; goto xdr_error;
if ((status = decode_attr_fileid(xdr, bitmap, &fattr->fileid)) != 0)
status = decode_attr_fileid(xdr, bitmap, &fattr->fileid);
if (status < 0)
goto xdr_error; goto xdr_error;
if ((status = decode_attr_fs_locations(xdr, bitmap, container_of(fattr,
status = decode_attr_fs_locations(xdr, bitmap, container_of(fattr,
struct nfs4_fs_locations, struct nfs4_fs_locations,
fattr))) != 0) fattr));
if (status < 0)
goto xdr_error; goto xdr_error;
if ((status = decode_attr_mode(xdr, bitmap, &fmode)) != 0)
status = decode_attr_mode(xdr, bitmap, &fmode);
if (status < 0)
goto xdr_error; goto xdr_error;
fattr->mode |= fmode; fattr->mode |= fmode;
if ((status = decode_attr_nlink(xdr, bitmap, &fattr->nlink)) != 0)
status = decode_attr_nlink(xdr, bitmap, &fattr->nlink);
if (status < 0)
goto xdr_error; goto xdr_error;
if ((status = decode_attr_owner(xdr, bitmap, server->nfs_client, &fattr->uid)) != 0)
status = decode_attr_owner(xdr, bitmap, server->nfs_client, &fattr->uid);
if (status < 0)
goto xdr_error; goto xdr_error;
if ((status = decode_attr_group(xdr, bitmap, server->nfs_client, &fattr->gid)) != 0)
status = decode_attr_group(xdr, bitmap, server->nfs_client, &fattr->gid);
if (status < 0)
goto xdr_error; goto xdr_error;
if ((status = decode_attr_rdev(xdr, bitmap, &fattr->rdev)) != 0)
status = decode_attr_rdev(xdr, bitmap, &fattr->rdev);
if (status < 0)
goto xdr_error; goto xdr_error;
if ((status = decode_attr_space_used(xdr, bitmap, &fattr->du.nfs3.used)) != 0)
status = decode_attr_space_used(xdr, bitmap, &fattr->du.nfs3.used);
if (status < 0)
goto xdr_error; goto xdr_error;
if ((status = decode_attr_time_access(xdr, bitmap, &fattr->atime)) != 0)
status = decode_attr_time_access(xdr, bitmap, &fattr->atime);
if (status < 0)
goto xdr_error; goto xdr_error;
if ((status = decode_attr_time_metadata(xdr, bitmap, &fattr->ctime)) != 0)
status = decode_attr_time_metadata(xdr, bitmap, &fattr->ctime);
if (status < 0)
goto xdr_error; goto xdr_error;
if ((status = decode_attr_time_modify(xdr, bitmap, &fattr->mtime)) != 0)
status = decode_attr_time_modify(xdr, bitmap, &fattr->mtime);
if (status < 0)
goto xdr_error; goto xdr_error;
if ((status = decode_attr_mounted_on_fileid(xdr, bitmap, &fileid)) != 0)
status = decode_attr_mounted_on_fileid(xdr, bitmap, &fileid);
if (status < 0)
goto xdr_error; goto xdr_error;
if (fattr->fileid == 0 && fileid != 0) if (fattr->fileid == 0 && fileid != 0)
fattr->fileid = fileid; fattr->fileid = fileid;
if ((status = verify_attr_len(xdr, savep, attrlen)) == 0)
status = verify_attr_len(xdr, savep, attrlen);
if (status == 0)
fattr->valid = NFS_ATTR_FATTR_V4; fattr->valid = NFS_ATTR_FATTR_V4;
xdr_error: xdr_error:
dprintk("%s: xdr returned %d\n", __func__, -status); dprintk("%s: xdr returned %d\n", __func__, -status);
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册