2 * JFFS2 -- Journalling Flash File System, Version 2.
4 * Copyright © 2004 Ferenc Havasi <havasi@inf.u-szeged.hu>,
5 * Zoltan Sogor <weth@inf.u-szeged.hu>,
6 * Patrik Kluba <pajko@halom.u-szeged.hu>,
7 * University of Szeged, Hungary
9 * For licensing information, see the file 'LICENCE' in this directory.
13 #ifndef JFFS2_SUMMARY_H
14 #define JFFS2_SUMMARY_H
16 #define BLK_STATE_ALLFF 0
17 #define BLK_STATE_CLEAN 1
18 #define BLK_STATE_PARTDIRTY 2
19 #define BLK_STATE_CLEANMARKER 3
20 #define BLK_STATE_ALLDIRTY 4
21 #define BLK_STATE_BADBLOCK 5
23 #define JFFS2_SUMMARY_NOSUM_SIZE 0xffffffff
24 #define JFFS2_SUMMARY_INODE_SIZE (sizeof(struct jffs2_sum_inode_flash))
25 #define JFFS2_SUMMARY_DIRENT_SIZE(x) (sizeof(struct jffs2_sum_dirent_flash) + (x))
26 #define JFFS2_SUMMARY_XATTR_SIZE (sizeof(struct jffs2_sum_xattr_flash))
27 #define JFFS2_SUMMARY_XREF_SIZE (sizeof(struct jffs2_sum_xref_flash))
29 /* Summary structures used on flash */
31 struct jffs2_sum_unknown_flash
33 __u16 nodetype; /* node type */
36 struct jffs2_sum_inode_flash
38 __u16 nodetype; /* node type */
39 __u32 inode; /* inode number */
40 __u32 version; /* inode version */
41 __u32 offset; /* offset on jeb */
42 __u32 totlen; /* record length */
43 } __attribute__((packed));
45 struct jffs2_sum_dirent_flash
47 __u16 nodetype; /* == JFFS_NODETYPE_DIRENT */
48 __u32 totlen; /* record length */
49 __u32 offset; /* offset on jeb */
50 __u32 pino; /* parent inode */
51 __u32 version; /* dirent version */
52 __u32 ino; /* == zero for unlink */
53 uint8_t nsize; /* dirent name size */
54 uint8_t type; /* dirent type */
55 uint8_t name[0]; /* dirent name */
56 } __attribute__((packed));
58 struct jffs2_sum_xattr_flash
60 __u16 nodetype; /* == JFFS2_NODETYPE_XATR */
61 __u32 xid; /* xattr identifier */
62 __u32 version; /* version number */
63 __u32 offset; /* offset on jeb */
64 __u32 totlen; /* node length */
65 } __attribute__((packed));
67 struct jffs2_sum_xref_flash
69 __u16 nodetype; /* == JFFS2_NODETYPE_XREF */
70 __u32 offset; /* offset on jeb */
71 } __attribute__((packed));
75 struct jffs2_sum_unknown_flash u;
76 struct jffs2_sum_inode_flash i;
77 struct jffs2_sum_dirent_flash d;
78 struct jffs2_sum_xattr_flash x;
79 struct jffs2_sum_xref_flash r;
82 /* Summary structures used in the memory */
84 struct jffs2_sum_unknown_mem
86 union jffs2_sum_mem *next;
87 __u16 nodetype; /* node type */
90 struct jffs2_sum_inode_mem
92 union jffs2_sum_mem *next;
93 __u16 nodetype; /* node type */
94 __u32 inode; /* inode number */
95 __u32 version; /* inode version */
96 __u32 offset; /* offset on jeb */
97 __u32 totlen; /* record length */
98 } __attribute__((packed));
100 struct jffs2_sum_dirent_mem
102 union jffs2_sum_mem *next;
103 __u16 nodetype; /* == JFFS_NODETYPE_DIRENT */
104 __u32 totlen; /* record length */
105 __u32 offset; /* ofset on jeb */
106 __u32 pino; /* parent inode */
107 __u32 version; /* dirent version */
108 __u32 ino; /* == zero for unlink */
109 uint8_t nsize; /* dirent name size */
110 uint8_t type; /* dirent type */
111 uint8_t name[0]; /* dirent name */
112 } __attribute__((packed));
114 struct jffs2_sum_xattr_mem
116 union jffs2_sum_mem *next;
122 } __attribute__((packed));
124 struct jffs2_sum_xref_mem
126 union jffs2_sum_mem *next;
129 } __attribute__((packed));
133 struct jffs2_sum_unknown_mem u;
134 struct jffs2_sum_inode_mem i;
135 struct jffs2_sum_dirent_mem d;
136 struct jffs2_sum_xattr_mem x;
137 struct jffs2_sum_xref_mem r;
140 /* Summary related information stored in superblock */
144 uint32_t sum_size; /* collected summary information for nextblock */
147 union jffs2_sum_mem *sum_list_head;
148 union jffs2_sum_mem *sum_list_tail;
150 __u32 *sum_buf; /* buffer for writing out summary */
153 /* Summary marker is stored at the end of every sumarized erase block */
155 struct jffs2_sum_marker
157 __u32 offset; /* offset of the summary node in the jeb */
158 __u32 magic; /* == JFFS2_SUM_MAGIC */
161 #define JFFS2_SUMMARY_FRAME_SIZE (sizeof(struct jffs2_raw_summary) + sizeof(struct jffs2_sum_marker))
163 #endif /* JFFS2_SUMMARY_H */