MOXA linux-2.6.x / linux-2.6.19-uc1 from UC-7110-LX-BOOTLOADER-1.9_VERSION-4.2.tgz
[linux-2.6.19-moxart.git] / fs / jffs2 / xattr.h
blobafe1c1e2acc2849349fd84dc341884101a54dacb
1 /*
2 * JFFS2 -- Journalling Flash File System, Version 2.
4 * Copyright (C) 2006 NEC Corporation
6 * Created by KaiGai Kohei <kaigai@ak.jp.nec.com>
8 * For licensing information, see the file 'LICENCE' in this directory.
11 #ifndef _JFFS2_FS_XATTR_H_
12 #define _JFFS2_FS_XATTR_H_
14 #include <linux/xattr.h>
15 #include <linux/list.h>
17 #define JFFS2_XFLAGS_HOT (0x01) /* This datum is HOT */
18 #define JFFS2_XFLAGS_BIND (0x02) /* This datum is not reclaimed */
19 #define JFFS2_XFLAGS_DEAD (0x40) /* This datum is already dead */
20 #define JFFS2_XFLAGS_INVALID (0x80) /* This datum contains crc error */
22 struct jffs2_xattr_datum
24 void *always_null;
25 struct jffs2_raw_node_ref *node;
26 uint8_t class;
27 uint8_t flags;
28 uint16_t xprefix; /* see JFFS2_XATTR_PREFIX_* */
30 struct list_head xindex; /* chained from c->xattrindex[n] */
31 atomic_t refcnt; /* # of xattr_ref refers this */
32 uint32_t xid;
33 uint32_t version;
35 uint32_t data_crc;
36 uint32_t hashkey;
37 char *xname; /* XATTR name without prefix */
38 uint32_t name_len; /* length of xname */
39 char *xvalue; /* XATTR value */
40 uint32_t value_len; /* length of xvalue */
43 struct jffs2_inode_cache;
44 struct jffs2_xattr_ref
46 void *always_null;
47 struct jffs2_raw_node_ref *node;
48 uint8_t class;
49 uint8_t flags; /* Currently unused */
50 u16 unused;
52 uint32_t xseqno;
53 union {
54 struct jffs2_inode_cache *ic; /* reference to jffs2_inode_cache */
55 uint32_t ino; /* only used in scanning/building */
56 #if 0 // mask by Victor Yu. 02-12-2007
58 #else
59 } uino;
60 #endif
61 union {
62 struct jffs2_xattr_datum *xd; /* reference to jffs2_xattr_datum */
63 uint32_t xid; /* only used in sccanning/building */
64 #if 0 // mask by Victor Yu. 02-12-2007
66 #else
67 } uxid;
68 #endif
69 struct jffs2_xattr_ref *next; /* chained from ic->xref_list */
72 #define XREF_DELETE_MARKER (0x00000001)
73 static inline int is_xattr_ref_dead(struct jffs2_xattr_ref *ref)
75 return ((ref->xseqno & XREF_DELETE_MARKER) != 0);
78 #ifdef CONFIG_JFFS2_FS_XATTR
80 extern void jffs2_init_xattr_subsystem(struct jffs2_sb_info *c);
81 extern void jffs2_build_xattr_subsystem(struct jffs2_sb_info *c);
82 extern void jffs2_clear_xattr_subsystem(struct jffs2_sb_info *c);
84 extern struct jffs2_xattr_datum *jffs2_setup_xattr_datum(struct jffs2_sb_info *c,
85 uint32_t xid, uint32_t version);
87 extern void jffs2_xattr_delete_inode(struct jffs2_sb_info *c, struct jffs2_inode_cache *ic);
88 extern void jffs2_xattr_free_inode(struct jffs2_sb_info *c, struct jffs2_inode_cache *ic);
90 extern int jffs2_garbage_collect_xattr_datum(struct jffs2_sb_info *c, struct jffs2_xattr_datum *xd,
91 struct jffs2_raw_node_ref *raw);
92 extern int jffs2_garbage_collect_xattr_ref(struct jffs2_sb_info *c, struct jffs2_xattr_ref *ref,
93 struct jffs2_raw_node_ref *raw);
94 extern int jffs2_verify_xattr(struct jffs2_sb_info *c);
95 extern void jffs2_release_xattr_datum(struct jffs2_sb_info *c, struct jffs2_xattr_datum *xd);
96 extern void jffs2_release_xattr_ref(struct jffs2_sb_info *c, struct jffs2_xattr_ref *ref);
98 extern int do_jffs2_getxattr(struct inode *inode, int xprefix, const char *xname,
99 char *buffer, size_t size);
100 extern int do_jffs2_setxattr(struct inode *inode, int xprefix, const char *xname,
101 const char *buffer, size_t size, int flags);
103 extern struct xattr_handler *jffs2_xattr_handlers[];
104 extern struct xattr_handler jffs2_user_xattr_handler;
105 extern struct xattr_handler jffs2_trusted_xattr_handler;
107 extern ssize_t jffs2_listxattr(struct dentry *, char *, size_t);
108 #define jffs2_getxattr generic_getxattr
109 #define jffs2_setxattr generic_setxattr
110 #define jffs2_removexattr generic_removexattr
112 #else
114 #define jffs2_init_xattr_subsystem(c)
115 #define jffs2_build_xattr_subsystem(c)
116 #define jffs2_clear_xattr_subsystem(c)
118 #define jffs2_xattr_delete_inode(c, ic)
119 #define jffs2_xattr_free_inode(c, ic)
120 #define jffs2_verify_xattr(c) (1)
122 #define jffs2_xattr_handlers NULL
123 #define jffs2_listxattr NULL
124 #define jffs2_getxattr NULL
125 #define jffs2_setxattr NULL
126 #define jffs2_removexattr NULL
128 #endif /* CONFIG_JFFS2_FS_XATTR */
130 #ifdef CONFIG_JFFS2_FS_SECURITY
131 extern int jffs2_init_security(struct inode *inode, struct inode *dir);
132 extern struct xattr_handler jffs2_security_xattr_handler;
133 #else
134 #define jffs2_init_security(inode,dir) (0)
135 #endif /* CONFIG_JFFS2_FS_SECURITY */
137 #endif /* _JFFS2_FS_XATTR_H_ */