aboutsummaryrefslogtreecommitdiffstats
path: root/fs/jffs2/summary.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/summary.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/summary.h')
-rw-r--r--fs/jffs2/summary.h42
1 files changed, 42 insertions, 0 deletions
diff --git a/fs/jffs2/summary.h b/fs/jffs2/summary.h
index b7a678be1709..a3b66c18aae9 100644
--- a/fs/jffs2/summary.h
+++ b/fs/jffs2/summary.h
@@ -45,6 +45,8 @@
45#define JFFS2_SUMMARY_NOSUM_SIZE 0xffffffff 45#define JFFS2_SUMMARY_NOSUM_SIZE 0xffffffff
46#define JFFS2_SUMMARY_INODE_SIZE (sizeof(struct jffs2_sum_inode_flash)) 46#define JFFS2_SUMMARY_INODE_SIZE (sizeof(struct jffs2_sum_inode_flash))
47#define JFFS2_SUMMARY_DIRENT_SIZE(x) (sizeof(struct jffs2_sum_dirent_flash) + (x)) 47#define JFFS2_SUMMARY_DIRENT_SIZE(x) (sizeof(struct jffs2_sum_dirent_flash) + (x))
48#define JFFS2_SUMMARY_XATTR_SIZE (sizeof(struct jffs2_sum_xattr_flash))
49#define JFFS2_SUMMARY_XREF_SIZE (sizeof(struct jffs2_sum_xref_flash))
48 50
49/* Summary structures used on flash */ 51/* Summary structures used on flash */
50 52
@@ -75,11 +77,28 @@ struct jffs2_sum_dirent_flash
75 uint8_t name[0]; /* dirent name */ 77 uint8_t name[0]; /* dirent name */
76} __attribute__((packed)); 78} __attribute__((packed));
77 79
80struct jffs2_sum_xattr_flash
81{
82 jint16_t nodetype; /* == JFFS2_NODETYPE_XATR */
83 jint32_t xid; /* xattr identifier */
84 jint32_t version; /* version number */
85 jint32_t offset; /* offset on jeb */
86 jint32_t totlen; /* node length */
87} __attribute__((packed));
88
89struct jffs2_sum_xref_flash
90{
91 jint16_t nodetype; /* == JFFS2_NODETYPE_XREF */
92 jint32_t offset; /* offset on jeb */
93} __attribute__((packed));
94
78union jffs2_sum_flash 95union jffs2_sum_flash
79{ 96{
80 struct jffs2_sum_unknown_flash u; 97 struct jffs2_sum_unknown_flash u;
81 struct jffs2_sum_inode_flash i; 98 struct jffs2_sum_inode_flash i;
82 struct jffs2_sum_dirent_flash d; 99 struct jffs2_sum_dirent_flash d;
100 struct jffs2_sum_xattr_flash x;
101 struct jffs2_sum_xref_flash r;
83}; 102};
84 103
85/* Summary structures used in the memory */ 104/* Summary structures used in the memory */
@@ -114,11 +133,30 @@ struct jffs2_sum_dirent_mem
114 uint8_t name[0]; /* dirent name */ 133 uint8_t name[0]; /* dirent name */
115} __attribute__((packed)); 134} __attribute__((packed));
116 135
136struct jffs2_sum_xattr_mem
137{
138 union jffs2_sum_mem *next;
139 jint16_t nodetype;
140 jint32_t xid;
141 jint32_t version;
142 jint32_t offset;
143 jint32_t totlen;
144} __attribute__((packed));
145
146struct jffs2_sum_xref_mem
147{
148 union jffs2_sum_mem *next;
149 jint16_t nodetype;
150 jint32_t offset;
151} __attribute__((packed));
152
117union jffs2_sum_mem 153union jffs2_sum_mem
118{ 154{
119 struct jffs2_sum_unknown_mem u; 155 struct jffs2_sum_unknown_mem u;
120 struct jffs2_sum_inode_mem i; 156 struct jffs2_sum_inode_mem i;
121 struct jffs2_sum_dirent_mem d; 157 struct jffs2_sum_dirent_mem d;
158 struct jffs2_sum_xattr_mem x;
159 struct jffs2_sum_xref_mem r;
122}; 160};
123 161
124/* Summary related information stored in superblock */ 162/* Summary related information stored in superblock */
@@ -159,6 +197,8 @@ int jffs2_sum_write_sumnode(struct jffs2_sb_info *c);
159int jffs2_sum_add_padding_mem(struct jffs2_summary *s, uint32_t size); 197int jffs2_sum_add_padding_mem(struct jffs2_summary *s, uint32_t size);
160int jffs2_sum_add_inode_mem(struct jffs2_summary *s, struct jffs2_raw_inode *ri, uint32_t ofs); 198int jffs2_sum_add_inode_mem(struct jffs2_summary *s, struct jffs2_raw_inode *ri, uint32_t ofs);
161int jffs2_sum_add_dirent_mem(struct jffs2_summary *s, struct jffs2_raw_dirent *rd, uint32_t ofs); 199int jffs2_sum_add_dirent_mem(struct jffs2_summary *s, struct jffs2_raw_dirent *rd, uint32_t ofs);
200int jffs2_sum_add_xattr_mem(struct jffs2_summary *s, struct jffs2_raw_xattr *rx, uint32_t ofs);
201int jffs2_sum_add_xref_mem(struct jffs2_summary *s, struct jffs2_raw_xref *rr, uint32_t ofs);
162int jffs2_sum_scan_sumnode(struct jffs2_sb_info *c, struct jffs2_eraseblock *jeb, 202int jffs2_sum_scan_sumnode(struct jffs2_sb_info *c, struct jffs2_eraseblock *jeb,
163 uint32_t ofs, uint32_t *pseudo_random); 203 uint32_t ofs, uint32_t *pseudo_random);
164 204
@@ -176,6 +216,8 @@ int jffs2_sum_scan_sumnode(struct jffs2_sb_info *c, struct jffs2_eraseblock *jeb
176#define jffs2_sum_add_padding_mem(a,b) 216#define jffs2_sum_add_padding_mem(a,b)
177#define jffs2_sum_add_inode_mem(a,b,c) 217#define jffs2_sum_add_inode_mem(a,b,c)
178#define jffs2_sum_add_dirent_mem(a,b,c) 218#define jffs2_sum_add_dirent_mem(a,b,c)
219#define jffs2_sum_add_xattr_mem(a,b,c)
220#define jffs2_sum_add_xref_mem(a,b,c)
179#define jffs2_sum_scan_sumnode(a,b,c,d) (0) 221#define jffs2_sum_scan_sumnode(a,b,c,d) (0)
180 222
181#endif /* CONFIG_JFFS2_SUMMARY */ 223#endif /* CONFIG_JFFS2_SUMMARY */