Commit 731f3f48 authored by Chuck Lever's avatar Chuck Lever Committed by Trond Myklebust

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: default avatarTrond Myklebust <trond.myklebust@netapp.com>
Signed-off-by: default avatarChuck Lever <chuck.lever@oracle.com>
Signed-off-by: default avatarTrond Myklebust <Trond.Myklebust@netapp.com>
parent ee5dc773
...@@ -72,8 +72,19 @@ xdr_nfsace_encode(struct xdr_array2_desc *desc, void *elem) ...@@ -72,8 +72,19 @@ xdr_nfsace_encode(struct xdr_array2_desc *desc, void *elem)
return 0; return 0;
} }
unsigned int /**
nfsacl_encode(struct xdr_buf *buf, unsigned int base, struct inode *inode, * nfsacl_encode - Encode an NFSv3 ACL
*
* @buf: destination xdr_buf to contain XDR encoded ACL
* @base: byte offset in xdr_buf where XDR'd ACL begins
* @inode: inode of file whose ACL this is
* @acl: posix_acl to encode
* @encode_entries: whether to encode ACEs as well
* @typeflag: ACL type: NFS_ACL_DEFAULT or zero
*
* Returns size of encoded ACL in bytes or a negative errno value.
*/
int nfsacl_encode(struct xdr_buf *buf, unsigned int base, struct inode *inode,
struct posix_acl *acl, int encode_entries, int typeflag) struct posix_acl *acl, int encode_entries, int typeflag)
{ {
int entries = (acl && acl->a_count) ? max_t(int, acl->a_count, 4) : 0; int entries = (acl && acl->a_count) ? max_t(int, acl->a_count, 4) : 0;
...@@ -224,8 +235,17 @@ posix_acl_from_nfsacl(struct posix_acl *acl) ...@@ -224,8 +235,17 @@ posix_acl_from_nfsacl(struct posix_acl *acl)
return 0; return 0;
} }
unsigned int /**
nfsacl_decode(struct xdr_buf *buf, unsigned int base, unsigned int *aclcnt, * nfsacl_decode - Decode an NFSv3 ACL
*
* @buf: xdr_buf containing XDR'd ACL data to decode
* @base: byte offset in xdr_buf where XDR'd ACL begins
* @aclcnt: count of ACEs in decoded posix_acl
* @pacl: buffer in which to place decoded posix_acl
*
* Returns the length of the decoded ACL in bytes, or a negative errno value.
*/
int nfsacl_decode(struct xdr_buf *buf, unsigned int base, unsigned int *aclcnt,
struct posix_acl **pacl) struct posix_acl **pacl)
{ {
struct nfsacl_decode_desc nfsacl_desc = { struct nfsacl_decode_desc nfsacl_desc = {
......
...@@ -51,10 +51,10 @@ nfsacl_size(struct posix_acl *acl_access, struct posix_acl *acl_default) ...@@ -51,10 +51,10 @@ nfsacl_size(struct posix_acl *acl_access, struct posix_acl *acl_default)
return w; return w;
} }
extern unsigned int extern int
nfsacl_encode(struct xdr_buf *buf, unsigned int base, struct inode *inode, nfsacl_encode(struct xdr_buf *buf, unsigned int base, struct inode *inode,
struct posix_acl *acl, int encode_entries, int typeflag); struct posix_acl *acl, int encode_entries, int typeflag);
extern unsigned int extern int
nfsacl_decode(struct xdr_buf *buf, unsigned int base, unsigned int *aclcnt, nfsacl_decode(struct xdr_buf *buf, unsigned int base, unsigned int *aclcnt,
struct posix_acl **pacl); struct posix_acl **pacl);
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment