epca.c: reformat comments and coding style improvements
[linux/fpc-iii.git] / fs / jffs2 / xattr.h
blob6e3b5ddfb7ab01c0f3c133198dda659675a4654d
1 /*
2 * JFFS2 -- Journalling Flash File System, Version 2.
4 * Copyright © 2006 NEC Corporation
6 * Created by KaiGai Kohei <kaigai@ak.jp.nec.com>
8 * For licensing information, see the file 'LICENCE' in this directory.
12 #ifndef _JFFS2_FS_XATTR_H_
13 #define _JFFS2_FS_XATTR_H_
15 #include <linux/xattr.h>
16 #include <linux/list.h>
18 #define JFFS2_XFLAGS_HOT (0x01) /* This datum is HOT */
19 #define JFFS2_XFLAGS_BIND (0x02) /* This datum is not reclaimed */
20 #define JFFS2_XFLAGS_DEAD (0x40) /* This datum is already dead */
21 #define JFFS2_XFLAGS_INVALID (0x80) /* This datum contains crc error */
23 struct jffs2_xattr_datum
25 void *always_null;
26 struct jffs2_raw_node_ref *node;
27 uint8_t class;
28 uint8_t flags;
29 uint16_t xprefix; /* see JFFS2_XATTR_PREFIX_* */
31 struct list_head xindex; /* chained from c->xattrindex[n] */
32 atomic_t refcnt; /* # of xattr_ref refers this */
33 uint32_t xid;
34 uint32_t version;
36 uint32_t data_crc;
37 uint32_t hashkey;
38 char *xname; /* XATTR name without prefix */
39 uint32_t name_len; /* length of xname */
40 char *xvalue; /* XATTR value */
41 uint32_t value_len; /* length of xvalue */
44 struct jffs2_inode_cache;
45 struct jffs2_xattr_ref
47 void *always_null;
48 struct jffs2_raw_node_ref *node;
49 uint8_t class;
50 uint8_t flags; /* Currently unused */
51 u16 unused;
53 uint32_t xseqno;
54 union {
55 struct jffs2_inode_cache *ic; /* reference to jffs2_inode_cache */
56 uint32_t ino; /* only used in scanning/building */
58 union {
59 struct jffs2_xattr_datum *xd; /* reference to jffs2_xattr_datum */
60 uint32_t xid; /* only used in sccanning/building */
62 struct jffs2_xattr_ref *next; /* chained from ic->xref_list */
65 #define XREF_DELETE_MARKER (0x00000001)
66 static inline int is_xattr_ref_dead(struct jffs2_xattr_ref *ref)
68 return ((ref->xseqno & XREF_DELETE_MARKER) != 0);
71 #ifdef CONFIG_JFFS2_FS_XATTR
73 extern void jffs2_init_xattr_subsystem(struct jffs2_sb_info *c);
74 extern void jffs2_build_xattr_subsystem(struct jffs2_sb_info *c);
75 extern void jffs2_clear_xattr_subsystem(struct jffs2_sb_info *c);
77 extern struct jffs2_xattr_datum *jffs2_setup_xattr_datum(struct jffs2_sb_info *c,
78 uint32_t xid, uint32_t version);
80 extern void jffs2_xattr_delete_inode(struct jffs2_sb_info *c, struct jffs2_inode_cache *ic);
81 extern void jffs2_xattr_free_inode(struct jffs2_sb_info *c, struct jffs2_inode_cache *ic);
83 extern int jffs2_garbage_collect_xattr_datum(struct jffs2_sb_info *c, struct jffs2_xattr_datum *xd,
84 struct jffs2_raw_node_ref *raw);
85 extern int jffs2_garbage_collect_xattr_ref(struct jffs2_sb_info *c, struct jffs2_xattr_ref *ref,
86 struct jffs2_raw_node_ref *raw);
87 extern int jffs2_verify_xattr(struct jffs2_sb_info *c);
88 extern void jffs2_release_xattr_datum(struct jffs2_sb_info *c, struct jffs2_xattr_datum *xd);
89 extern void jffs2_release_xattr_ref(struct jffs2_sb_info *c, struct jffs2_xattr_ref *ref);
91 extern int do_jffs2_getxattr(struct inode *inode, int xprefix, const char *xname,
92 char *buffer, size_t size);
93 extern int do_jffs2_setxattr(struct inode *inode, int xprefix, const char *xname,
94 const char *buffer, size_t size, int flags);
96 extern struct xattr_handler *jffs2_xattr_handlers[];
97 extern struct xattr_handler jffs2_user_xattr_handler;
98 extern struct xattr_handler jffs2_trusted_xattr_handler;
100 extern ssize_t jffs2_listxattr(struct dentry *, char *, size_t);
101 #define jffs2_getxattr generic_getxattr
102 #define jffs2_setxattr generic_setxattr
103 #define jffs2_removexattr generic_removexattr
105 #else
107 #define jffs2_init_xattr_subsystem(c)
108 #define jffs2_build_xattr_subsystem(c)
109 #define jffs2_clear_xattr_subsystem(c)
111 #define jffs2_xattr_delete_inode(c, ic)
112 #define jffs2_xattr_free_inode(c, ic)
113 #define jffs2_verify_xattr(c) (1)
115 #define jffs2_xattr_handlers NULL
116 #define jffs2_listxattr NULL
117 #define jffs2_getxattr NULL
118 #define jffs2_setxattr NULL
119 #define jffs2_removexattr NULL
121 #endif /* CONFIG_JFFS2_FS_XATTR */
123 #ifdef CONFIG_JFFS2_FS_SECURITY
124 extern int jffs2_init_security(struct inode *inode, struct inode *dir);
125 extern struct xattr_handler jffs2_security_xattr_handler;
126 #else
127 #define jffs2_init_security(inode,dir) (0)
128 #endif /* CONFIG_JFFS2_FS_SECURITY */
130 #endif /* _JFFS2_FS_XATTR_H_ */