aboutsummaryrefslogtreecommitdiffstats
path: root/fs/nfs_common/nfsacl.c
diff options
context:
space:
mode:
authorChuck Lever <chuck.lever@oracle.com>2011-01-20 22:05:28 -0500
committerTrond Myklebust <Trond.Myklebust@netapp.com>2011-01-25 15:24:47 -0500
commit731f3f482ad3b2c58a1af2d0a9a634a82803706a (patch)
tree1425c239481309ffc68dd33a991fc13fc309226c /fs/nfs_common/nfsacl.c
parentee5dc7732bd557bae6d10873a0aac606d2c551fb (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>
Diffstat (limited to 'fs/nfs_common/nfsacl.c')
-rw-r--r--fs/nfs_common/nfsacl.c32
1 files changed, 26 insertions, 6 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
75unsigned int 75/**
76nfsacl_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 */
87int 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
227unsigned int 238/**
228nfsacl_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 */
248int 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 = {