Whamcloud - gitweb
tst_libext2fs: Avoid multiple definition of global variables
[tools/e2fsprogs.git] / lib / ext2fs / ext2_fs.h
index 9fd59e3..d31891c 100644 (file)
 
 #include <ext2fs/ext2_types.h>         /* Changed from linux/types.h */
 
+#ifndef __GNUC_PREREQ
+#if defined(__GNUC__) && defined(__GNUC_MINOR__)
+#define __GNUC_PREREQ(maj, min) \
+       ((__GNUC__ << 16) + __GNUC_MINOR__ >= ((maj) << 16) + (min))
+#else
+#define __GNUC_PREREQ(maj, min) 0
+#endif
+#endif
+
 /*
  * The second extended filesystem constants/structures
  */
@@ -321,6 +330,7 @@ struct ext2_dx_tail {
 #define EXT2_TOPDIR_FL                 0x00020000 /* Top of directory hierarchies*/
 #define EXT4_HUGE_FILE_FL               0x00040000 /* Set to each huge file */
 #define EXT4_EXTENTS_FL                0x00080000 /* Inode uses extents */
+#define EXT4_VERITY_FL                 0x00100000 /* Verity protected inode */
 #define EXT4_EA_INODE_FL               0x00200000 /* Inode used for large EA */
 /* EXT4_EOFBLOCKS_FL 0x00400000 was here */
 #define FS_NOCOW_FL                    0x00800000 /* Do not cow file */
@@ -329,10 +339,11 @@ struct ext2_dx_tail {
 #define EXT4_SNAPFILE_SHRUNK_FL                0x08000000  /* Snapshot shrink has completed */
 #define EXT4_INLINE_DATA_FL            0x10000000 /* Inode has inline data */
 #define EXT4_PROJINHERIT_FL            0x20000000 /* Create with parents projid */
+#define EXT4_CASEFOLD_FL               0x40000000 /* Casefolded file */
 #define EXT2_RESERVED_FL               0x80000000 /* reserved for ext2 lib */
 
-#define EXT2_FL_USER_VISIBLE           0x204BDFFF /* User visible flags */
-#define EXT2_FL_USER_MODIFIABLE                0x204B80FF /* User modifiable flags */
+#define EXT2_FL_USER_VISIBLE           0x604BDFFF /* User visible flags */
+#define EXT2_FL_USER_MODIFIABLE                0x604B80FF /* User modifiable flags */
 
 /*
  * ioctl commands
@@ -671,8 +682,8 @@ struct ext2_super_block {
 /*060*/        __u32   s_feature_incompat;     /* incompatible feature set */
        __u32   s_feature_ro_compat;    /* readonly-compatible feature set */
 /*068*/        __u8    s_uuid[16];             /* 128-bit uuid for volume */
-/*078*/        char    s_volume_name[EXT2_LABEL_LEN];  /* volume name */
-/*088*/        char    s_last_mounted[64];     /* directory where last mounted */
+/*078*/        __u8    s_volume_name[EXT2_LABEL_LEN];  /* volume name, no NUL? */
+/*088*/        __u8    s_last_mounted[64];     /* directory last mounted on, no NUL? */
 /*0c8*/        __u32   s_algorithm_usage_bitmap; /* For compression */
        /*
         * Performance hints.  Directory preallocation should only
@@ -720,15 +731,15 @@ struct ext2_super_block {
        __u32   s_first_error_time;     /* first time an error happened */
        __u32   s_first_error_ino;      /* inode involved in first error */
 /*1a0*/        __u64   s_first_error_block;    /* block involved in first error */
-       __u8    s_first_error_func[32]; /* function where the error happened */
+       __u8    s_first_error_func[32]; /* function where error hit, no NUL? */
 /*1c8*/        __u32   s_first_error_line;     /* line number where error happened */
        __u32   s_last_error_time;      /* most recent time of an error */
 /*1d0*/        __u32   s_last_error_ino;       /* inode involved in last error */
        __u32   s_last_error_line;      /* line number where error happened */
        __u64   s_last_error_block;     /* block involved of last error */
-/*1e0*/        __u8    s_last_error_func[32];  /* function where the error happened */
+/*1e0*/        __u8    s_last_error_func[32];  /* function where error hit, no NUL? */
 #define EXT4_S_ERR_END ext4_offsetof(struct ext2_super_block, s_mount_opts)
-/*200*/        __u8    s_mount_opts[64];
+/*200*/        __u8    s_mount_opts[64];       /* default mount options, no NUL? */
 /*240*/        __u32   s_usr_quota_inum;       /* inode number of user quota file */
        __u32   s_grp_quota_inum;       /* inode number of group quota file */
        __u32   s_overhead_blocks;      /* overhead blocks/clusters in fs */
@@ -738,11 +749,21 @@ struct ext2_super_block {
 /*268*/        __le32  s_lpf_ino;              /* Location of the lost+found inode */
        __le32  s_prj_quota_inum;       /* inode for tracking project quota */
 /*270*/        __le32  s_checksum_seed;        /* crc32c(orig_uuid) if csum_seed set */
-       __le32  s_reserved[98];         /* Padding to the end of the block */
+/*274*/        __u8    s_wtime_hi;
+       __u8    s_mtime_hi;
+       __u8    s_mkfs_time_hi;
+       __u8    s_lastcheck_hi;
+       __u8    s_first_error_time_hi;
+       __u8    s_last_error_time_hi;
+       __u8    s_pad[2];
+/*27c*/ __le16 s_encoding;             /* Filename charset encoding */
+       __le16  s_encoding_flags;       /* Filename charset encoding flags */
+       __le32  s_reserved[95];         /* Padding to the end of the block */
 /*3fc*/        __u32   s_checksum;             /* crc32c(superblock) */
 };
 
 #define EXT4_S_ERR_LEN (EXT4_S_ERR_END - EXT4_S_ERR_START)
+#define EXT2_LEN_STR(buf) (int)sizeof(buf), (char *)buf
 
 /*
  * Codes for operating systems
@@ -790,6 +811,7 @@ struct ext2_super_block {
 /* #define EXT2_FEATURE_COMPAT_EXCLUDE_INODE   0x0080 not used, legacy */
 #define EXT2_FEATURE_COMPAT_EXCLUDE_BITMAP     0x0100
 #define EXT4_FEATURE_COMPAT_SPARSE_SUPER2      0x0200
+#define EXT4_FEATURE_COMPAT_FAST_COMMIT                0x0400
 
 
 #define EXT2_FEATURE_RO_COMPAT_SPARSE_SUPER    0x0001
@@ -812,7 +834,7 @@ struct ext2_super_block {
 #define EXT4_FEATURE_RO_COMPAT_READONLY                0x1000
 #define EXT4_FEATURE_RO_COMPAT_PROJECT         0x2000 /* Project quota */
 #define EXT4_FEATURE_RO_COMPAT_SHARED_BLOCKS   0x4000
-
+#define EXT4_FEATURE_RO_COMPAT_VERITY          0x8000
 
 #define EXT2_FEATURE_INCOMPAT_COMPRESSION      0x0001
 #define EXT2_FEATURE_INCOMPAT_FILETYPE         0x0002
@@ -829,6 +851,7 @@ struct ext2_super_block {
 #define EXT4_FEATURE_INCOMPAT_LARGEDIR         0x4000 /* >2GB or 3-lvl htree */
 #define EXT4_FEATURE_INCOMPAT_INLINE_DATA      0x8000 /* data in inode */
 #define EXT4_FEATURE_INCOMPAT_ENCRYPT          0x10000
+#define EXT4_FEATURE_INCOMPAT_CASEFOLD         0x20000
 
 #define EXT4_FEATURE_COMPAT_FUNCS(name, ver, flagname) \
 static inline int ext2fs_has_feature_##name(struct ext2_super_block *sb) \
@@ -890,6 +913,7 @@ EXT4_FEATURE_COMPAT_FUNCS(dir_index,                2, DIR_INDEX)
 EXT4_FEATURE_COMPAT_FUNCS(lazy_bg,             2, LAZY_BG)
 EXT4_FEATURE_COMPAT_FUNCS(exclude_bitmap,      2, EXCLUDE_BITMAP)
 EXT4_FEATURE_COMPAT_FUNCS(sparse_super2,       4, SPARSE_SUPER2)
+EXT4_FEATURE_COMPAT_FUNCS(fast_commit,         4, FAST_COMMIT)
 
 EXT4_FEATURE_RO_COMPAT_FUNCS(sparse_super,     2, SPARSE_SUPER)
 EXT4_FEATURE_RO_COMPAT_FUNCS(large_file,       2, LARGE_FILE)
@@ -905,6 +929,7 @@ EXT4_FEATURE_RO_COMPAT_FUNCS(replica,               4, REPLICA)
 EXT4_FEATURE_RO_COMPAT_FUNCS(readonly,         4, READONLY)
 EXT4_FEATURE_RO_COMPAT_FUNCS(project,          4, PROJECT)
 EXT4_FEATURE_RO_COMPAT_FUNCS(shared_blocks,    4, SHARED_BLOCKS)
+EXT4_FEATURE_RO_COMPAT_FUNCS(verity,           4, VERITY)
 
 EXT4_FEATURE_INCOMPAT_FUNCS(compression,       2, COMPRESSION)
 EXT4_FEATURE_INCOMPAT_FUNCS(filetype,          2, FILETYPE)
@@ -921,6 +946,7 @@ EXT4_FEATURE_INCOMPAT_FUNCS(csum_seed,              4, CSUM_SEED)
 EXT4_FEATURE_INCOMPAT_FUNCS(largedir,          4, LARGEDIR)
 EXT4_FEATURE_INCOMPAT_FUNCS(inline_data,       4, INLINE_DATA)
 EXT4_FEATURE_INCOMPAT_FUNCS(encrypt,           4, ENCRYPT)
+EXT4_FEATURE_INCOMPAT_FUNCS(casefold,          4, CASEFOLD)
 
 #define EXT2_FEATURE_COMPAT_SUPP       0
 #define EXT2_FEATURE_INCOMPAT_SUPP    (EXT2_FEATURE_INCOMPAT_FILETYPE| \
@@ -930,7 +956,8 @@ EXT4_FEATURE_INCOMPAT_FUNCS(encrypt,                4, ENCRYPT)
 #define EXT2_FEATURE_RO_COMPAT_SUPP    (EXT2_FEATURE_RO_COMPAT_SPARSE_SUPER| \
                                         EXT2_FEATURE_RO_COMPAT_LARGE_FILE| \
                                         EXT4_FEATURE_RO_COMPAT_DIR_NLINK| \
-                                        EXT2_FEATURE_RO_COMPAT_BTREE_DIR)
+                                        EXT2_FEATURE_RO_COMPAT_BTREE_DIR| \
+                                        EXT4_FEATURE_RO_COMPAT_VERITY)
 
 /*
  * Default values for user and/or group using reserved blocks
@@ -1070,9 +1097,9 @@ struct ext2_dir_entry_tail {
 struct mmp_struct {
        __u32   mmp_magic;              /* Magic number for MMP */
        __u32   mmp_seq;                /* Sequence no. updated periodically */
-       __u64   mmp_time;               /* Time last updated */
-       char    mmp_nodename[64];       /* Node which last updated MMP block */
-       char    mmp_bdevname[32];       /* Bdev which last updated MMP block */
+       __u64   mmp_time;               /* Time last updated (seconds) */
+       __u8    mmp_nodename[64];       /* Node updating MMP block, no NUL? */
+       __u8    mmp_bdevname[32];       /* Bdev updating MMP block, no NUL? */
        __u16   mmp_check_interval;     /* Changed mmp_check_interval */
        __u16   mmp_pad1;
        __u32   mmp_pad2[226];
@@ -1104,4 +1131,8 @@ struct mmp_struct {
  */
 #define EXT4_INLINE_DATA_DOTDOT_SIZE   (4)
 
+#define EXT4_ENC_UTF8_12_1     1
+
+#define EXT4_ENC_STRICT_MODE_FL                        (1 << 0) /* Reject invalid sequences */
+
 #endif /* _LINUX_EXT2_FS_H */