reiserfs_xattr.h 3.9 KB

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