Back to home page

OSCL-LXR

 
 

    


0001 /* SPDX-License-Identifier: GPL-2.0 */
0002 /*
0003  * File: linux/nfsacl.h
0004  *
0005  * (C) 2003 Andreas Gruenbacher <agruen@suse.de>
0006  */
0007 #ifndef __LINUX_NFSACL_H
0008 #define __LINUX_NFSACL_H
0009 
0010 
0011 #include <linux/posix_acl.h>
0012 #include <linux/sunrpc/xdr.h>
0013 #include <uapi/linux/nfsacl.h>
0014 
0015 /* Maximum number of ACL entries over NFS */
0016 #define NFS_ACL_MAX_ENTRIES 1024
0017 
0018 #define NFSACL_MAXWORDS     (2*(2+3*NFS_ACL_MAX_ENTRIES))
0019 #define NFSACL_MAXPAGES     ((2*(8+12*NFS_ACL_MAX_ENTRIES) + PAGE_SIZE-1) \
0020                  >> PAGE_SHIFT)
0021 
0022 #define NFS_ACL_MAX_ENTRIES_INLINE  (5)
0023 #define NFS_ACL_INLINE_BUFSIZE  ((2*(2+3*NFS_ACL_MAX_ENTRIES_INLINE)) << 2)
0024 
0025 static inline unsigned int
0026 nfsacl_size(struct posix_acl *acl_access, struct posix_acl *acl_default)
0027 {
0028     unsigned int w = 16;
0029     w += max(acl_access ? (int)acl_access->a_count : 3, 4) * 12;
0030     if (acl_default)
0031         w += max((int)acl_default->a_count, 4) * 12;
0032     return w;
0033 }
0034 
0035 extern int
0036 nfsacl_encode(struct xdr_buf *buf, unsigned int base, struct inode *inode,
0037           struct posix_acl *acl, int encode_entries, int typeflag);
0038 extern int
0039 nfsacl_decode(struct xdr_buf *buf, unsigned int base, unsigned int *aclcnt,
0040           struct posix_acl **pacl);
0041 extern bool
0042 nfs_stream_decode_acl(struct xdr_stream *xdr, unsigned int *aclcnt,
0043               struct posix_acl **pacl);
0044 extern bool
0045 nfs_stream_encode_acl(struct xdr_stream *xdr, struct inode *inode,
0046               struct posix_acl *acl, int encode_entries, int typeflag);
0047 
0048 #endif  /* __LINUX_NFSACL_H */