diff options
author | Chuck Lever <chuck.lever@oracle.com> | 2011-01-20 22:05:28 -0500 |
---|---|---|
committer | Trond Myklebust <Trond.Myklebust@netapp.com> | 2011-01-25 15:24:47 -0500 |
commit | 731f3f482ad3b2c58a1af2d0a9a634a82803706a (patch) | |
tree | 1425c239481309ffc68dd33a991fc13fc309226c | |
parent | ee5dc7732bd557bae6d10873a0aac606d2c551fb (diff) |
NFS: nfsacl_{encode,decode} should return signed integer
Clean up.
The nfsacl_encode() and nfsacl_decode() functions return negative
errno values, and each call site verifies that the returned value
is not negative. Change the synopsis of both of these functions
to reflect this usage.
Document the synopsis and return values.
Reported-by: Trond Myklebust <trond.myklebust@netapp.com>
Signed-off-by: Chuck Lever <chuck.lever@oracle.com>
Signed-off-by: Trond Myklebust <Trond.Myklebust@netapp.com>
-rw-r--r-- | fs/nfs_common/nfsacl.c | 32 | ||||
-rw-r--r-- | include/linux/nfsacl.h | 4 |
2 files changed, 28 insertions, 8 deletions
diff --git a/fs/nfs_common/nfsacl.c b/fs/nfs_common/nfsacl.c index fc1c52571c03..a3e78bd18679 100644 --- a/fs/nfs_common/nfsacl.c +++ b/fs/nfs_common/nfsacl.c | |||
@@ -72,9 +72,20 @@ xdr_nfsace_encode(struct xdr_array2_desc *desc, void *elem) | |||
72 | return 0; | 72 | return 0; |
73 | } | 73 | } |
74 | 74 | ||
75 | unsigned int | 75 | /** |
76 | nfsacl_encode(struct xdr_buf *buf, unsigned int base, struct inode *inode, | 76 | * nfsacl_encode - Encode an NFSv3 ACL |
77 | struct posix_acl *acl, int encode_entries, int typeflag) | 77 | * |
78 | * @buf: destination xdr_buf to contain XDR encoded ACL | ||
79 | * @base: byte offset in xdr_buf where XDR'd ACL begins | ||
80 | * @inode: inode of file whose ACL this is | ||
81 | * @acl: posix_acl to encode | ||
82 | * @encode_entries: whether to encode ACEs as well | ||
83 | * @typeflag: ACL type: NFS_ACL_DEFAULT or zero | ||
84 | * | ||
85 | * Returns size of encoded ACL in bytes or a negative errno value. | ||
86 | */ | ||
87 | int nfsacl_encode(struct xdr_buf *buf, unsigned int base, struct inode *inode, | ||
88 | struct posix_acl *acl, int encode_entries, int typeflag) | ||
78 | { | 89 | { |
79 | int entries = (acl && acl->a_count) ? max_t(int, acl->a_count, 4) : 0; | 90 | int entries = (acl && acl->a_count) ? max_t(int, acl->a_count, 4) : 0; |
80 | struct nfsacl_encode_desc nfsacl_desc = { | 91 | struct nfsacl_encode_desc nfsacl_desc = { |
@@ -224,9 +235,18 @@ posix_acl_from_nfsacl(struct posix_acl *acl) | |||
224 | return 0; | 235 | return 0; |
225 | } | 236 | } |
226 | 237 | ||
227 | unsigned int | 238 | /** |
228 | nfsacl_decode(struct xdr_buf *buf, unsigned int base, unsigned int *aclcnt, | 239 | * nfsacl_decode - Decode an NFSv3 ACL |
229 | struct posix_acl **pacl) | 240 | * |
241 | * @buf: xdr_buf containing XDR'd ACL data to decode | ||
242 | * @base: byte offset in xdr_buf where XDR'd ACL begins | ||
243 | * @aclcnt: count of ACEs in decoded posix_acl | ||
244 | * @pacl: buffer in which to place decoded posix_acl | ||
245 | * | ||
246 | * Returns the length of the decoded ACL in bytes, or a negative errno value. | ||
247 | */ | ||
248 | int nfsacl_decode(struct xdr_buf *buf, unsigned int base, unsigned int *aclcnt, | ||
249 | struct posix_acl **pacl) | ||
230 | { | 250 | { |
231 | struct nfsacl_decode_desc nfsacl_desc = { | 251 | struct nfsacl_decode_desc nfsacl_desc = { |
232 | .desc = { | 252 | .desc = { |
diff --git a/include/linux/nfsacl.h b/include/linux/nfsacl.h index f321b578edeb..fabcb1e5c460 100644 --- a/include/linux/nfsacl.h +++ b/include/linux/nfsacl.h | |||
@@ -51,10 +51,10 @@ nfsacl_size(struct posix_acl *acl_access, struct posix_acl *acl_default) | |||
51 | return w; | 51 | return w; |
52 | } | 52 | } |
53 | 53 | ||
54 | extern unsigned int | 54 | extern int |
55 | nfsacl_encode(struct xdr_buf *buf, unsigned int base, struct inode *inode, | 55 | nfsacl_encode(struct xdr_buf *buf, unsigned int base, struct inode *inode, |
56 | struct posix_acl *acl, int encode_entries, int typeflag); | 56 | struct posix_acl *acl, int encode_entries, int typeflag); |
57 | extern unsigned int | 57 | extern int |
58 | nfsacl_decode(struct xdr_buf *buf, unsigned int base, unsigned int *aclcnt, | 58 | nfsacl_decode(struct xdr_buf *buf, unsigned int base, unsigned int *aclcnt, |
59 | struct posix_acl **pacl); | 59 | struct posix_acl **pacl); |
60 | 60 | ||