reiserfs_xattr.h 3.9 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134
  1. /*
  2. File: linux/reiserfs_xattr.h
  3. */
  4. #include <linux/xattr.h>
  5. /* Magic value in header */
  6. #define REISERFS_XATTR_MAGIC 0x52465841 /* "RFXA" */
  7. struct reiserfs_xattr_header {
  8. __le32 h_magic; /* magic number for identification */
  9. __le32 h_hash; /* hash of the value */
  10. };
  11. #ifdef __KERNEL__
  12. #include <linux/init.h>
  13. struct reiserfs_xattr_handler {
  14. char *prefix;
  15. int (*init) (void);
  16. void (*exit) (void);
  17. int (*get) (struct inode * inode, const char *name, void *buffer,
  18. size_t size);
  19. int (*set) (struct inode * inode, const char *name, const void *buffer,
  20. size_t size, int flags);
  21. int (*del) (struct inode * inode, const char *name);
  22. int (*list) (struct inode * inode, const char *name, int namelen,
  23. char *out);
  24. struct list_head handlers;
  25. };
  26. #ifdef CONFIG_REISERFS_FS_XATTR
  27. #define is_reiserfs_priv_object(inode) IS_PRIVATE(inode)
  28. #define has_xattr_dir(inode) (REISERFS_I(inode)->i_flags & i_has_xattr_dir)
  29. ssize_t reiserfs_getxattr(struct dentry *dentry, const char *name,
  30. void *buffer, size_t size);
  31. int reiserfs_setxattr(struct dentry *dentry, const char *name,
  32. const void *value, size_t size, int flags);
  33. ssize_t reiserfs_listxattr(struct dentry *dentry, char *buffer, size_t size);
  34. int reiserfs_removexattr(struct dentry *dentry, const char *name);
  35. int reiserfs_delete_xattrs(struct inode *inode);
  36. int reiserfs_chown_xattrs(struct inode *inode, struct iattr *attrs);
  37. int reiserfs_xattr_init(struct super_block *sb, int mount_flags);
  38. int reiserfs_permission(struct inode *inode, int mask, struct nameidata *nd);
  39. int reiserfs_xattr_del(struct inode *, const char *);
  40. int reiserfs_xattr_get(const struct inode *, const char *, void *, size_t);
  41. int reiserfs_xattr_set(struct inode *, const char *, const void *, size_t, int);
  42. extern struct reiserfs_xattr_handler user_handler;
  43. extern struct reiserfs_xattr_handler trusted_handler;
  44. #ifdef CONFIG_REISERFS_FS_SECURITY
  45. extern struct reiserfs_xattr_handler security_handler;
  46. #endif
  47. int reiserfs_xattr_register_handlers(void) __init;
  48. void reiserfs_xattr_unregister_handlers(void);
  49. static inline void reiserfs_write_lock_xattrs(struct super_block *sb)
  50. {
  51. down_write(&REISERFS_XATTR_DIR_SEM(sb));
  52. }
  53. static inline void reiserfs_write_unlock_xattrs(struct super_block *sb)
  54. {
  55. up_write(&REISERFS_XATTR_DIR_SEM(sb));
  56. }
  57. static inline void reiserfs_read_lock_xattrs(struct super_block *sb)
  58. {
  59. down_read(&REISERFS_XATTR_DIR_SEM(sb));
  60. }
  61. static inline void reiserfs_read_unlock_xattrs(struct super_block *sb)
  62. {
  63. up_read(&REISERFS_XATTR_DIR_SEM(sb));
  64. }
  65. static inline void reiserfs_write_lock_xattr_i(struct inode *inode)
  66. {
  67. down_write(&REISERFS_I(inode)->xattr_sem);
  68. }
  69. static inline void reiserfs_write_unlock_xattr_i(struct inode *inode)
  70. {
  71. up_write(&REISERFS_I(inode)->xattr_sem);
  72. }
  73. static inline void reiserfs_read_lock_xattr_i(struct inode *inode)
  74. {
  75. down_read(&REISERFS_I(inode)->xattr_sem);
  76. }
  77. static inline void reiserfs_read_unlock_xattr_i(struct inode *inode)
  78. {
  79. up_read(&REISERFS_I(inode)->xattr_sem);
  80. }
  81. static inline void reiserfs_mark_inode_private(struct inode *inode)
  82. {
  83. inode->i_flags |= S_PRIVATE;
  84. }
  85. #else
  86. #define is_reiserfs_priv_object(inode) 0
  87. #define reiserfs_mark_inode_private(inode) do {;} while(0)
  88. #define reiserfs_getxattr NULL
  89. #define reiserfs_setxattr NULL
  90. #define reiserfs_listxattr NULL
  91. #define reiserfs_removexattr NULL
  92. #define reiserfs_write_lock_xattrs(sb) do {;} while(0)
  93. #define reiserfs_write_unlock_xattrs(sb) do {;} while(0)
  94. #define reiserfs_read_lock_xattrs(sb)
  95. #define reiserfs_read_unlock_xattrs(sb)
  96. #define reiserfs_permission NULL
  97. #define reiserfs_xattr_register_handlers() 0
  98. #define reiserfs_xattr_unregister_handlers()
  99. static inline int reiserfs_delete_xattrs(struct inode *inode)
  100. {
  101. return 0;
  102. };
  103. static inline int reiserfs_chown_xattrs(struct inode *inode,
  104. struct iattr *attrs)
  105. {
  106. return 0;
  107. };
  108. static inline int reiserfs_xattr_init(struct super_block *sb, int mount_flags)
  109. {
  110. sb->s_flags = (sb->s_flags & ~MS_POSIXACL); /* to be sure */
  111. return 0;
  112. };
  113. #endif
  114. #endif /* __KERNEL__ */