diff options
Diffstat (limited to 'fs/nfs/nfs4xdr.c')
-rw-r--r-- | fs/nfs/nfs4xdr.c | 40 |
1 files changed, 19 insertions, 21 deletions
diff --git a/fs/nfs/nfs4xdr.c b/fs/nfs/nfs4xdr.c index 9f1df8361974..c1906d2a226b 100644 --- a/fs/nfs/nfs4xdr.c +++ b/fs/nfs/nfs4xdr.c | |||
@@ -522,20 +522,17 @@ static int nfs4_stat_to_errno(int); | |||
522 | decode_lookup_maxsz + \ | 522 | decode_lookup_maxsz + \ |
523 | decode_fs_locations_maxsz) | 523 | decode_fs_locations_maxsz) |
524 | 524 | ||
525 | static struct { | 525 | static const umode_t nfs_type2fmt[] = { |
526 | unsigned int mode; | 526 | [NF4BAD] = 0, |
527 | unsigned int nfs2type; | 527 | [NF4REG] = S_IFREG, |
528 | } nfs_type2fmt[] = { | 528 | [NF4DIR] = S_IFDIR, |
529 | { 0, NFNON }, | 529 | [NF4BLK] = S_IFBLK, |
530 | { S_IFREG, NFREG }, | 530 | [NF4CHR] = S_IFCHR, |
531 | { S_IFDIR, NFDIR }, | 531 | [NF4LNK] = S_IFLNK, |
532 | { S_IFBLK, NFBLK }, | 532 | [NF4SOCK] = S_IFSOCK, |
533 | { S_IFCHR, NFCHR }, | 533 | [NF4FIFO] = S_IFIFO, |
534 | { S_IFLNK, NFLNK }, | 534 | [NF4ATTRDIR] = 0, |
535 | { S_IFSOCK, NFSOCK }, | 535 | [NF4NAMEDATTR] = 0, |
536 | { S_IFIFO, NFFIFO }, | ||
537 | { 0, NFNON }, | ||
538 | { 0, NFNON }, | ||
539 | }; | 536 | }; |
540 | 537 | ||
541 | struct compound_hdr { | 538 | struct compound_hdr { |
@@ -2173,7 +2170,7 @@ static int decode_attr_type(struct xdr_stream *xdr, uint32_t *bitmap, uint32_t * | |||
2173 | } | 2170 | } |
2174 | bitmap[0] &= ~FATTR4_WORD0_TYPE; | 2171 | bitmap[0] &= ~FATTR4_WORD0_TYPE; |
2175 | } | 2172 | } |
2176 | dprintk("%s: type=0%o\n", __func__, nfs_type2fmt[*type].nfs2type); | 2173 | dprintk("%s: type=0%o\n", __func__, nfs_type2fmt[*type]); |
2177 | return 0; | 2174 | return 0; |
2178 | } | 2175 | } |
2179 | 2176 | ||
@@ -2580,8 +2577,9 @@ static int decode_attr_maxwrite(struct xdr_stream *xdr, uint32_t *bitmap, uint32 | |||
2580 | return status; | 2577 | return status; |
2581 | } | 2578 | } |
2582 | 2579 | ||
2583 | static int decode_attr_mode(struct xdr_stream *xdr, uint32_t *bitmap, uint32_t *mode) | 2580 | static int decode_attr_mode(struct xdr_stream *xdr, uint32_t *bitmap, umode_t *mode) |
2584 | { | 2581 | { |
2582 | uint32_t tmp; | ||
2585 | __be32 *p; | 2583 | __be32 *p; |
2586 | 2584 | ||
2587 | *mode = 0; | 2585 | *mode = 0; |
@@ -2589,8 +2587,8 @@ static int decode_attr_mode(struct xdr_stream *xdr, uint32_t *bitmap, uint32_t * | |||
2589 | return -EIO; | 2587 | return -EIO; |
2590 | if (likely(bitmap[1] & FATTR4_WORD1_MODE)) { | 2588 | if (likely(bitmap[1] & FATTR4_WORD1_MODE)) { |
2591 | READ_BUF(4); | 2589 | READ_BUF(4); |
2592 | READ32(*mode); | 2590 | READ32(tmp); |
2593 | *mode &= ~S_IFMT; | 2591 | *mode = tmp & ~S_IFMT; |
2594 | bitmap[1] &= ~FATTR4_WORD1_MODE; | 2592 | bitmap[1] &= ~FATTR4_WORD1_MODE; |
2595 | } | 2593 | } |
2596 | dprintk("%s: file mode=0%o\n", __func__, (unsigned int)*mode); | 2594 | dprintk("%s: file mode=0%o\n", __func__, (unsigned int)*mode); |
@@ -2994,7 +2992,8 @@ static int decode_getfattr(struct xdr_stream *xdr, struct nfs_fattr *fattr, cons | |||
2994 | uint32_t attrlen, | 2992 | uint32_t attrlen, |
2995 | bitmap[2] = {0}, | 2993 | bitmap[2] = {0}, |
2996 | type; | 2994 | type; |
2997 | int status, fmode = 0; | 2995 | int status; |
2996 | umode_t fmode = 0; | ||
2998 | uint64_t fileid; | 2997 | uint64_t fileid; |
2999 | 2998 | ||
3000 | if ((status = decode_op_hdr(xdr, OP_GETATTR)) != 0) | 2999 | if ((status = decode_op_hdr(xdr, OP_GETATTR)) != 0) |
@@ -3008,8 +3007,7 @@ static int decode_getfattr(struct xdr_stream *xdr, struct nfs_fattr *fattr, cons | |||
3008 | 3007 | ||
3009 | if ((status = decode_attr_type(xdr, bitmap, &type)) != 0) | 3008 | if ((status = decode_attr_type(xdr, bitmap, &type)) != 0) |
3010 | goto xdr_error; | 3009 | goto xdr_error; |
3011 | fattr->type = nfs_type2fmt[type].nfs2type; | 3010 | fattr->mode = nfs_type2fmt[type]; |
3012 | fattr->mode = nfs_type2fmt[type].mode; | ||
3013 | 3011 | ||
3014 | if ((status = decode_attr_change(xdr, bitmap, &fattr->change_attr)) != 0) | 3012 | if ((status = decode_attr_change(xdr, bitmap, &fattr->change_attr)) != 0) |
3015 | goto xdr_error; | 3013 | goto xdr_error; |