xattr_acl.h 1.1 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950
  1. /*
  2. File: linux/xattr_acl.h
  3. (extended attribute representation of access control lists)
  4. (C) 2000 Andreas Gruenbacher, <a.gruenbacher@computer.org>
  5. */
  6. #ifndef _LINUX_XATTR_ACL_H
  7. #define _LINUX_XATTR_ACL_H
  8. #include <linux/posix_acl.h>
  9. #define XATTR_NAME_ACL_ACCESS "system.posix_acl_access"
  10. #define XATTR_NAME_ACL_DEFAULT "system.posix_acl_default"
  11. #define XATTR_ACL_VERSION 0x0002
  12. typedef struct {
  13. __u16 e_tag;
  14. __u16 e_perm;
  15. __u32 e_id;
  16. } xattr_acl_entry;
  17. typedef struct {
  18. __u32 a_version;
  19. xattr_acl_entry a_entries[0];
  20. } xattr_acl_header;
  21. static inline size_t xattr_acl_size(int count)
  22. {
  23. return sizeof(xattr_acl_header) + count * sizeof(xattr_acl_entry);
  24. }
  25. static inline int xattr_acl_count(size_t size)
  26. {
  27. if (size < sizeof(xattr_acl_header))
  28. return -1;
  29. size -= sizeof(xattr_acl_header);
  30. if (size % sizeof(xattr_acl_entry))
  31. return -1;
  32. return size / sizeof(xattr_acl_entry);
  33. }
  34. struct posix_acl * posix_acl_from_xattr(const void *value, size_t size);
  35. int posix_acl_to_xattr(const struct posix_acl *acl, void *buffer, size_t size);
  36. #endif /* _LINUX_XATTR_ACL_H */