nilfs2_ondisk.h revision 49f525c47bd383cd6a87db8f067cddb3ab620d17
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_NILFS2_ONDISK_H
20#define _LINUX_NILFS2_ONDISK_H
21#include <linux/types.h>
22#include <linux/magic.h>
23/* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */
24#define NILFS_INODE_BMAP_SIZE 7
25struct nilfs_inode {
26  __le64 i_blocks;
27  __le64 i_size;
28/* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */
29  __le64 i_ctime;
30  __le64 i_mtime;
31  __le32 i_ctime_nsec;
32  __le32 i_mtime_nsec;
33/* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */
34  __le32 i_uid;
35  __le32 i_gid;
36  __le16 i_mode;
37  __le16 i_links_count;
38/* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */
39  __le32 i_flags;
40  __le64 i_bmap[NILFS_INODE_BMAP_SIZE];
41#define i_device_code i_bmap[0]
42  __le64 i_xattr;
43/* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */
44  __le32 i_generation;
45  __le32 i_pad;
46};
47#define NILFS_MIN_INODE_SIZE 128
48/* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */
49struct nilfs_super_root {
50  __le32 sr_sum;
51  __le16 sr_bytes;
52  __le16 sr_flags;
53/* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */
54  __le64 sr_nongc_ctime;
55  struct nilfs_inode sr_dat;
56  struct nilfs_inode sr_cpfile;
57  struct nilfs_inode sr_sufile;
58/* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */
59};
60#define NILFS_SR_MDT_OFFSET(inode_size,i) ((unsigned long) & ((struct nilfs_super_root *) 0)->sr_dat + (inode_size) * (i))
61#define NILFS_SR_DAT_OFFSET(inode_size) NILFS_SR_MDT_OFFSET(inode_size, 0)
62#define NILFS_SR_CPFILE_OFFSET(inode_size) NILFS_SR_MDT_OFFSET(inode_size, 1)
63/* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */
64#define NILFS_SR_SUFILE_OFFSET(inode_size) NILFS_SR_MDT_OFFSET(inode_size, 2)
65#define NILFS_SR_BYTES(inode_size) NILFS_SR_MDT_OFFSET(inode_size, 3)
66#define NILFS_DFL_MAX_MNT_COUNT 50
67#define NILFS_VALID_FS 0x0001
68/* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */
69#define NILFS_ERROR_FS 0x0002
70#define NILFS_RESIZE_FS 0x0004
71#define NILFS_MOUNT_ERROR_MODE 0x0070
72#define NILFS_MOUNT_ERRORS_CONT 0x0010
73/* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */
74#define NILFS_MOUNT_ERRORS_RO 0x0020
75#define NILFS_MOUNT_ERRORS_PANIC 0x0040
76#define NILFS_MOUNT_BARRIER 0x1000
77#define NILFS_MOUNT_STRICT_ORDER 0x2000
78/* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */
79#define NILFS_MOUNT_NORECOVERY 0x4000
80#define NILFS_MOUNT_DISCARD 0x8000
81struct nilfs_super_block {
82  __le32 s_rev_level;
83/* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */
84  __le16 s_minor_rev_level;
85  __le16 s_magic;
86  __le16 s_bytes;
87  __le16 s_flags;
88/* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */
89  __le32 s_crc_seed;
90  __le32 s_sum;
91  __le32 s_log_block_size;
92  __le64 s_nsegments;
93/* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */
94  __le64 s_dev_size;
95  __le64 s_first_data_block;
96  __le32 s_blocks_per_segment;
97  __le32 s_r_segments_percentage;
98/* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */
99  __le64 s_last_cno;
100  __le64 s_last_pseg;
101  __le64 s_last_seq;
102  __le64 s_free_blocks_count;
103/* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */
104  __le64 s_ctime;
105  __le64 s_mtime;
106  __le64 s_wtime;
107  __le16 s_mnt_count;
108/* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */
109  __le16 s_max_mnt_count;
110  __le16 s_state;
111  __le16 s_errors;
112  __le64 s_lastcheck;
113/* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */
114  __le32 s_checkinterval;
115  __le32 s_creator_os;
116  __le16 s_def_resuid;
117  __le16 s_def_resgid;
118/* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */
119  __le32 s_first_ino;
120  __le16 s_inode_size;
121  __le16 s_dat_entry_size;
122  __le16 s_checkpoint_size;
123/* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */
124  __le16 s_segment_usage_size;
125  __u8 s_uuid[16];
126  char s_volume_name[80];
127  __le32 s_c_interval;
128/* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */
129  __le32 s_c_block_max;
130  __le64 s_feature_compat;
131  __le64 s_feature_compat_ro;
132  __le64 s_feature_incompat;
133/* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */
134  __u32 s_reserved[186];
135};
136#define NILFS_OS_LINUX 0
137#define NILFS_CURRENT_REV 2
138/* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */
139#define NILFS_MINOR_REV 0
140#define NILFS_MIN_SUPP_REV 2
141#define NILFS_FEATURE_COMPAT_RO_BLOCK_COUNT 0x00000001ULL
142#define NILFS_FEATURE_COMPAT_SUPP 0ULL
143/* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */
144#define NILFS_FEATURE_COMPAT_RO_SUPP NILFS_FEATURE_COMPAT_RO_BLOCK_COUNT
145#define NILFS_FEATURE_INCOMPAT_SUPP 0ULL
146#define NILFS_SB_BYTES ((long) & ((struct nilfs_super_block *) 0)->s_reserved)
147#define NILFS_ROOT_INO 2
148/* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */
149#define NILFS_DAT_INO 3
150#define NILFS_CPFILE_INO 4
151#define NILFS_SUFILE_INO 5
152#define NILFS_IFILE_INO 6
153/* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */
154#define NILFS_ATIME_INO 7
155#define NILFS_XATTR_INO 8
156#define NILFS_SKETCH_INO 10
157#define NILFS_USER_INO 11
158/* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */
159#define NILFS_SB_OFFSET_BYTES 1024
160#define NILFS_SEG_MIN_BLOCKS 16
161#define NILFS_PSEG_MIN_BLOCKS 2
162#define NILFS_MIN_NRSVSEGS 8
163/* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */
164#define NILFS_ROOT_METADATA_FILE(ino) ((ino) >= NILFS_DAT_INO && (ino) <= NILFS_SUFILE_INO)
165#define NILFS_SB2_OFFSET_BYTES(devsize) ((((devsize) >> 12) - 1) << 12)
166#define NILFS_LINK_MAX 32000
167#define NILFS_NAME_LEN 255
168/* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */
169#define NILFS_MIN_BLOCK_SIZE 1024
170#define NILFS_MAX_BLOCK_SIZE 65536
171struct nilfs_dir_entry {
172  __le64 inode;
173/* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */
174  __le16 rec_len;
175  __u8 name_len;
176  __u8 file_type;
177  char name[NILFS_NAME_LEN];
178/* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */
179  char pad;
180};
181enum {
182  NILFS_FT_UNKNOWN,
183/* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */
184  NILFS_FT_REG_FILE,
185  NILFS_FT_DIR,
186  NILFS_FT_CHRDEV,
187  NILFS_FT_BLKDEV,
188/* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */
189  NILFS_FT_FIFO,
190  NILFS_FT_SOCK,
191  NILFS_FT_SYMLINK,
192  NILFS_FT_MAX
193/* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */
194};
195#define NILFS_DIR_PAD 8
196#define NILFS_DIR_ROUND (NILFS_DIR_PAD - 1)
197#define NILFS_DIR_REC_LEN(name_len) (((name_len) + 12 + NILFS_DIR_ROUND) & ~NILFS_DIR_ROUND)
198/* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */
199#define NILFS_MAX_REC_LEN ((1 << 16) - 1)
200struct nilfs_finfo {
201  __le64 fi_ino;
202  __le64 fi_cno;
203/* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */
204  __le32 fi_nblocks;
205  __le32 fi_ndatablk;
206};
207struct nilfs_binfo_v {
208/* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */
209  __le64 bi_vblocknr;
210  __le64 bi_blkoff;
211};
212struct nilfs_binfo_dat {
213/* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */
214  __le64 bi_blkoff;
215  __u8 bi_level;
216  __u8 bi_pad[7];
217};
218/* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */
219union nilfs_binfo {
220  struct nilfs_binfo_v bi_v;
221  struct nilfs_binfo_dat bi_dat;
222};
223/* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */
224struct nilfs_segment_summary {
225  __le32 ss_datasum;
226  __le32 ss_sumsum;
227  __le32 ss_magic;
228/* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */
229  __le16 ss_bytes;
230  __le16 ss_flags;
231  __le64 ss_seq;
232  __le64 ss_create;
233/* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */
234  __le64 ss_next;
235  __le32 ss_nblocks;
236  __le32 ss_nfinfo;
237  __le32 ss_sumbytes;
238/* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */
239  __le32 ss_pad;
240  __le64 ss_cno;
241};
242#define NILFS_SEGSUM_MAGIC 0x1eaffa11
243/* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */
244#define NILFS_SS_LOGBGN 0x0001
245#define NILFS_SS_LOGEND 0x0002
246#define NILFS_SS_SR 0x0004
247#define NILFS_SS_SYNDT 0x0008
248/* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */
249#define NILFS_SS_GC 0x0010
250struct nilfs_btree_node {
251  __u8 bn_flags;
252  __u8 bn_level;
253/* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */
254  __le16 bn_nchildren;
255  __le32 bn_pad;
256};
257#define NILFS_BTREE_NODE_ROOT 0x01
258/* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */
259#define NILFS_BTREE_LEVEL_DATA 0
260#define NILFS_BTREE_LEVEL_NODE_MIN (NILFS_BTREE_LEVEL_DATA + 1)
261#define NILFS_BTREE_LEVEL_MAX 14
262struct nilfs_direct_node {
263/* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */
264  __u8 dn_flags;
265  __u8 pad[7];
266};
267struct nilfs_palloc_group_desc {
268/* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */
269  __le32 pg_nfrees;
270};
271struct nilfs_dat_entry {
272  __le64 de_blocknr;
273/* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */
274  __le64 de_start;
275  __le64 de_end;
276  __le64 de_rsv;
277};
278/* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */
279#define NILFS_MIN_DAT_ENTRY_SIZE 32
280struct nilfs_snapshot_list {
281  __le64 ssl_next;
282  __le64 ssl_prev;
283/* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */
284};
285struct nilfs_checkpoint {
286  __le32 cp_flags;
287  __le32 cp_checkpoints_count;
288/* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */
289  struct nilfs_snapshot_list cp_snapshot_list;
290  __le64 cp_cno;
291  __le64 cp_create;
292  __le64 cp_nblk_inc;
293/* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */
294  __le64 cp_inodes_count;
295  __le64 cp_blocks_count;
296  struct nilfs_inode cp_ifile_inode;
297};
298/* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */
299#define NILFS_MIN_CHECKPOINT_SIZE (64 + NILFS_MIN_INODE_SIZE)
300enum {
301  NILFS_CHECKPOINT_SNAPSHOT,
302  NILFS_CHECKPOINT_INVALID,
303/* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */
304  NILFS_CHECKPOINT_SKETCH,
305  NILFS_CHECKPOINT_MINOR,
306};
307#define NILFS_CHECKPOINT_FNS(flag,name) static inline void nilfs_checkpoint_set_ ##name(struct nilfs_checkpoint * cp) \
308{ cp->cp_flags = cpu_to_le32(le32_to_cpu(cp->cp_flags) | (1UL << NILFS_CHECKPOINT_ ##flag)); \
309} static inline void nilfs_checkpoint_clear_ ##name(struct nilfs_checkpoint * cp) \
310{ cp->cp_flags = cpu_to_le32(le32_to_cpu(cp->cp_flags) & ~(1UL << NILFS_CHECKPOINT_ ##flag)); \
311} static inline int nilfs_checkpoint_ ##name(const struct nilfs_checkpoint * cp) \
312{ return ! ! (le32_to_cpu(cp->cp_flags) & (1UL << NILFS_CHECKPOINT_ ##flag)); \
313}
314/* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */
315#define NILFS_CPFILE_FIRST_CHECKPOINT_OFFSET ((sizeof(struct nilfs_cpfile_header) + sizeof(struct nilfs_checkpoint) - 1) / sizeof(struct nilfs_checkpoint))
316struct nilfs_segment_usage {
317  __le64 su_lastmod;
318  __le32 su_nblocks;
319/* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */
320  __le32 su_flags;
321};
322#define NILFS_MIN_SEGMENT_USAGE_SIZE 16
323enum {
324/* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */
325  NILFS_SEGMENT_USAGE_ACTIVE,
326  NILFS_SEGMENT_USAGE_DIRTY,
327  NILFS_SEGMENT_USAGE_ERROR,
328};
329/* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */
330#define NILFS_SEGMENT_USAGE_FNS(flag,name) static inline void nilfs_segment_usage_set_ ##name(struct nilfs_segment_usage * su) \
331{ su->su_flags = cpu_to_le32(le32_to_cpu(su->su_flags) | (1UL << NILFS_SEGMENT_USAGE_ ##flag)); \
332} static inline void nilfs_segment_usage_clear_ ##name(struct nilfs_segment_usage * su) \
333{ su->su_flags = cpu_to_le32(le32_to_cpu(su->su_flags) & ~(1UL << NILFS_SEGMENT_USAGE_ ##flag)); \
334} static inline int nilfs_segment_usage_ ##name(const struct nilfs_segment_usage * su) \
335{ return ! ! (le32_to_cpu(su->su_flags) & (1UL << NILFS_SEGMENT_USAGE_ ##flag)); \
336}
337struct nilfs_sufile_header {
338  __le64 sh_ncleansegs;
339  __le64 sh_ndirtysegs;
340/* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */
341  __le64 sh_last_alloc;
342};
343#define NILFS_SUFILE_FIRST_SEGMENT_USAGE_OFFSET ((sizeof(struct nilfs_sufile_header) + sizeof(struct nilfs_segment_usage) - 1) / sizeof(struct nilfs_segment_usage))
344#endif
345/* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */
346