reiserfs_acl.h 2.0 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677787980818283848586878889
  1. #include <linux/init.h>
  2. #include <linux/posix_acl.h>
  3. #include <linux/xattr_acl.h>
  4. #define REISERFS_ACL_VERSION 0x0001
  5. typedef struct {
  6. __le16 e_tag;
  7. __le16 e_perm;
  8. __le32 e_id;
  9. } reiserfs_acl_entry;
  10. typedef struct {
  11. __le16 e_tag;
  12. __le16 e_perm;
  13. } reiserfs_acl_entry_short;
  14. typedef struct {
  15. __le32 a_version;
  16. } reiserfs_acl_header;
  17. static inline size_t reiserfs_acl_size(int count)
  18. {
  19. if (count <= 4) {
  20. return sizeof(reiserfs_acl_header) +
  21. count * sizeof(reiserfs_acl_entry_short);
  22. } else {
  23. return sizeof(reiserfs_acl_header) +
  24. 4 * sizeof(reiserfs_acl_entry_short) +
  25. (count - 4) * sizeof(reiserfs_acl_entry);
  26. }
  27. }
  28. static inline int reiserfs_acl_count(size_t size)
  29. {
  30. ssize_t s;
  31. size -= sizeof(reiserfs_acl_header);
  32. s = size - 4 * sizeof(reiserfs_acl_entry_short);
  33. if (s < 0) {
  34. if (size % sizeof(reiserfs_acl_entry_short))
  35. return -1;
  36. return size / sizeof(reiserfs_acl_entry_short);
  37. } else {
  38. if (s % sizeof(reiserfs_acl_entry))
  39. return -1;
  40. return s / sizeof(reiserfs_acl_entry) + 4;
  41. }
  42. }
  43. #ifdef CONFIG_REISERFS_FS_POSIX_ACL
  44. struct posix_acl * reiserfs_get_acl(struct inode *inode, int type);
  45. int reiserfs_acl_chmod (struct inode *inode);
  46. int reiserfs_inherit_default_acl (struct inode *dir, struct dentry *dentry, struct inode *inode);
  47. int reiserfs_cache_default_acl (struct inode *dir);
  48. extern int reiserfs_xattr_posix_acl_init (void) __init;
  49. extern int reiserfs_xattr_posix_acl_exit (void);
  50. extern struct reiserfs_xattr_handler posix_acl_default_handler;
  51. extern struct reiserfs_xattr_handler posix_acl_access_handler;
  52. #else
  53. #define reiserfs_get_acl NULL
  54. #define reiserfs_cache_default_acl(inode) 0
  55. static inline int
  56. reiserfs_xattr_posix_acl_init (void)
  57. {
  58. return 0;
  59. }
  60. static inline int
  61. reiserfs_xattr_posix_acl_exit (void)
  62. {
  63. return 0;
  64. }
  65. static inline int
  66. reiserfs_acl_chmod (struct inode *inode)
  67. {
  68. return 0;
  69. }
  70. static inline int
  71. reiserfs_inherit_default_acl (const struct inode *dir, struct dentry *dentry, struct inode *inode)
  72. {
  73. return 0;
  74. }
  75. #endif