Skip to content

Commit

Permalink
---
Browse files Browse the repository at this point in the history
yaml
---
r: 229182
b: refs/heads/master
c: 98eb2b4
h: refs/heads/master
v: v3
  • Loading branch information
Chuck Lever authored and Trond Myklebust committed Dec 16, 2010
1 parent 2554e4c commit 671283e
Show file tree
Hide file tree
Showing 2 changed files with 16 additions and 21 deletions.
2 changes: 1 addition & 1 deletion [refs]
Original file line number Diff line number Diff line change
@@ -1,2 +1,2 @@
---
refs/heads/master: 49b170047f4a9fe1483132e14a11bdf493bdb8af
refs/heads/master: 98eb2b4f9323bcf2a46476576d3155758cb0a473
35 changes: 15 additions & 20 deletions trunk/fs/nfs/mount_clnt.c
Original file line number Diff line number Diff line change
Expand Up @@ -280,20 +280,14 @@ void nfs_umount(const struct nfs_mount_request *info)
* XDR encode/decode functions for MOUNT
*/

static int encode_mntdirpath(struct xdr_stream *xdr, const char *pathname)
static void encode_mntdirpath(struct xdr_stream *xdr, const char *pathname)
{
const u32 pathname_len = strlen(pathname);
__be32 *p;

if (unlikely(pathname_len > MNTPATHLEN))
return -EIO;

p = xdr_reserve_space(xdr, sizeof(u32) + pathname_len);
if (unlikely(p == NULL))
return -EIO;
BUG_ON(pathname_len > MNTPATHLEN);
p = xdr_reserve_space(xdr, 4 + pathname_len);
xdr_encode_opaque(p, pathname, pathname_len);

return 0;
}

static int mnt_enc_dirpath(struct rpc_rqst *req, __be32 *p,
Expand All @@ -302,7 +296,8 @@ static int mnt_enc_dirpath(struct rpc_rqst *req, __be32 *p,
struct xdr_stream xdr;

xdr_init_encode(&xdr, &req->rq_snd_buf, p);
return encode_mntdirpath(&xdr, dirpath);
encode_mntdirpath(&xdr, dirpath);
return 0;
}

/*
Expand All @@ -320,10 +315,10 @@ static int decode_status(struct xdr_stream *xdr, struct mountres *res)
u32 status;
__be32 *p;

p = xdr_inline_decode(xdr, sizeof(status));
p = xdr_inline_decode(xdr, 4);
if (unlikely(p == NULL))
return -EIO;
status = ntohl(*p);
status = be32_to_cpup(p);

for (i = 0; i < ARRAY_SIZE(mnt_errtbl); i++) {
if (mnt_errtbl[i].status == status) {
Expand Down Expand Up @@ -371,10 +366,10 @@ static int decode_fhs_status(struct xdr_stream *xdr, struct mountres *res)
u32 status;
__be32 *p;

p = xdr_inline_decode(xdr, sizeof(status));
p = xdr_inline_decode(xdr, 4);
if (unlikely(p == NULL))
return -EIO;
status = ntohl(*p);
status = be32_to_cpup(p);

for (i = 0; i < ARRAY_SIZE(mnt3_errtbl); i++) {
if (mnt3_errtbl[i].status == status) {
Expand All @@ -394,11 +389,11 @@ static int decode_fhandle3(struct xdr_stream *xdr, struct mountres *res)
u32 size;
__be32 *p;

p = xdr_inline_decode(xdr, sizeof(size));
p = xdr_inline_decode(xdr, 4);
if (unlikely(p == NULL))
return -EIO;

size = ntohl(*p++);
size = be32_to_cpup(p);
if (size > NFS3_FHSIZE || size == 0)
return -EIO;

Expand All @@ -421,23 +416,23 @@ static int decode_auth_flavors(struct xdr_stream *xdr, struct mountres *res)
if (*count == 0)
return 0;

p = xdr_inline_decode(xdr, sizeof(entries));
p = xdr_inline_decode(xdr, 4);
if (unlikely(p == NULL))
return -EIO;
entries = ntohl(*p);
entries = be32_to_cpup(p);
dprintk("NFS: received %u auth flavors\n", entries);
if (entries > NFS_MAX_SECFLAVORS)
entries = NFS_MAX_SECFLAVORS;

p = xdr_inline_decode(xdr, sizeof(u32) * entries);
p = xdr_inline_decode(xdr, 4 * entries);
if (unlikely(p == NULL))
return -EIO;

if (entries > *count)
entries = *count;

for (i = 0; i < entries; i++) {
flavors[i] = ntohl(*p++);
flavors[i] = be32_to_cpup(p++);
dprintk("NFS: auth flavor[%u]: %d\n", i, flavors[i]);
}
*count = i;
Expand Down

0 comments on commit 671283e

Please sign in to comment.