blob: f2ea901e71fe1bb24082c5afd358a1d83912803e [file] [log] [blame]
Elliott Hughes180edef2023-11-02 00:08:05 +00001/*
2 * This file is auto-generated. Modifications will be lost.
3 *
4 * See https://android.googlesource.com/platform/bionic/+/master/libc/kernel/
5 * for more information.
6 */
Ben Cheng655a7c02013-10-16 16:09:24 -07007#ifndef __LINUX_JFFS2_H__
8#define __LINUX_JFFS2_H__
9#include <linux/types.h>
10#include <linux/magic.h>
Ben Cheng655a7c02013-10-16 16:09:24 -070011#define JFFS2_OLD_MAGIC_BITMASK 0x1984
12#define JFFS2_MAGIC_BITMASK 0x1985
13#define KSAMTIB_CIGAM_2SFFJ 0x8519
14#define JFFS2_EMPTY_BITMASK 0xffff
Ben Cheng655a7c02013-10-16 16:09:24 -070015#define JFFS2_DIRTY_BITMASK 0x0000
16#define JFFS2_SUM_MAGIC 0x02851885
17#define JFFS2_MAX_NAME_LEN 254
18#define JFFS2_MIN_DATA_LEN 128
Ben Cheng655a7c02013-10-16 16:09:24 -070019#define JFFS2_COMPR_NONE 0x00
20#define JFFS2_COMPR_ZERO 0x01
21#define JFFS2_COMPR_RTIME 0x02
22#define JFFS2_COMPR_RUBINMIPS 0x03
Ben Cheng655a7c02013-10-16 16:09:24 -070023#define JFFS2_COMPR_COPY 0x04
24#define JFFS2_COMPR_DYNRUBIN 0x05
25#define JFFS2_COMPR_ZLIB 0x06
26#define JFFS2_COMPR_LZO 0x07
Ben Cheng655a7c02013-10-16 16:09:24 -070027#define JFFS2_COMPAT_MASK 0xc000
28#define JFFS2_NODE_ACCURATE 0x2000
29#define JFFS2_FEATURE_INCOMPAT 0xc000
30#define JFFS2_FEATURE_ROCOMPAT 0x8000
Ben Cheng655a7c02013-10-16 16:09:24 -070031#define JFFS2_FEATURE_RWCOMPAT_COPY 0x4000
32#define JFFS2_FEATURE_RWCOMPAT_DELETE 0x0000
33#define JFFS2_NODETYPE_DIRENT (JFFS2_FEATURE_INCOMPAT | JFFS2_NODE_ACCURATE | 1)
34#define JFFS2_NODETYPE_INODE (JFFS2_FEATURE_INCOMPAT | JFFS2_NODE_ACCURATE | 2)
Ben Cheng655a7c02013-10-16 16:09:24 -070035#define JFFS2_NODETYPE_CLEANMARKER (JFFS2_FEATURE_RWCOMPAT_DELETE | JFFS2_NODE_ACCURATE | 3)
36#define JFFS2_NODETYPE_PADDING (JFFS2_FEATURE_RWCOMPAT_DELETE | JFFS2_NODE_ACCURATE | 4)
37#define JFFS2_NODETYPE_SUMMARY (JFFS2_FEATURE_RWCOMPAT_DELETE | JFFS2_NODE_ACCURATE | 6)
38#define JFFS2_NODETYPE_XATTR (JFFS2_FEATURE_INCOMPAT | JFFS2_NODE_ACCURATE | 8)
Ben Cheng655a7c02013-10-16 16:09:24 -070039#define JFFS2_NODETYPE_XREF (JFFS2_FEATURE_INCOMPAT | JFFS2_NODE_ACCURATE | 9)
40#define JFFS2_XPREFIX_USER 1
41#define JFFS2_XPREFIX_SECURITY 2
42#define JFFS2_XPREFIX_ACL_ACCESS 3
Ben Cheng655a7c02013-10-16 16:09:24 -070043#define JFFS2_XPREFIX_ACL_DEFAULT 4
44#define JFFS2_XPREFIX_TRUSTED 5
45#define JFFS2_ACL_VERSION 0x0001
46#define JFFS2_INO_FLAG_PREREAD 1
Ben Cheng655a7c02013-10-16 16:09:24 -070047#define JFFS2_INO_FLAG_USERCOMPR 2
48typedef struct {
Tao Baod7db5942015-01-28 10:07:51 -080049 __u32 v32;
Ben Cheng655a7c02013-10-16 16:09:24 -070050} __attribute__((packed)) jint32_t;
Ben Cheng655a7c02013-10-16 16:09:24 -070051typedef struct {
Tao Baod7db5942015-01-28 10:07:51 -080052 __u32 m;
Ben Cheng655a7c02013-10-16 16:09:24 -070053} __attribute__((packed)) jmode_t;
54typedef struct {
Tao Baod7db5942015-01-28 10:07:51 -080055 __u16 v16;
Ben Cheng655a7c02013-10-16 16:09:24 -070056} __attribute__((packed)) jint16_t;
Tao Baod7db5942015-01-28 10:07:51 -080057struct jffs2_unknown_node {
58 jint16_t magic;
Tao Baod7db5942015-01-28 10:07:51 -080059 jint16_t nodetype;
60 jint32_t totlen;
61 jint32_t hdr_crc;
Ben Cheng655a7c02013-10-16 16:09:24 -070062};
Tao Baod7db5942015-01-28 10:07:51 -080063struct jffs2_raw_dirent {
64 jint16_t magic;
65 jint16_t nodetype;
66 jint32_t totlen;
Tao Baod7db5942015-01-28 10:07:51 -080067 jint32_t hdr_crc;
68 jint32_t pino;
69 jint32_t version;
70 jint32_t ino;
Tao Baod7db5942015-01-28 10:07:51 -080071 jint32_t mctime;
72 __u8 nsize;
73 __u8 type;
74 __u8 unused[2];
Tao Baod7db5942015-01-28 10:07:51 -080075 jint32_t node_crc;
76 jint32_t name_crc;
Christopher Ferris7447a1c2022-10-04 18:24:44 -070077 __u8 name[];
Ben Cheng655a7c02013-10-16 16:09:24 -070078};
Tao Baod7db5942015-01-28 10:07:51 -080079struct jffs2_raw_inode {
80 jint16_t magic;
81 jint16_t nodetype;
82 jint32_t totlen;
Tao Baod7db5942015-01-28 10:07:51 -080083 jint32_t hdr_crc;
84 jint32_t ino;
85 jint32_t version;
86 jmode_t mode;
Tao Baod7db5942015-01-28 10:07:51 -080087 jint16_t uid;
88 jint16_t gid;
89 jint32_t isize;
90 jint32_t atime;
Tao Baod7db5942015-01-28 10:07:51 -080091 jint32_t mtime;
92 jint32_t ctime;
93 jint32_t offset;
94 jint32_t csize;
Tao Baod7db5942015-01-28 10:07:51 -080095 jint32_t dsize;
96 __u8 compr;
97 __u8 usercompr;
98 jint16_t flags;
Tao Baod7db5942015-01-28 10:07:51 -080099 jint32_t data_crc;
100 jint32_t node_crc;
Christopher Ferris7447a1c2022-10-04 18:24:44 -0700101 __u8 data[];
Ben Cheng655a7c02013-10-16 16:09:24 -0700102};
103struct jffs2_raw_xattr {
Tao Baod7db5942015-01-28 10:07:51 -0800104 jint16_t magic;
105 jint16_t nodetype;
106 jint32_t totlen;
Tao Baod7db5942015-01-28 10:07:51 -0800107 jint32_t hdr_crc;
108 jint32_t xid;
109 jint32_t version;
110 __u8 xprefix;
Tao Baod7db5942015-01-28 10:07:51 -0800111 __u8 name_len;
112 jint16_t value_len;
113 jint32_t data_crc;
114 jint32_t node_crc;
Christopher Ferris7447a1c2022-10-04 18:24:44 -0700115 __u8 data[];
Ben Cheng655a7c02013-10-16 16:09:24 -0700116} __attribute__((packed));
Tao Baod7db5942015-01-28 10:07:51 -0800117struct jffs2_raw_xref {
118 jint16_t magic;
Tao Baod7db5942015-01-28 10:07:51 -0800119 jint16_t nodetype;
120 jint32_t totlen;
121 jint32_t hdr_crc;
122 jint32_t ino;
Tao Baod7db5942015-01-28 10:07:51 -0800123 jint32_t xid;
124 jint32_t xseqno;
125 jint32_t node_crc;
Ben Cheng655a7c02013-10-16 16:09:24 -0700126} __attribute__((packed));
Tao Baod7db5942015-01-28 10:07:51 -0800127struct jffs2_raw_summary {
128 jint16_t magic;
129 jint16_t nodetype;
130 jint32_t totlen;
Tao Baod7db5942015-01-28 10:07:51 -0800131 jint32_t hdr_crc;
132 jint32_t sum_num;
133 jint32_t cln_mkr;
134 jint32_t padded;
Tao Baod7db5942015-01-28 10:07:51 -0800135 jint32_t sum_crc;
136 jint32_t node_crc;
Christopher Ferris7447a1c2022-10-04 18:24:44 -0700137 jint32_t sum[];
Ben Cheng655a7c02013-10-16 16:09:24 -0700138};
Tao Baod7db5942015-01-28 10:07:51 -0800139union jffs2_node_union {
140 struct jffs2_raw_inode i;
141 struct jffs2_raw_dirent d;
142 struct jffs2_raw_xattr x;
Tao Baod7db5942015-01-28 10:07:51 -0800143 struct jffs2_raw_xref r;
144 struct jffs2_raw_summary s;
145 struct jffs2_unknown_node u;
Ben Cheng655a7c02013-10-16 16:09:24 -0700146};
147union jffs2_device_node {
Tao Baod7db5942015-01-28 10:07:51 -0800148 jint16_t old_id;
149 jint32_t new_id;
Ben Cheng655a7c02013-10-16 16:09:24 -0700150};
Ben Cheng655a7c02013-10-16 16:09:24 -0700151#endif