149f525c47bd383cd6a87db8f067cddb3ab620d17Christopher Ferris/****************************************************************************
249f525c47bd383cd6a87db8f067cddb3ab620d17Christopher Ferris ****************************************************************************
349f525c47bd383cd6a87db8f067cddb3ab620d17Christopher Ferris ***
449f525c47bd383cd6a87db8f067cddb3ab620d17Christopher Ferris ***   This header was automatically generated from a Linux kernel header
549f525c47bd383cd6a87db8f067cddb3ab620d17Christopher Ferris ***   of the same name, to make information necessary for userspace to
649f525c47bd383cd6a87db8f067cddb3ab620d17Christopher Ferris ***   call into the kernel available to libc.  It contains only constants,
749f525c47bd383cd6a87db8f067cddb3ab620d17Christopher Ferris ***   structures, and macros generated from the original header, and thus,
849f525c47bd383cd6a87db8f067cddb3ab620d17Christopher Ferris ***   contains no copyrightable information.
949f525c47bd383cd6a87db8f067cddb3ab620d17Christopher Ferris ***
1049f525c47bd383cd6a87db8f067cddb3ab620d17Christopher Ferris ***   To edit the content of this header, modify the corresponding
1149f525c47bd383cd6a87db8f067cddb3ab620d17Christopher Ferris ***   source file (e.g. under external/kernel-headers/original/) then
1249f525c47bd383cd6a87db8f067cddb3ab620d17Christopher Ferris ***   run bionic/libc/kernel/tools/update_all.py
1349f525c47bd383cd6a87db8f067cddb3ab620d17Christopher Ferris ***
1449f525c47bd383cd6a87db8f067cddb3ab620d17Christopher Ferris ***   Any manual change here will be lost the next time this script will
1549f525c47bd383cd6a87db8f067cddb3ab620d17Christopher Ferris ***   be run. You've been warned!
1649f525c47bd383cd6a87db8f067cddb3ab620d17Christopher Ferris ***
1749f525c47bd383cd6a87db8f067cddb3ab620d17Christopher Ferris ****************************************************************************
1849f525c47bd383cd6a87db8f067cddb3ab620d17Christopher Ferris ****************************************************************************/
1949f525c47bd383cd6a87db8f067cddb3ab620d17Christopher Ferris#ifndef _LINUX_NILFS2_ONDISK_H
2049f525c47bd383cd6a87db8f067cddb3ab620d17Christopher Ferris#define _LINUX_NILFS2_ONDISK_H
2149f525c47bd383cd6a87db8f067cddb3ab620d17Christopher Ferris#include <linux/types.h>
2249f525c47bd383cd6a87db8f067cddb3ab620d17Christopher Ferris#include <linux/magic.h>
2349f525c47bd383cd6a87db8f067cddb3ab620d17Christopher Ferris#define NILFS_INODE_BMAP_SIZE 7
2449f525c47bd383cd6a87db8f067cddb3ab620d17Christopher Ferrisstruct nilfs_inode {
2549f525c47bd383cd6a87db8f067cddb3ab620d17Christopher Ferris  __le64 i_blocks;
2649f525c47bd383cd6a87db8f067cddb3ab620d17Christopher Ferris  __le64 i_size;
2749f525c47bd383cd6a87db8f067cddb3ab620d17Christopher Ferris  __le64 i_ctime;
2849f525c47bd383cd6a87db8f067cddb3ab620d17Christopher Ferris  __le64 i_mtime;
2949f525c47bd383cd6a87db8f067cddb3ab620d17Christopher Ferris  __le32 i_ctime_nsec;
3049f525c47bd383cd6a87db8f067cddb3ab620d17Christopher Ferris  __le32 i_mtime_nsec;
3149f525c47bd383cd6a87db8f067cddb3ab620d17Christopher Ferris  __le32 i_uid;
3249f525c47bd383cd6a87db8f067cddb3ab620d17Christopher Ferris  __le32 i_gid;
3349f525c47bd383cd6a87db8f067cddb3ab620d17Christopher Ferris  __le16 i_mode;
3449f525c47bd383cd6a87db8f067cddb3ab620d17Christopher Ferris  __le16 i_links_count;
3549f525c47bd383cd6a87db8f067cddb3ab620d17Christopher Ferris  __le32 i_flags;
3649f525c47bd383cd6a87db8f067cddb3ab620d17Christopher Ferris  __le64 i_bmap[NILFS_INODE_BMAP_SIZE];
3749f525c47bd383cd6a87db8f067cddb3ab620d17Christopher Ferris#define i_device_code i_bmap[0]
3849f525c47bd383cd6a87db8f067cddb3ab620d17Christopher Ferris  __le64 i_xattr;
3949f525c47bd383cd6a87db8f067cddb3ab620d17Christopher Ferris  __le32 i_generation;
4049f525c47bd383cd6a87db8f067cddb3ab620d17Christopher Ferris  __le32 i_pad;
4149f525c47bd383cd6a87db8f067cddb3ab620d17Christopher Ferris};
4249f525c47bd383cd6a87db8f067cddb3ab620d17Christopher Ferris#define NILFS_MIN_INODE_SIZE 128
4349f525c47bd383cd6a87db8f067cddb3ab620d17Christopher Ferrisstruct nilfs_super_root {
4449f525c47bd383cd6a87db8f067cddb3ab620d17Christopher Ferris  __le32 sr_sum;
4549f525c47bd383cd6a87db8f067cddb3ab620d17Christopher Ferris  __le16 sr_bytes;
4649f525c47bd383cd6a87db8f067cddb3ab620d17Christopher Ferris  __le16 sr_flags;
4749f525c47bd383cd6a87db8f067cddb3ab620d17Christopher Ferris  __le64 sr_nongc_ctime;
4849f525c47bd383cd6a87db8f067cddb3ab620d17Christopher Ferris  struct nilfs_inode sr_dat;
4949f525c47bd383cd6a87db8f067cddb3ab620d17Christopher Ferris  struct nilfs_inode sr_cpfile;
5049f525c47bd383cd6a87db8f067cddb3ab620d17Christopher Ferris  struct nilfs_inode sr_sufile;
5149f525c47bd383cd6a87db8f067cddb3ab620d17Christopher Ferris};
5249f525c47bd383cd6a87db8f067cddb3ab620d17Christopher Ferris#define NILFS_SR_MDT_OFFSET(inode_size,i) ((unsigned long) & ((struct nilfs_super_root *) 0)->sr_dat + (inode_size) * (i))
5349f525c47bd383cd6a87db8f067cddb3ab620d17Christopher Ferris#define NILFS_SR_DAT_OFFSET(inode_size) NILFS_SR_MDT_OFFSET(inode_size, 0)
5449f525c47bd383cd6a87db8f067cddb3ab620d17Christopher Ferris#define NILFS_SR_CPFILE_OFFSET(inode_size) NILFS_SR_MDT_OFFSET(inode_size, 1)
5549f525c47bd383cd6a87db8f067cddb3ab620d17Christopher Ferris#define NILFS_SR_SUFILE_OFFSET(inode_size) NILFS_SR_MDT_OFFSET(inode_size, 2)
5649f525c47bd383cd6a87db8f067cddb3ab620d17Christopher Ferris#define NILFS_SR_BYTES(inode_size) NILFS_SR_MDT_OFFSET(inode_size, 3)
5749f525c47bd383cd6a87db8f067cddb3ab620d17Christopher Ferris#define NILFS_DFL_MAX_MNT_COUNT 50
5849f525c47bd383cd6a87db8f067cddb3ab620d17Christopher Ferris#define NILFS_VALID_FS 0x0001
5949f525c47bd383cd6a87db8f067cddb3ab620d17Christopher Ferris#define NILFS_ERROR_FS 0x0002
6049f525c47bd383cd6a87db8f067cddb3ab620d17Christopher Ferris#define NILFS_RESIZE_FS 0x0004
6149f525c47bd383cd6a87db8f067cddb3ab620d17Christopher Ferris#define NILFS_MOUNT_ERROR_MODE 0x0070
6249f525c47bd383cd6a87db8f067cddb3ab620d17Christopher Ferris#define NILFS_MOUNT_ERRORS_CONT 0x0010
6349f525c47bd383cd6a87db8f067cddb3ab620d17Christopher Ferris#define NILFS_MOUNT_ERRORS_RO 0x0020
6449f525c47bd383cd6a87db8f067cddb3ab620d17Christopher Ferris#define NILFS_MOUNT_ERRORS_PANIC 0x0040
6549f525c47bd383cd6a87db8f067cddb3ab620d17Christopher Ferris#define NILFS_MOUNT_BARRIER 0x1000
6649f525c47bd383cd6a87db8f067cddb3ab620d17Christopher Ferris#define NILFS_MOUNT_STRICT_ORDER 0x2000
6749f525c47bd383cd6a87db8f067cddb3ab620d17Christopher Ferris#define NILFS_MOUNT_NORECOVERY 0x4000
6849f525c47bd383cd6a87db8f067cddb3ab620d17Christopher Ferris#define NILFS_MOUNT_DISCARD 0x8000
6949f525c47bd383cd6a87db8f067cddb3ab620d17Christopher Ferrisstruct nilfs_super_block {
7049f525c47bd383cd6a87db8f067cddb3ab620d17Christopher Ferris  __le32 s_rev_level;
7149f525c47bd383cd6a87db8f067cddb3ab620d17Christopher Ferris  __le16 s_minor_rev_level;
7249f525c47bd383cd6a87db8f067cddb3ab620d17Christopher Ferris  __le16 s_magic;
7349f525c47bd383cd6a87db8f067cddb3ab620d17Christopher Ferris  __le16 s_bytes;
7449f525c47bd383cd6a87db8f067cddb3ab620d17Christopher Ferris  __le16 s_flags;
7549f525c47bd383cd6a87db8f067cddb3ab620d17Christopher Ferris  __le32 s_crc_seed;
7649f525c47bd383cd6a87db8f067cddb3ab620d17Christopher Ferris  __le32 s_sum;
7749f525c47bd383cd6a87db8f067cddb3ab620d17Christopher Ferris  __le32 s_log_block_size;
7849f525c47bd383cd6a87db8f067cddb3ab620d17Christopher Ferris  __le64 s_nsegments;
7949f525c47bd383cd6a87db8f067cddb3ab620d17Christopher Ferris  __le64 s_dev_size;
8049f525c47bd383cd6a87db8f067cddb3ab620d17Christopher Ferris  __le64 s_first_data_block;
8149f525c47bd383cd6a87db8f067cddb3ab620d17Christopher Ferris  __le32 s_blocks_per_segment;
8249f525c47bd383cd6a87db8f067cddb3ab620d17Christopher Ferris  __le32 s_r_segments_percentage;
8349f525c47bd383cd6a87db8f067cddb3ab620d17Christopher Ferris  __le64 s_last_cno;
8449f525c47bd383cd6a87db8f067cddb3ab620d17Christopher Ferris  __le64 s_last_pseg;
8549f525c47bd383cd6a87db8f067cddb3ab620d17Christopher Ferris  __le64 s_last_seq;
8649f525c47bd383cd6a87db8f067cddb3ab620d17Christopher Ferris  __le64 s_free_blocks_count;
8749f525c47bd383cd6a87db8f067cddb3ab620d17Christopher Ferris  __le64 s_ctime;
8849f525c47bd383cd6a87db8f067cddb3ab620d17Christopher Ferris  __le64 s_mtime;
8949f525c47bd383cd6a87db8f067cddb3ab620d17Christopher Ferris  __le64 s_wtime;
9049f525c47bd383cd6a87db8f067cddb3ab620d17Christopher Ferris  __le16 s_mnt_count;
9149f525c47bd383cd6a87db8f067cddb3ab620d17Christopher Ferris  __le16 s_max_mnt_count;
9249f525c47bd383cd6a87db8f067cddb3ab620d17Christopher Ferris  __le16 s_state;
9349f525c47bd383cd6a87db8f067cddb3ab620d17Christopher Ferris  __le16 s_errors;
9449f525c47bd383cd6a87db8f067cddb3ab620d17Christopher Ferris  __le64 s_lastcheck;
9549f525c47bd383cd6a87db8f067cddb3ab620d17Christopher Ferris  __le32 s_checkinterval;
9649f525c47bd383cd6a87db8f067cddb3ab620d17Christopher Ferris  __le32 s_creator_os;
9749f525c47bd383cd6a87db8f067cddb3ab620d17Christopher Ferris  __le16 s_def_resuid;
9849f525c47bd383cd6a87db8f067cddb3ab620d17Christopher Ferris  __le16 s_def_resgid;
9949f525c47bd383cd6a87db8f067cddb3ab620d17Christopher Ferris  __le32 s_first_ino;
10049f525c47bd383cd6a87db8f067cddb3ab620d17Christopher Ferris  __le16 s_inode_size;
10149f525c47bd383cd6a87db8f067cddb3ab620d17Christopher Ferris  __le16 s_dat_entry_size;
10249f525c47bd383cd6a87db8f067cddb3ab620d17Christopher Ferris  __le16 s_checkpoint_size;
10349f525c47bd383cd6a87db8f067cddb3ab620d17Christopher Ferris  __le16 s_segment_usage_size;
10449f525c47bd383cd6a87db8f067cddb3ab620d17Christopher Ferris  __u8 s_uuid[16];
10549f525c47bd383cd6a87db8f067cddb3ab620d17Christopher Ferris  char s_volume_name[80];
10649f525c47bd383cd6a87db8f067cddb3ab620d17Christopher Ferris  __le32 s_c_interval;
10749f525c47bd383cd6a87db8f067cddb3ab620d17Christopher Ferris  __le32 s_c_block_max;
10849f525c47bd383cd6a87db8f067cddb3ab620d17Christopher Ferris  __le64 s_feature_compat;
10949f525c47bd383cd6a87db8f067cddb3ab620d17Christopher Ferris  __le64 s_feature_compat_ro;
11049f525c47bd383cd6a87db8f067cddb3ab620d17Christopher Ferris  __le64 s_feature_incompat;
11149f525c47bd383cd6a87db8f067cddb3ab620d17Christopher Ferris  __u32 s_reserved[186];
11249f525c47bd383cd6a87db8f067cddb3ab620d17Christopher Ferris};
11349f525c47bd383cd6a87db8f067cddb3ab620d17Christopher Ferris#define NILFS_OS_LINUX 0
11449f525c47bd383cd6a87db8f067cddb3ab620d17Christopher Ferris#define NILFS_CURRENT_REV 2
11549f525c47bd383cd6a87db8f067cddb3ab620d17Christopher Ferris#define NILFS_MINOR_REV 0
11649f525c47bd383cd6a87db8f067cddb3ab620d17Christopher Ferris#define NILFS_MIN_SUPP_REV 2
11749f525c47bd383cd6a87db8f067cddb3ab620d17Christopher Ferris#define NILFS_FEATURE_COMPAT_RO_BLOCK_COUNT 0x00000001ULL
11849f525c47bd383cd6a87db8f067cddb3ab620d17Christopher Ferris#define NILFS_FEATURE_COMPAT_SUPP 0ULL
11949f525c47bd383cd6a87db8f067cddb3ab620d17Christopher Ferris#define NILFS_FEATURE_COMPAT_RO_SUPP NILFS_FEATURE_COMPAT_RO_BLOCK_COUNT
12049f525c47bd383cd6a87db8f067cddb3ab620d17Christopher Ferris#define NILFS_FEATURE_INCOMPAT_SUPP 0ULL
12149f525c47bd383cd6a87db8f067cddb3ab620d17Christopher Ferris#define NILFS_SB_BYTES ((long) & ((struct nilfs_super_block *) 0)->s_reserved)
12249f525c47bd383cd6a87db8f067cddb3ab620d17Christopher Ferris#define NILFS_ROOT_INO 2
12349f525c47bd383cd6a87db8f067cddb3ab620d17Christopher Ferris#define NILFS_DAT_INO 3
12449f525c47bd383cd6a87db8f067cddb3ab620d17Christopher Ferris#define NILFS_CPFILE_INO 4
12549f525c47bd383cd6a87db8f067cddb3ab620d17Christopher Ferris#define NILFS_SUFILE_INO 5
12649f525c47bd383cd6a87db8f067cddb3ab620d17Christopher Ferris#define NILFS_IFILE_INO 6
12749f525c47bd383cd6a87db8f067cddb3ab620d17Christopher Ferris#define NILFS_ATIME_INO 7
12849f525c47bd383cd6a87db8f067cddb3ab620d17Christopher Ferris#define NILFS_XATTR_INO 8
12949f525c47bd383cd6a87db8f067cddb3ab620d17Christopher Ferris#define NILFS_SKETCH_INO 10
13049f525c47bd383cd6a87db8f067cddb3ab620d17Christopher Ferris#define NILFS_USER_INO 11
13149f525c47bd383cd6a87db8f067cddb3ab620d17Christopher Ferris#define NILFS_SB_OFFSET_BYTES 1024
13249f525c47bd383cd6a87db8f067cddb3ab620d17Christopher Ferris#define NILFS_SEG_MIN_BLOCKS 16
13349f525c47bd383cd6a87db8f067cddb3ab620d17Christopher Ferris#define NILFS_PSEG_MIN_BLOCKS 2
13449f525c47bd383cd6a87db8f067cddb3ab620d17Christopher Ferris#define NILFS_MIN_NRSVSEGS 8
13549f525c47bd383cd6a87db8f067cddb3ab620d17Christopher Ferris#define NILFS_ROOT_METADATA_FILE(ino) ((ino) >= NILFS_DAT_INO && (ino) <= NILFS_SUFILE_INO)
13649f525c47bd383cd6a87db8f067cddb3ab620d17Christopher Ferris#define NILFS_SB2_OFFSET_BYTES(devsize) ((((devsize) >> 12) - 1) << 12)
13749f525c47bd383cd6a87db8f067cddb3ab620d17Christopher Ferris#define NILFS_LINK_MAX 32000
13849f525c47bd383cd6a87db8f067cddb3ab620d17Christopher Ferris#define NILFS_NAME_LEN 255
13949f525c47bd383cd6a87db8f067cddb3ab620d17Christopher Ferris#define NILFS_MIN_BLOCK_SIZE 1024
14049f525c47bd383cd6a87db8f067cddb3ab620d17Christopher Ferris#define NILFS_MAX_BLOCK_SIZE 65536
14149f525c47bd383cd6a87db8f067cddb3ab620d17Christopher Ferrisstruct nilfs_dir_entry {
14249f525c47bd383cd6a87db8f067cddb3ab620d17Christopher Ferris  __le64 inode;
14349f525c47bd383cd6a87db8f067cddb3ab620d17Christopher Ferris  __le16 rec_len;
14449f525c47bd383cd6a87db8f067cddb3ab620d17Christopher Ferris  __u8 name_len;
14549f525c47bd383cd6a87db8f067cddb3ab620d17Christopher Ferris  __u8 file_type;
14649f525c47bd383cd6a87db8f067cddb3ab620d17Christopher Ferris  char name[NILFS_NAME_LEN];
14749f525c47bd383cd6a87db8f067cddb3ab620d17Christopher Ferris  char pad;
14849f525c47bd383cd6a87db8f067cddb3ab620d17Christopher Ferris};
14949f525c47bd383cd6a87db8f067cddb3ab620d17Christopher Ferrisenum {
15049f525c47bd383cd6a87db8f067cddb3ab620d17Christopher Ferris  NILFS_FT_UNKNOWN,
15149f525c47bd383cd6a87db8f067cddb3ab620d17Christopher Ferris  NILFS_FT_REG_FILE,
15249f525c47bd383cd6a87db8f067cddb3ab620d17Christopher Ferris  NILFS_FT_DIR,
15349f525c47bd383cd6a87db8f067cddb3ab620d17Christopher Ferris  NILFS_FT_CHRDEV,
15449f525c47bd383cd6a87db8f067cddb3ab620d17Christopher Ferris  NILFS_FT_BLKDEV,
15549f525c47bd383cd6a87db8f067cddb3ab620d17Christopher Ferris  NILFS_FT_FIFO,
15649f525c47bd383cd6a87db8f067cddb3ab620d17Christopher Ferris  NILFS_FT_SOCK,
15749f525c47bd383cd6a87db8f067cddb3ab620d17Christopher Ferris  NILFS_FT_SYMLINK,
15849f525c47bd383cd6a87db8f067cddb3ab620d17Christopher Ferris  NILFS_FT_MAX
15949f525c47bd383cd6a87db8f067cddb3ab620d17Christopher Ferris};
16049f525c47bd383cd6a87db8f067cddb3ab620d17Christopher Ferris#define NILFS_DIR_PAD 8
16149f525c47bd383cd6a87db8f067cddb3ab620d17Christopher Ferris#define NILFS_DIR_ROUND (NILFS_DIR_PAD - 1)
16249f525c47bd383cd6a87db8f067cddb3ab620d17Christopher Ferris#define NILFS_DIR_REC_LEN(name_len) (((name_len) + 12 + NILFS_DIR_ROUND) & ~NILFS_DIR_ROUND)
16349f525c47bd383cd6a87db8f067cddb3ab620d17Christopher Ferris#define NILFS_MAX_REC_LEN ((1 << 16) - 1)
16449f525c47bd383cd6a87db8f067cddb3ab620d17Christopher Ferrisstruct nilfs_finfo {
16549f525c47bd383cd6a87db8f067cddb3ab620d17Christopher Ferris  __le64 fi_ino;
16649f525c47bd383cd6a87db8f067cddb3ab620d17Christopher Ferris  __le64 fi_cno;
16749f525c47bd383cd6a87db8f067cddb3ab620d17Christopher Ferris  __le32 fi_nblocks;
16849f525c47bd383cd6a87db8f067cddb3ab620d17Christopher Ferris  __le32 fi_ndatablk;
16949f525c47bd383cd6a87db8f067cddb3ab620d17Christopher Ferris};
17049f525c47bd383cd6a87db8f067cddb3ab620d17Christopher Ferrisstruct nilfs_binfo_v {
17149f525c47bd383cd6a87db8f067cddb3ab620d17Christopher Ferris  __le64 bi_vblocknr;
17249f525c47bd383cd6a87db8f067cddb3ab620d17Christopher Ferris  __le64 bi_blkoff;
17349f525c47bd383cd6a87db8f067cddb3ab620d17Christopher Ferris};
17449f525c47bd383cd6a87db8f067cddb3ab620d17Christopher Ferrisstruct nilfs_binfo_dat {
17549f525c47bd383cd6a87db8f067cddb3ab620d17Christopher Ferris  __le64 bi_blkoff;
17649f525c47bd383cd6a87db8f067cddb3ab620d17Christopher Ferris  __u8 bi_level;
17749f525c47bd383cd6a87db8f067cddb3ab620d17Christopher Ferris  __u8 bi_pad[7];
17849f525c47bd383cd6a87db8f067cddb3ab620d17Christopher Ferris};
17949f525c47bd383cd6a87db8f067cddb3ab620d17Christopher Ferrisunion nilfs_binfo {
18049f525c47bd383cd6a87db8f067cddb3ab620d17Christopher Ferris  struct nilfs_binfo_v bi_v;
18149f525c47bd383cd6a87db8f067cddb3ab620d17Christopher Ferris  struct nilfs_binfo_dat bi_dat;
18249f525c47bd383cd6a87db8f067cddb3ab620d17Christopher Ferris};
18349f525c47bd383cd6a87db8f067cddb3ab620d17Christopher Ferrisstruct nilfs_segment_summary {
18449f525c47bd383cd6a87db8f067cddb3ab620d17Christopher Ferris  __le32 ss_datasum;
18549f525c47bd383cd6a87db8f067cddb3ab620d17Christopher Ferris  __le32 ss_sumsum;
18649f525c47bd383cd6a87db8f067cddb3ab620d17Christopher Ferris  __le32 ss_magic;
18749f525c47bd383cd6a87db8f067cddb3ab620d17Christopher Ferris  __le16 ss_bytes;
18849f525c47bd383cd6a87db8f067cddb3ab620d17Christopher Ferris  __le16 ss_flags;
18949f525c47bd383cd6a87db8f067cddb3ab620d17Christopher Ferris  __le64 ss_seq;
19049f525c47bd383cd6a87db8f067cddb3ab620d17Christopher Ferris  __le64 ss_create;
19149f525c47bd383cd6a87db8f067cddb3ab620d17Christopher Ferris  __le64 ss_next;
19249f525c47bd383cd6a87db8f067cddb3ab620d17Christopher Ferris  __le32 ss_nblocks;
19349f525c47bd383cd6a87db8f067cddb3ab620d17Christopher Ferris  __le32 ss_nfinfo;
19449f525c47bd383cd6a87db8f067cddb3ab620d17Christopher Ferris  __le32 ss_sumbytes;
19549f525c47bd383cd6a87db8f067cddb3ab620d17Christopher Ferris  __le32 ss_pad;
19649f525c47bd383cd6a87db8f067cddb3ab620d17Christopher Ferris  __le64 ss_cno;
19749f525c47bd383cd6a87db8f067cddb3ab620d17Christopher Ferris};
19849f525c47bd383cd6a87db8f067cddb3ab620d17Christopher Ferris#define NILFS_SEGSUM_MAGIC 0x1eaffa11
19949f525c47bd383cd6a87db8f067cddb3ab620d17Christopher Ferris#define NILFS_SS_LOGBGN 0x0001
20049f525c47bd383cd6a87db8f067cddb3ab620d17Christopher Ferris#define NILFS_SS_LOGEND 0x0002
20149f525c47bd383cd6a87db8f067cddb3ab620d17Christopher Ferris#define NILFS_SS_SR 0x0004
20249f525c47bd383cd6a87db8f067cddb3ab620d17Christopher Ferris#define NILFS_SS_SYNDT 0x0008
20349f525c47bd383cd6a87db8f067cddb3ab620d17Christopher Ferris#define NILFS_SS_GC 0x0010
20449f525c47bd383cd6a87db8f067cddb3ab620d17Christopher Ferrisstruct nilfs_btree_node {
20549f525c47bd383cd6a87db8f067cddb3ab620d17Christopher Ferris  __u8 bn_flags;
20649f525c47bd383cd6a87db8f067cddb3ab620d17Christopher Ferris  __u8 bn_level;
20749f525c47bd383cd6a87db8f067cddb3ab620d17Christopher Ferris  __le16 bn_nchildren;
20849f525c47bd383cd6a87db8f067cddb3ab620d17Christopher Ferris  __le32 bn_pad;
20949f525c47bd383cd6a87db8f067cddb3ab620d17Christopher Ferris};
21049f525c47bd383cd6a87db8f067cddb3ab620d17Christopher Ferris#define NILFS_BTREE_NODE_ROOT 0x01
21149f525c47bd383cd6a87db8f067cddb3ab620d17Christopher Ferris#define NILFS_BTREE_LEVEL_DATA 0
21249f525c47bd383cd6a87db8f067cddb3ab620d17Christopher Ferris#define NILFS_BTREE_LEVEL_NODE_MIN (NILFS_BTREE_LEVEL_DATA + 1)
21349f525c47bd383cd6a87db8f067cddb3ab620d17Christopher Ferris#define NILFS_BTREE_LEVEL_MAX 14
21449f525c47bd383cd6a87db8f067cddb3ab620d17Christopher Ferrisstruct nilfs_direct_node {
21549f525c47bd383cd6a87db8f067cddb3ab620d17Christopher Ferris  __u8 dn_flags;
21649f525c47bd383cd6a87db8f067cddb3ab620d17Christopher Ferris  __u8 pad[7];
21749f525c47bd383cd6a87db8f067cddb3ab620d17Christopher Ferris};
21849f525c47bd383cd6a87db8f067cddb3ab620d17Christopher Ferrisstruct nilfs_palloc_group_desc {
21949f525c47bd383cd6a87db8f067cddb3ab620d17Christopher Ferris  __le32 pg_nfrees;
22049f525c47bd383cd6a87db8f067cddb3ab620d17Christopher Ferris};
22149f525c47bd383cd6a87db8f067cddb3ab620d17Christopher Ferrisstruct nilfs_dat_entry {
22249f525c47bd383cd6a87db8f067cddb3ab620d17Christopher Ferris  __le64 de_blocknr;
22349f525c47bd383cd6a87db8f067cddb3ab620d17Christopher Ferris  __le64 de_start;
22449f525c47bd383cd6a87db8f067cddb3ab620d17Christopher Ferris  __le64 de_end;
22549f525c47bd383cd6a87db8f067cddb3ab620d17Christopher Ferris  __le64 de_rsv;
22649f525c47bd383cd6a87db8f067cddb3ab620d17Christopher Ferris};
22749f525c47bd383cd6a87db8f067cddb3ab620d17Christopher Ferris#define NILFS_MIN_DAT_ENTRY_SIZE 32
22849f525c47bd383cd6a87db8f067cddb3ab620d17Christopher Ferrisstruct nilfs_snapshot_list {
22949f525c47bd383cd6a87db8f067cddb3ab620d17Christopher Ferris  __le64 ssl_next;
23049f525c47bd383cd6a87db8f067cddb3ab620d17Christopher Ferris  __le64 ssl_prev;
23149f525c47bd383cd6a87db8f067cddb3ab620d17Christopher Ferris};
23249f525c47bd383cd6a87db8f067cddb3ab620d17Christopher Ferrisstruct nilfs_checkpoint {
23349f525c47bd383cd6a87db8f067cddb3ab620d17Christopher Ferris  __le32 cp_flags;
23449f525c47bd383cd6a87db8f067cddb3ab620d17Christopher Ferris  __le32 cp_checkpoints_count;
23549f525c47bd383cd6a87db8f067cddb3ab620d17Christopher Ferris  struct nilfs_snapshot_list cp_snapshot_list;
23649f525c47bd383cd6a87db8f067cddb3ab620d17Christopher Ferris  __le64 cp_cno;
23749f525c47bd383cd6a87db8f067cddb3ab620d17Christopher Ferris  __le64 cp_create;
23849f525c47bd383cd6a87db8f067cddb3ab620d17Christopher Ferris  __le64 cp_nblk_inc;
23949f525c47bd383cd6a87db8f067cddb3ab620d17Christopher Ferris  __le64 cp_inodes_count;
24049f525c47bd383cd6a87db8f067cddb3ab620d17Christopher Ferris  __le64 cp_blocks_count;
24149f525c47bd383cd6a87db8f067cddb3ab620d17Christopher Ferris  struct nilfs_inode cp_ifile_inode;
24249f525c47bd383cd6a87db8f067cddb3ab620d17Christopher Ferris};
24349f525c47bd383cd6a87db8f067cddb3ab620d17Christopher Ferris#define NILFS_MIN_CHECKPOINT_SIZE (64 + NILFS_MIN_INODE_SIZE)
24449f525c47bd383cd6a87db8f067cddb3ab620d17Christopher Ferrisenum {
24549f525c47bd383cd6a87db8f067cddb3ab620d17Christopher Ferris  NILFS_CHECKPOINT_SNAPSHOT,
24649f525c47bd383cd6a87db8f067cddb3ab620d17Christopher Ferris  NILFS_CHECKPOINT_INVALID,
24749f525c47bd383cd6a87db8f067cddb3ab620d17Christopher Ferris  NILFS_CHECKPOINT_SKETCH,
24849f525c47bd383cd6a87db8f067cddb3ab620d17Christopher Ferris  NILFS_CHECKPOINT_MINOR,
24949f525c47bd383cd6a87db8f067cddb3ab620d17Christopher Ferris};
25049f525c47bd383cd6a87db8f067cddb3ab620d17Christopher Ferris#define NILFS_CHECKPOINT_FNS(flag,name) static inline void nilfs_checkpoint_set_ ##name(struct nilfs_checkpoint * cp) \
25149f525c47bd383cd6a87db8f067cddb3ab620d17Christopher Ferris{ cp->cp_flags = cpu_to_le32(le32_to_cpu(cp->cp_flags) | (1UL << NILFS_CHECKPOINT_ ##flag)); \
25249f525c47bd383cd6a87db8f067cddb3ab620d17Christopher Ferris} static inline void nilfs_checkpoint_clear_ ##name(struct nilfs_checkpoint * cp) \
25349f525c47bd383cd6a87db8f067cddb3ab620d17Christopher Ferris{ cp->cp_flags = cpu_to_le32(le32_to_cpu(cp->cp_flags) & ~(1UL << NILFS_CHECKPOINT_ ##flag)); \
25449f525c47bd383cd6a87db8f067cddb3ab620d17Christopher Ferris} static inline int nilfs_checkpoint_ ##name(const struct nilfs_checkpoint * cp) \
25549f525c47bd383cd6a87db8f067cddb3ab620d17Christopher Ferris{ return ! ! (le32_to_cpu(cp->cp_flags) & (1UL << NILFS_CHECKPOINT_ ##flag)); \
25649f525c47bd383cd6a87db8f067cddb3ab620d17Christopher Ferris}
25749f525c47bd383cd6a87db8f067cddb3ab620d17Christopher Ferris#define NILFS_CPFILE_FIRST_CHECKPOINT_OFFSET ((sizeof(struct nilfs_cpfile_header) + sizeof(struct nilfs_checkpoint) - 1) / sizeof(struct nilfs_checkpoint))
25849f525c47bd383cd6a87db8f067cddb3ab620d17Christopher Ferrisstruct nilfs_segment_usage {
25949f525c47bd383cd6a87db8f067cddb3ab620d17Christopher Ferris  __le64 su_lastmod;
26049f525c47bd383cd6a87db8f067cddb3ab620d17Christopher Ferris  __le32 su_nblocks;
26149f525c47bd383cd6a87db8f067cddb3ab620d17Christopher Ferris  __le32 su_flags;
26249f525c47bd383cd6a87db8f067cddb3ab620d17Christopher Ferris};
26349f525c47bd383cd6a87db8f067cddb3ab620d17Christopher Ferris#define NILFS_MIN_SEGMENT_USAGE_SIZE 16
26449f525c47bd383cd6a87db8f067cddb3ab620d17Christopher Ferrisenum {
26549f525c47bd383cd6a87db8f067cddb3ab620d17Christopher Ferris  NILFS_SEGMENT_USAGE_ACTIVE,
26649f525c47bd383cd6a87db8f067cddb3ab620d17Christopher Ferris  NILFS_SEGMENT_USAGE_DIRTY,
26749f525c47bd383cd6a87db8f067cddb3ab620d17Christopher Ferris  NILFS_SEGMENT_USAGE_ERROR,
26849f525c47bd383cd6a87db8f067cddb3ab620d17Christopher Ferris};
26949f525c47bd383cd6a87db8f067cddb3ab620d17Christopher Ferris#define NILFS_SEGMENT_USAGE_FNS(flag,name) static inline void nilfs_segment_usage_set_ ##name(struct nilfs_segment_usage * su) \
27049f525c47bd383cd6a87db8f067cddb3ab620d17Christopher Ferris{ su->su_flags = cpu_to_le32(le32_to_cpu(su->su_flags) | (1UL << NILFS_SEGMENT_USAGE_ ##flag)); \
27149f525c47bd383cd6a87db8f067cddb3ab620d17Christopher Ferris} static inline void nilfs_segment_usage_clear_ ##name(struct nilfs_segment_usage * su) \
27249f525c47bd383cd6a87db8f067cddb3ab620d17Christopher Ferris{ su->su_flags = cpu_to_le32(le32_to_cpu(su->su_flags) & ~(1UL << NILFS_SEGMENT_USAGE_ ##flag)); \
27349f525c47bd383cd6a87db8f067cddb3ab620d17Christopher Ferris} static inline int nilfs_segment_usage_ ##name(const struct nilfs_segment_usage * su) \
27449f525c47bd383cd6a87db8f067cddb3ab620d17Christopher Ferris{ return ! ! (le32_to_cpu(su->su_flags) & (1UL << NILFS_SEGMENT_USAGE_ ##flag)); \
27549f525c47bd383cd6a87db8f067cddb3ab620d17Christopher Ferris}
27649f525c47bd383cd6a87db8f067cddb3ab620d17Christopher Ferrisstruct nilfs_sufile_header {
27749f525c47bd383cd6a87db8f067cddb3ab620d17Christopher Ferris  __le64 sh_ncleansegs;
27849f525c47bd383cd6a87db8f067cddb3ab620d17Christopher Ferris  __le64 sh_ndirtysegs;
27949f525c47bd383cd6a87db8f067cddb3ab620d17Christopher Ferris  __le64 sh_last_alloc;
28049f525c47bd383cd6a87db8f067cddb3ab620d17Christopher Ferris};
28149f525c47bd383cd6a87db8f067cddb3ab620d17Christopher Ferris#define NILFS_SUFILE_FIRST_SEGMENT_USAGE_OFFSET ((sizeof(struct nilfs_sufile_header) + sizeof(struct nilfs_segment_usage) - 1) / sizeof(struct nilfs_segment_usage))
28249f525c47bd383cd6a87db8f067cddb3ab620d17Christopher Ferris#endif
283