nfsacl.h 1.1 KB

123456789101112131415161718192021222324252627282930313233343536373839404142
  1. /* SPDX-License-Identifier: GPL-2.0 */
  2. /*
  3. * File: linux/nfsacl.h
  4. *
  5. * (C) 2003 Andreas Gruenbacher <agruen@suse.de>
  6. */
  7. #ifndef __LINUX_NFSACL_H
  8. #define __LINUX_NFSACL_H
  9. #include <linux/posix_acl.h>
  10. #include <linux/sunrpc/xdr.h>
  11. #include <uapi/linux/nfsacl.h>
  12. /* Maximum number of ACL entries over NFS */
  13. #define NFS_ACL_MAX_ENTRIES 1024
  14. #define NFSACL_MAXWORDS (2*(2+3*NFS_ACL_MAX_ENTRIES))
  15. #define NFSACL_MAXPAGES ((2*(8+12*NFS_ACL_MAX_ENTRIES) + PAGE_SIZE-1) \
  16. >> PAGE_SHIFT)
  17. #define NFS_ACL_MAX_ENTRIES_INLINE (5)
  18. #define NFS_ACL_INLINE_BUFSIZE ((2*(2+3*NFS_ACL_MAX_ENTRIES_INLINE)) << 2)
  19. static inline unsigned int
  20. nfsacl_size(struct posix_acl *acl_access, struct posix_acl *acl_default)
  21. {
  22. unsigned int w = 16;
  23. w += max(acl_access ? (int)acl_access->a_count : 3, 4) * 12;
  24. if (acl_default)
  25. w += max((int)acl_default->a_count, 4) * 12;
  26. return w;
  27. }
  28. extern int
  29. nfsacl_encode(struct xdr_buf *buf, unsigned int base, struct inode *inode,
  30. struct posix_acl *acl, int encode_entries, int typeflag);
  31. extern int
  32. nfsacl_decode(struct xdr_buf *buf, unsigned int base, unsigned int *aclcnt,
  33. struct posix_acl **pacl);
  34. #endif /* __LINUX_NFSACL_H */