diff options
Diffstat (limited to 'fs/jffs2/summary.h')
-rw-r--r-- | fs/jffs2/summary.h | 64 |
1 files changed, 45 insertions, 19 deletions
diff --git a/fs/jffs2/summary.h b/fs/jffs2/summary.h index b7a678be1709..6bf1f6aa4552 100644 --- a/fs/jffs2/summary.h +++ b/fs/jffs2/summary.h | |||
@@ -18,23 +18,6 @@ | |||
18 | #include <linux/uio.h> | 18 | #include <linux/uio.h> |
19 | #include <linux/jffs2.h> | 19 | #include <linux/jffs2.h> |
20 | 20 | ||
21 | #define DIRTY_SPACE(x) do { typeof(x) _x = (x); \ | ||
22 | c->free_size -= _x; c->dirty_size += _x; \ | ||
23 | jeb->free_size -= _x ; jeb->dirty_size += _x; \ | ||
24 | }while(0) | ||
25 | #define USED_SPACE(x) do { typeof(x) _x = (x); \ | ||
26 | c->free_size -= _x; c->used_size += _x; \ | ||
27 | jeb->free_size -= _x ; jeb->used_size += _x; \ | ||
28 | }while(0) | ||
29 | #define WASTED_SPACE(x) do { typeof(x) _x = (x); \ | ||
30 | c->free_size -= _x; c->wasted_size += _x; \ | ||
31 | jeb->free_size -= _x ; jeb->wasted_size += _x; \ | ||
32 | }while(0) | ||
33 | #define UNCHECKED_SPACE(x) do { typeof(x) _x = (x); \ | ||
34 | c->free_size -= _x; c->unchecked_size += _x; \ | ||
35 | jeb->free_size -= _x ; jeb->unchecked_size += _x; \ | ||
36 | }while(0) | ||
37 | |||
38 | #define BLK_STATE_ALLFF 0 | 21 | #define BLK_STATE_ALLFF 0 |
39 | #define BLK_STATE_CLEAN 1 | 22 | #define BLK_STATE_CLEAN 1 |
40 | #define BLK_STATE_PARTDIRTY 2 | 23 | #define BLK_STATE_PARTDIRTY 2 |
@@ -45,6 +28,8 @@ | |||
45 | #define JFFS2_SUMMARY_NOSUM_SIZE 0xffffffff | 28 | #define JFFS2_SUMMARY_NOSUM_SIZE 0xffffffff |
46 | #define JFFS2_SUMMARY_INODE_SIZE (sizeof(struct jffs2_sum_inode_flash)) | 29 | #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)) | 30 | #define JFFS2_SUMMARY_DIRENT_SIZE(x) (sizeof(struct jffs2_sum_dirent_flash) + (x)) |
31 | #define JFFS2_SUMMARY_XATTR_SIZE (sizeof(struct jffs2_sum_xattr_flash)) | ||
32 | #define JFFS2_SUMMARY_XREF_SIZE (sizeof(struct jffs2_sum_xref_flash)) | ||
48 | 33 | ||
49 | /* Summary structures used on flash */ | 34 | /* Summary structures used on flash */ |
50 | 35 | ||
@@ -75,11 +60,28 @@ struct jffs2_sum_dirent_flash | |||
75 | uint8_t name[0]; /* dirent name */ | 60 | uint8_t name[0]; /* dirent name */ |
76 | } __attribute__((packed)); | 61 | } __attribute__((packed)); |
77 | 62 | ||
63 | struct jffs2_sum_xattr_flash | ||
64 | { | ||
65 | jint16_t nodetype; /* == JFFS2_NODETYPE_XATR */ | ||
66 | jint32_t xid; /* xattr identifier */ | ||
67 | jint32_t version; /* version number */ | ||
68 | jint32_t offset; /* offset on jeb */ | ||
69 | jint32_t totlen; /* node length */ | ||
70 | } __attribute__((packed)); | ||
71 | |||
72 | struct jffs2_sum_xref_flash | ||
73 | { | ||
74 | jint16_t nodetype; /* == JFFS2_NODETYPE_XREF */ | ||
75 | jint32_t offset; /* offset on jeb */ | ||
76 | } __attribute__((packed)); | ||
77 | |||
78 | union jffs2_sum_flash | 78 | union jffs2_sum_flash |
79 | { | 79 | { |
80 | struct jffs2_sum_unknown_flash u; | 80 | struct jffs2_sum_unknown_flash u; |
81 | struct jffs2_sum_inode_flash i; | 81 | struct jffs2_sum_inode_flash i; |
82 | struct jffs2_sum_dirent_flash d; | 82 | struct jffs2_sum_dirent_flash d; |
83 | struct jffs2_sum_xattr_flash x; | ||
84 | struct jffs2_sum_xref_flash r; | ||
83 | }; | 85 | }; |
84 | 86 | ||
85 | /* Summary structures used in the memory */ | 87 | /* Summary structures used in the memory */ |
@@ -114,11 +116,30 @@ struct jffs2_sum_dirent_mem | |||
114 | uint8_t name[0]; /* dirent name */ | 116 | uint8_t name[0]; /* dirent name */ |
115 | } __attribute__((packed)); | 117 | } __attribute__((packed)); |
116 | 118 | ||
119 | struct jffs2_sum_xattr_mem | ||
120 | { | ||
121 | union jffs2_sum_mem *next; | ||
122 | jint16_t nodetype; | ||
123 | jint32_t xid; | ||
124 | jint32_t version; | ||
125 | jint32_t offset; | ||
126 | jint32_t totlen; | ||
127 | } __attribute__((packed)); | ||
128 | |||
129 | struct jffs2_sum_xref_mem | ||
130 | { | ||
131 | union jffs2_sum_mem *next; | ||
132 | jint16_t nodetype; | ||
133 | jint32_t offset; | ||
134 | } __attribute__((packed)); | ||
135 | |||
117 | union jffs2_sum_mem | 136 | union jffs2_sum_mem |
118 | { | 137 | { |
119 | struct jffs2_sum_unknown_mem u; | 138 | struct jffs2_sum_unknown_mem u; |
120 | struct jffs2_sum_inode_mem i; | 139 | struct jffs2_sum_inode_mem i; |
121 | struct jffs2_sum_dirent_mem d; | 140 | struct jffs2_sum_dirent_mem d; |
141 | struct jffs2_sum_xattr_mem x; | ||
142 | struct jffs2_sum_xref_mem r; | ||
122 | }; | 143 | }; |
123 | 144 | ||
124 | /* Summary related information stored in superblock */ | 145 | /* Summary related information stored in superblock */ |
@@ -159,8 +180,11 @@ int jffs2_sum_write_sumnode(struct jffs2_sb_info *c); | |||
159 | int jffs2_sum_add_padding_mem(struct jffs2_summary *s, uint32_t size); | 180 | int jffs2_sum_add_padding_mem(struct jffs2_summary *s, uint32_t size); |
160 | int jffs2_sum_add_inode_mem(struct jffs2_summary *s, struct jffs2_raw_inode *ri, uint32_t ofs); | 181 | int jffs2_sum_add_inode_mem(struct jffs2_summary *s, struct jffs2_raw_inode *ri, uint32_t ofs); |
161 | int jffs2_sum_add_dirent_mem(struct jffs2_summary *s, struct jffs2_raw_dirent *rd, uint32_t ofs); | 182 | int jffs2_sum_add_dirent_mem(struct jffs2_summary *s, struct jffs2_raw_dirent *rd, uint32_t ofs); |
183 | int jffs2_sum_add_xattr_mem(struct jffs2_summary *s, struct jffs2_raw_xattr *rx, uint32_t ofs); | ||
184 | int jffs2_sum_add_xref_mem(struct jffs2_summary *s, struct jffs2_raw_xref *rr, uint32_t ofs); | ||
162 | int jffs2_sum_scan_sumnode(struct jffs2_sb_info *c, struct jffs2_eraseblock *jeb, | 185 | int jffs2_sum_scan_sumnode(struct jffs2_sb_info *c, struct jffs2_eraseblock *jeb, |
163 | uint32_t ofs, uint32_t *pseudo_random); | 186 | struct jffs2_raw_summary *summary, uint32_t sumlen, |
187 | uint32_t *pseudo_random); | ||
164 | 188 | ||
165 | #else /* SUMMARY DISABLED */ | 189 | #else /* SUMMARY DISABLED */ |
166 | 190 | ||
@@ -176,7 +200,9 @@ int jffs2_sum_scan_sumnode(struct jffs2_sb_info *c, struct jffs2_eraseblock *jeb | |||
176 | #define jffs2_sum_add_padding_mem(a,b) | 200 | #define jffs2_sum_add_padding_mem(a,b) |
177 | #define jffs2_sum_add_inode_mem(a,b,c) | 201 | #define jffs2_sum_add_inode_mem(a,b,c) |
178 | #define jffs2_sum_add_dirent_mem(a,b,c) | 202 | #define jffs2_sum_add_dirent_mem(a,b,c) |
179 | #define jffs2_sum_scan_sumnode(a,b,c,d) (0) | 203 | #define jffs2_sum_add_xattr_mem(a,b,c) |
204 | #define jffs2_sum_add_xref_mem(a,b,c) | ||
205 | #define jffs2_sum_scan_sumnode(a,b,c,d,e) (0) | ||
180 | 206 | ||
181 | #endif /* CONFIG_JFFS2_SUMMARY */ | 207 | #endif /* CONFIG_JFFS2_SUMMARY */ |
182 | 208 | ||