posix_acl_xattr.h 1.5 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354
  1. /*
  2. File: linux/posix_acl_xattr.h
  3. Extended attribute system call representation of Access Control Lists.
  4. Copyright (C) 2000 by Andreas Gruenbacher <a.gruenbacher@computer.org>
  5. Copyright (C) 2002 SGI - Silicon Graphics, Inc <linux-xfs@oss.sgi.com>
  6. */
  7. #ifndef _POSIX_ACL_XATTR_H
  8. #define _POSIX_ACL_XATTR_H
  9. #include <uapi/linux/xattr.h>
  10. #include <uapi/linux/posix_acl_xattr.h>
  11. #include <linux/posix_acl.h>
  12. static inline size_t
  13. posix_acl_xattr_size(int count)
  14. {
  15. return (sizeof(struct posix_acl_xattr_header) +
  16. (count * sizeof(struct posix_acl_xattr_entry)));
  17. }
  18. static inline int
  19. posix_acl_xattr_count(size_t size)
  20. {
  21. if (size < sizeof(struct posix_acl_xattr_header))
  22. return -1;
  23. size -= sizeof(struct posix_acl_xattr_header);
  24. if (size % sizeof(struct posix_acl_xattr_entry))
  25. return -1;
  26. return size / sizeof(struct posix_acl_xattr_entry);
  27. }
  28. #ifdef CONFIG_FS_POSIX_ACL
  29. void posix_acl_fix_xattr_from_user(void *value, size_t size);
  30. void posix_acl_fix_xattr_to_user(void *value, size_t size);
  31. #else
  32. static inline void posix_acl_fix_xattr_from_user(void *value, size_t size)
  33. {
  34. }
  35. static inline void posix_acl_fix_xattr_to_user(void *value, size_t size)
  36. {
  37. }
  38. #endif
  39. struct posix_acl *posix_acl_from_xattr(struct user_namespace *user_ns,
  40. const void *value, size_t size);
  41. int posix_acl_to_xattr(struct user_namespace *user_ns,
  42. const struct posix_acl *acl, void *buffer, size_t size);
  43. extern const struct xattr_handler posix_acl_access_xattr_handler;
  44. extern const struct xattr_handler posix_acl_default_xattr_handler;
  45. #endif /* _POSIX_ACL_XATTR_H */