xattr.h 3.6 KB

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