aboutsummaryrefslogtreecommitdiffstats
path: root/fs/jffs2/xattr.h
diff options
context:
space:
mode:
authorKaiGai Kohei <kaigai@ak.jp.nec.com>2006-05-13 02:09:47 -0400
committerKaiGai Kohei <kaigai@ak.jp.nec.com>2006-05-13 02:09:47 -0400
commitaa98d7cf59b5b0764d3502662053489585faf2fe (patch)
treee98e83f3e69ebe3a1112394a19d440419e899749 /fs/jffs2/xattr.h
parent4992a9e88886b0c5ebc3d27eb74d0344c873eeea (diff)
[JFFS2][XATTR] XATTR support on JFFS2 (version. 5)
This attached patches provide xattr support including POSIX-ACL and SELinux support on JFFS2 (version.5). There are some significant differences from previous version posted at last December. The biggest change is addition of EBS(Erase Block Summary) support. Currently, both kernel and usermode utility (sumtool) can recognize xattr nodes which have JFFS2_NODETYPE_XATTR/_XREF nodetype. In addition, some bugs are fixed. - A potential race condition was fixed. - Unexpected fail when updating a xattr by same name/value pair was fixed. - A bug when removing xattr name/value pair was fixed. The fundamental structures (such as using two new nodetypes and exclusion mechanism by rwsem) are unchanged. But most of implementation were reviewed and updated if necessary. Espacially, we had to change several internal implementations related to load_xattr_datum() to avoid a potential race condition. [1/2] xattr_on_jffs2.kernel.version-5.patch [2/2] xattr_on_jffs2.utils.version-5.patch Signed-off-by: KaiGai Kohei <kaigai@ak.jp.nec.com> Signed-off-by: David Woodhouse <dwmw2@infradead.org>
Diffstat (limited to 'fs/jffs2/xattr.h')
-rw-r--r--fs/jffs2/xattr.h120
1 files changed, 120 insertions, 0 deletions
diff --git a/fs/jffs2/xattr.h b/fs/jffs2/xattr.h
new file mode 100644
index 000000000000..d157ad641ed4
--- /dev/null
+++ b/fs/jffs2/xattr.h
@@ -0,0 +1,120 @@
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
11#ifndef _JFFS2_FS_XATTR_H_
12#define _JFFS2_FS_XATTR_H_
13
14#include <linux/xattr.h>
15
16#define JFFS2_XFLAGS_HOT (0x01) /* This datum is HOT */
17#define JFFS2_XFLAGS_BIND (0x02) /* This datum is not reclaimed */
18
19struct jffs2_xattr_datum
20{
21 void *always_null;
22 u8 class;
23 u8 flags;
24 u16 xprefix; /* see JFFS2_XATTR_PREFIX_* */
25
26 struct jffs2_raw_node_ref *node;
27 struct list_head xindex; /* chained from c->xattrindex[n] */
28 uint32_t refcnt; /* # of xattr_ref refers this */
29 uint32_t xid;
30 uint32_t version;
31
32 uint32_t data_crc;
33 uint32_t hashkey;
34 char *xname; /* XATTR name without prefix */
35 uint32_t name_len; /* length of xname */
36 char *xvalue; /* XATTR value */
37 uint32_t value_len; /* length of xvalue */
38};
39
40struct jffs2_inode_cache; /* forward refence */
41struct jffs2_xattr_ref
42{
43 void *always_null;
44 u8 class;
45 u8 flags; /* Currently unused */
46 u16 unused;
47
48 struct jffs2_raw_node_ref *node;
49 union {
50 struct jffs2_inode_cache *ic; /* reference to jffs2_inode_cache */
51 uint32_t ino; /* only used in scanning/building */
52 };
53 union {
54 struct jffs2_xattr_datum *xd; /* reference to jffs2_xattr_datum */
55 uint32_t xid; /* only used in sccanning/building */
56 };
57 struct list_head ilist; /* chained from ic->ilist */
58};
59
60#ifdef CONFIG_JFFS2_FS_XATTR
61
62extern void jffs2_init_xattr_subsystem(struct jffs2_sb_info *c);
63extern void jffs2_build_xattr_subsystem(struct jffs2_sb_info *c);
64extern void jffs2_clear_xattr_subsystem(struct jffs2_sb_info *c);
65
66extern struct jffs2_xattr_datum *jffs2_setup_xattr_datum(struct jffs2_sb_info *c,
67 uint32_t xid, uint32_t version);
68
69extern void jffs2_xattr_delete_inode(struct jffs2_sb_info *c, struct jffs2_inode_cache *ic);
70extern void jffs2_xattr_free_inode(struct jffs2_sb_info *c, struct jffs2_inode_cache *ic);
71
72extern int jffs2_garbage_collect_xattr(struct jffs2_sb_info *c, struct jffs2_inode_cache *ic);
73extern int jffs2_verify_xattr(struct jffs2_sb_info *c);
74
75extern int do_jffs2_getxattr(struct inode *inode, int xprefix, const char *xname,
76 char *buffer, size_t size);
77extern int do_jffs2_setxattr(struct inode *inode, int xprefix, const char *xname,
78 const char *buffer, size_t size, int flags);
79
80extern struct xattr_handler *jffs2_xattr_handlers[];
81extern struct xattr_handler jffs2_user_xattr_handler;
82extern struct xattr_handler jffs2_trusted_xattr_handler;
83
84extern ssize_t jffs2_listxattr(struct dentry *, char *, size_t);
85#define jffs2_getxattr generic_getxattr
86#define jffs2_setxattr generic_setxattr
87#define jffs2_removexattr generic_removexattr
88
89/*---- Any inline initialize functions ----*/
90#define init_xattr_inode_cache(x) INIT_LIST_HEAD(&((x)->ilist))
91
92#else
93
94#define jffs2_init_xattr_subsystem(c)
95#define jffs2_build_xattr_subsystem(c)
96#define jffs2_clear_xattr_subsystem(c)
97
98#define jffs2_xattr_delete_inode(c, ic)
99#define jffs2_xattr_free_inode(c, ic)
100#define jffs2_garbage_collect_xattr(c, ic) (1)
101#define jffs2_verify_xattr(c) (1)
102
103#define jffs2_xattr_handlers NULL
104#define jffs2_listxattr NULL
105#define jffs2_getxattr NULL
106#define jffs2_setxattr NULL
107#define jffs2_removexattr NULL
108
109#define init_xattr_inode_cache(x)
110
111#endif /* CONFIG_JFFS2_FS_XATTR */
112
113#ifdef CONFIG_JFFS2_FS_SECURITY
114extern int jffs2_init_security(struct inode *inode, struct inode *dir);
115extern struct xattr_handler jffs2_security_xattr_handler;
116#else
117#define jffs2_init_security(inode,dir) (0)
118#endif /* CONFIG_JFFS2_FS_SECURITY */
119
120#endif /* _JFFS2_FS_XATTR_H_ */