xattr.h 3.7 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115
  1. /*-------------------------------------------------------------------------*
  2. * File: fs/jffs2/xattr.c
  3. * XATTR support on JFFS2 FileSystem
  4. *
  5. * Implemented by KaiGai Kohei <kaigai@ak.jp.nec.com>
  6. * Copyright (C) 2006 NEC Corporation
  7. *
  8. * For licensing information, see the file 'LICENCE' in the jffs2 directory.
  9. *-------------------------------------------------------------------------*/
  10. #ifndef _JFFS2_FS_XATTR_H_
  11. #define _JFFS2_FS_XATTR_H_
  12. #include <linux/xattr.h>
  13. #define JFFS2_XFLAGS_HOT (0x01) /* This datum is HOT */
  14. #define JFFS2_XFLAGS_BIND (0x02) /* This datum is not reclaimed */
  15. struct jffs2_xattr_datum
  16. {
  17. void *always_null;
  18. u8 class;
  19. u8 flags;
  20. u16 xprefix; /* see JFFS2_XATTR_PREFIX_* */
  21. struct jffs2_raw_node_ref *node;
  22. struct list_head xindex; /* chained from c->xattrindex[n] */
  23. uint32_t refcnt; /* # of xattr_ref refers this */
  24. uint32_t xid;
  25. uint32_t version;
  26. uint32_t data_crc;
  27. uint32_t hashkey;
  28. char *xname; /* XATTR name without prefix */
  29. uint32_t name_len; /* length of xname */
  30. char *xvalue; /* XATTR value */
  31. uint32_t value_len; /* length of xvalue */
  32. };
  33. struct jffs2_inode_cache; /* forward refence */
  34. struct jffs2_xattr_ref
  35. {
  36. void *always_null;
  37. u8 class;
  38. u8 flags; /* Currently unused */
  39. u16 unused;
  40. struct jffs2_raw_node_ref *node;
  41. union {
  42. struct jffs2_inode_cache *ic; /* reference to jffs2_inode_cache */
  43. uint32_t ino; /* only used in scanning/building */
  44. };
  45. union {
  46. struct jffs2_xattr_datum *xd; /* reference to jffs2_xattr_datum */
  47. uint32_t xid; /* only used in sccanning/building */
  48. };
  49. struct jffs2_xattr_ref *next; /* chained from ic->xref_list */
  50. };
  51. #ifdef CONFIG_JFFS2_FS_XATTR
  52. extern void jffs2_init_xattr_subsystem(struct jffs2_sb_info *c);
  53. extern void jffs2_build_xattr_subsystem(struct jffs2_sb_info *c);
  54. extern void jffs2_clear_xattr_subsystem(struct jffs2_sb_info *c);
  55. extern struct jffs2_xattr_datum *jffs2_setup_xattr_datum(struct jffs2_sb_info *c,
  56. uint32_t xid, uint32_t version);
  57. extern void jffs2_xattr_delete_inode(struct jffs2_sb_info *c, struct jffs2_inode_cache *ic);
  58. extern void jffs2_xattr_free_inode(struct jffs2_sb_info *c, struct jffs2_inode_cache *ic);
  59. extern int jffs2_garbage_collect_xattr(struct jffs2_sb_info *c, struct jffs2_inode_cache *ic);
  60. extern int jffs2_verify_xattr(struct jffs2_sb_info *c);
  61. extern int do_jffs2_getxattr(struct inode *inode, int xprefix, const char *xname,
  62. char *buffer, size_t size);
  63. extern int do_jffs2_setxattr(struct inode *inode, int xprefix, const char *xname,
  64. const char *buffer, size_t size, int flags);
  65. extern struct xattr_handler *jffs2_xattr_handlers[];
  66. extern struct xattr_handler jffs2_user_xattr_handler;
  67. extern struct xattr_handler jffs2_trusted_xattr_handler;
  68. extern ssize_t jffs2_listxattr(struct dentry *, char *, size_t);
  69. #define jffs2_getxattr generic_getxattr
  70. #define jffs2_setxattr generic_setxattr
  71. #define jffs2_removexattr generic_removexattr
  72. #else
  73. #define jffs2_init_xattr_subsystem(c)
  74. #define jffs2_build_xattr_subsystem(c)
  75. #define jffs2_clear_xattr_subsystem(c)
  76. #define jffs2_xattr_delete_inode(c, ic)
  77. #define jffs2_xattr_free_inode(c, ic)
  78. #define jffs2_garbage_collect_xattr(c, ic) (1)
  79. #define jffs2_verify_xattr(c) (1)
  80. #define jffs2_xattr_handlers NULL
  81. #define jffs2_listxattr NULL
  82. #define jffs2_getxattr NULL
  83. #define jffs2_setxattr NULL
  84. #define jffs2_removexattr NULL
  85. #endif /* CONFIG_JFFS2_FS_XATTR */
  86. #ifdef CONFIG_JFFS2_FS_SECURITY
  87. extern int jffs2_init_security(struct inode *inode, struct inode *dir);
  88. extern struct xattr_handler jffs2_security_xattr_handler;
  89. #else
  90. #define jffs2_init_security(inode,dir) (0)
  91. #endif /* CONFIG_JFFS2_FS_SECURITY */
  92. #endif /* _JFFS2_FS_XATTR_H_ */