reiserfs_xattr.h 2.6 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576777879808182838485868788899091
  1. /*
  2. File: linux/reiserfs_xattr.h
  3. */
  4. #ifndef _LINUX_REISERFS_XATTR_H
  5. #define _LINUX_REISERFS_XATTR_H
  6. #include <linux/types.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. #include <linux/init.h>
  15. #include <linux/list.h>
  16. #include <linux/rwsem.h>
  17. #include <linux/reiserfs_fs_i.h>
  18. #include <linux/reiserfs_fs.h>
  19. struct inode;
  20. struct dentry;
  21. struct iattr;
  22. struct super_block;
  23. struct nameidata;
  24. struct reiserfs_xattr_handler {
  25. char *prefix;
  26. int (*init) (void);
  27. void (*exit) (void);
  28. int (*get) (struct inode * inode, const char *name, void *buffer,
  29. size_t size);
  30. int (*set) (struct inode * inode, const char *name, const void *buffer,
  31. size_t size, int flags);
  32. int (*del) (struct inode * inode, const char *name);
  33. int (*list) (struct inode * inode, const char *name, int namelen,
  34. char *out);
  35. struct list_head handlers;
  36. };
  37. int reiserfs_xattr_register_handlers(void) __init;
  38. void reiserfs_xattr_unregister_handlers(void);
  39. int reiserfs_xattr_init(struct super_block *sb, int mount_flags);
  40. int reiserfs_delete_xattrs(struct inode *inode);
  41. int reiserfs_chown_xattrs(struct inode *inode, struct iattr *attrs);
  42. #ifdef CONFIG_REISERFS_FS_XATTR
  43. #define has_xattr_dir(inode) (REISERFS_I(inode)->i_flags & i_has_xattr_dir)
  44. ssize_t reiserfs_getxattr(struct dentry *dentry, const char *name,
  45. void *buffer, size_t size);
  46. int reiserfs_setxattr(struct dentry *dentry, const char *name,
  47. const void *value, size_t size, int flags);
  48. ssize_t reiserfs_listxattr(struct dentry *dentry, char *buffer, size_t size);
  49. int reiserfs_removexattr(struct dentry *dentry, const char *name);
  50. int reiserfs_permission(struct inode *inode, int mask);
  51. int reiserfs_xattr_del(struct inode *, const char *);
  52. int reiserfs_xattr_get(const struct inode *, const char *, void *, size_t);
  53. int reiserfs_xattr_set(struct inode *, const char *, const void *, size_t, int);
  54. extern struct reiserfs_xattr_handler user_handler;
  55. extern struct reiserfs_xattr_handler trusted_handler;
  56. extern struct reiserfs_xattr_handler security_handler;
  57. static inline void reiserfs_init_xattr_rwsem(struct inode *inode)
  58. {
  59. init_rwsem(&REISERFS_I(inode)->i_xattr_sem);
  60. }
  61. #else
  62. #define reiserfs_getxattr NULL
  63. #define reiserfs_setxattr NULL
  64. #define reiserfs_listxattr NULL
  65. #define reiserfs_removexattr NULL
  66. #define reiserfs_permission NULL
  67. static inline void reiserfs_init_xattr_rwsem(struct inode *inode)
  68. {
  69. }
  70. #endif /* CONFIG_REISERFS_FS_XATTR */
  71. #endif /* __KERNEL__ */
  72. #endif /* _LINUX_REISERFS_XATTR_H */