1 /****************************************************************************
2  ****************************************************************************
3  ***
4  ***   This header was automatically generated from a Linux kernel header
5  ***   of the same name, to make information necessary for userspace to
6  ***   call into the kernel available to libc.  It contains only constants,
7  ***   structures, and macros generated from the original header, and thus,
8  ***   contains no copyrightable information.
9  ***
10  ***   To edit the content of this header, modify the corresponding
11  ***   source file (e.g. under external/kernel-headers/original/) then
12  ***   run bionic/libc/kernel/tools/update_all.py
13  ***
14  ***   Any manual change here will be lost the next time this script will
15  ***   be run. You've been warned!
16  ***
17  ****************************************************************************
18  ****************************************************************************/
19 #ifndef __LINUX_JFFS2_H__
20 #define __LINUX_JFFS2_H__
21 #include <linux/types.h>
22 #include <linux/magic.h>
23 #define JFFS2_OLD_MAGIC_BITMASK 0x1984
24 #define JFFS2_MAGIC_BITMASK 0x1985
25 #define KSAMTIB_CIGAM_2SFFJ 0x8519
26 #define JFFS2_EMPTY_BITMASK 0xffff
27 #define JFFS2_DIRTY_BITMASK 0x0000
28 #define JFFS2_SUM_MAGIC 0x02851885
29 #define JFFS2_MAX_NAME_LEN 254
30 #define JFFS2_MIN_DATA_LEN 128
31 #define JFFS2_COMPR_NONE 0x00
32 #define JFFS2_COMPR_ZERO 0x01
33 #define JFFS2_COMPR_RTIME 0x02
34 #define JFFS2_COMPR_RUBINMIPS 0x03
35 #define JFFS2_COMPR_COPY 0x04
36 #define JFFS2_COMPR_DYNRUBIN 0x05
37 #define JFFS2_COMPR_ZLIB 0x06
38 #define JFFS2_COMPR_LZO 0x07
39 #define JFFS2_COMPAT_MASK 0xc000
40 #define JFFS2_NODE_ACCURATE 0x2000
41 #define JFFS2_FEATURE_INCOMPAT 0xc000
42 #define JFFS2_FEATURE_ROCOMPAT 0x8000
43 #define JFFS2_FEATURE_RWCOMPAT_COPY 0x4000
44 #define JFFS2_FEATURE_RWCOMPAT_DELETE 0x0000
45 #define JFFS2_NODETYPE_DIRENT (JFFS2_FEATURE_INCOMPAT | JFFS2_NODE_ACCURATE | 1)
46 #define JFFS2_NODETYPE_INODE (JFFS2_FEATURE_INCOMPAT | JFFS2_NODE_ACCURATE | 2)
47 #define JFFS2_NODETYPE_CLEANMARKER (JFFS2_FEATURE_RWCOMPAT_DELETE | JFFS2_NODE_ACCURATE | 3)
48 #define JFFS2_NODETYPE_PADDING (JFFS2_FEATURE_RWCOMPAT_DELETE | JFFS2_NODE_ACCURATE | 4)
49 #define JFFS2_NODETYPE_SUMMARY (JFFS2_FEATURE_RWCOMPAT_DELETE | JFFS2_NODE_ACCURATE | 6)
50 #define JFFS2_NODETYPE_XATTR (JFFS2_FEATURE_INCOMPAT | JFFS2_NODE_ACCURATE | 8)
51 #define JFFS2_NODETYPE_XREF (JFFS2_FEATURE_INCOMPAT | JFFS2_NODE_ACCURATE | 9)
52 #define JFFS2_XPREFIX_USER 1
53 #define JFFS2_XPREFIX_SECURITY 2
54 #define JFFS2_XPREFIX_ACL_ACCESS 3
55 #define JFFS2_XPREFIX_ACL_DEFAULT 4
56 #define JFFS2_XPREFIX_TRUSTED 5
57 #define JFFS2_ACL_VERSION 0x0001
58 #define JFFS2_INO_FLAG_PREREAD 1
59 #define JFFS2_INO_FLAG_USERCOMPR 2
60 typedef struct {
61   __u32 v32;
62 } __attribute__((packed)) jint32_t;
63 typedef struct {
64   __u32 m;
65 } __attribute__((packed)) jmode_t;
66 typedef struct {
67   __u16 v16;
68 } __attribute__((packed)) jint16_t;
69 struct jffs2_unknown_node {
70   jint16_t magic;
71   jint16_t nodetype;
72   jint32_t totlen;
73   jint32_t hdr_crc;
74 };
75 struct jffs2_raw_dirent {
76   jint16_t magic;
77   jint16_t nodetype;
78   jint32_t totlen;
79   jint32_t hdr_crc;
80   jint32_t pino;
81   jint32_t version;
82   jint32_t ino;
83   jint32_t mctime;
84   __u8 nsize;
85   __u8 type;
86   __u8 unused[2];
87   jint32_t node_crc;
88   jint32_t name_crc;
89   __u8 name[0];
90 };
91 struct jffs2_raw_inode {
92   jint16_t magic;
93   jint16_t nodetype;
94   jint32_t totlen;
95   jint32_t hdr_crc;
96   jint32_t ino;
97   jint32_t version;
98   jmode_t mode;
99   jint16_t uid;
100   jint16_t gid;
101   jint32_t isize;
102   jint32_t atime;
103   jint32_t mtime;
104   jint32_t ctime;
105   jint32_t offset;
106   jint32_t csize;
107   jint32_t dsize;
108   __u8 compr;
109   __u8 usercompr;
110   jint16_t flags;
111   jint32_t data_crc;
112   jint32_t node_crc;
113   __u8 data[0];
114 };
115 struct jffs2_raw_xattr {
116   jint16_t magic;
117   jint16_t nodetype;
118   jint32_t totlen;
119   jint32_t hdr_crc;
120   jint32_t xid;
121   jint32_t version;
122   __u8 xprefix;
123   __u8 name_len;
124   jint16_t value_len;
125   jint32_t data_crc;
126   jint32_t node_crc;
127   __u8 data[0];
128 } __attribute__((packed));
129 struct jffs2_raw_xref {
130   jint16_t magic;
131   jint16_t nodetype;
132   jint32_t totlen;
133   jint32_t hdr_crc;
134   jint32_t ino;
135   jint32_t xid;
136   jint32_t xseqno;
137   jint32_t node_crc;
138 } __attribute__((packed));
139 struct jffs2_raw_summary {
140   jint16_t magic;
141   jint16_t nodetype;
142   jint32_t totlen;
143   jint32_t hdr_crc;
144   jint32_t sum_num;
145   jint32_t cln_mkr;
146   jint32_t padded;
147   jint32_t sum_crc;
148   jint32_t node_crc;
149   jint32_t sum[0];
150 };
151 union jffs2_node_union {
152   struct jffs2_raw_inode i;
153   struct jffs2_raw_dirent d;
154   struct jffs2_raw_xattr x;
155   struct jffs2_raw_xref r;
156   struct jffs2_raw_summary s;
157   struct jffs2_unknown_node u;
158 };
159 union jffs2_device_node {
160   jint16_t old_id;
161   jint32_t new_id;
162 };
163 #endif
164