Whamcloud - gitweb
Fix gcc -Wall warnings in libuuid
[tools/e2fsprogs.git] / lib / ext2fs / ext2_fs.h
index 81bd190..bba5be8 100644 (file)
@@ -173,6 +173,7 @@ struct ext4_group_desc
 
 #define EXT2_BG_INODE_UNINIT   0x0001 /* Inode table/bitmap not initialized */
 #define EXT2_BG_BLOCK_UNINIT   0x0002 /* Block bitmap not initialized */
+#define EXT2_BG_INODE_ZEROED   0x0004 /* On-disk itable initialized to zero */
 
 /*
  * Data structures used by the directory indexing feature
@@ -217,6 +218,13 @@ struct ext2_dx_countlimit {
 /*
  * Macro-instructions used to manage group descriptors
  */
+#define EXT2_MIN_DESC_SIZE             32
+#define EXT2_MIN_DESC_SIZE_64BIT       64
+#define EXT2_MAX_DESC_SIZE             EXT2_MIN_BLOCK_SIZE
+#define EXT2_DESC_SIZE(s)                                                \
+       ((EXT2_SB(s)->s_feature_incompat & EXT4_FEATURE_INCOMPAT_64BIT) ? \
+       (s)->s_desc_size : EXT2_MIN_DESC_SIZE)
+
 #define EXT2_BLOCKS_PER_GROUP(s)       (EXT2_SB(s)->s_blocks_per_group)
 #define EXT2_INODES_PER_GROUP(s)       (EXT2_SB(s)->s_inodes_per_group)
 #define EXT2_INODES_PER_BLOCK(s)       (EXT2_BLOCK_SIZE(s)/EXT2_INODE_SIZE(s))
@@ -227,7 +235,7 @@ struct ext2_dx_countlimit {
 #define EXT2_DESC_PER_BLOCK(s)         (EXT2_SB(s)->s_desc_per_block)
 #define EXT2_DESC_PER_BLOCK_BITS(s)    (EXT2_SB(s)->s_desc_per_block_bits)
 #else
-#define EXT2_DESC_PER_BLOCK(s)         (EXT2_BLOCK_SIZE(s) / sizeof (struct ext2_group_desc))
+#define EXT2_DESC_PER_BLOCK(s)         (EXT2_BLOCK_SIZE(s) / EXT2_DESC_SIZE(s))
 #endif
 
 /*
@@ -263,6 +271,7 @@ struct ext2_dx_countlimit {
 #define EXT2_NOTAIL_FL                 0x00008000 /* file tail should not be merged */
 #define EXT2_DIRSYNC_FL                0x00010000 /* Synchronous directory modifications */
 #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 EXT2_RESERVED_FL               0x80000000 /* reserved for ext2 lib */
 
@@ -284,6 +293,10 @@ struct ext2_new_group_input {
        __u16 unused;           /* Number of reserved GDT blocks in group */
 };
 
+#ifdef __GNU__                 /* Needed for the Hurd */
+#define _IOT_ext2_new_group_input _IOT (_IOTS(__u32), 5, _IOTS(__u16), 2, 0, 0)
+#endif
+
 #define EXT2_IOC_GETFLAGS              _IOR('f', 1, long)
 #define EXT2_IOC_SETFLAGS              _IOW('f', 2, long)
 #define EXT2_IOC_GETVERSION            _IOR('v', 1, long)
@@ -315,9 +328,6 @@ struct ext2_inode {
                struct {
                        __u32  h_i_translator;
                } hurd1;
-               struct {
-                       __u32  m_i_reserved1;
-               } masix1;
        } osd1;                         /* OS dependent 1 */
        __u32   i_block[EXT2_N_BLOCKS];/* Pointers to blocks */
        __u32   i_generation;   /* File version (for NFS) */
@@ -327,7 +337,7 @@ struct ext2_inode {
        union {
                struct {
                        __u16   l_i_blocks_hi;
-                       __u16   i_pad1;
+                       __u16   l_i_file_acl_high;
                        __u16   l_i_uid_high;   /* these 2 fields    */
                        __u16   l_i_gid_high;   /* were reserved2[0] */
                        __u32   l_i_reserved2;
@@ -340,12 +350,6 @@ struct ext2_inode {
                        __u16   h_i_gid_high;
                        __u32   h_i_author;
                } hurd2;
-               struct {
-                       __u8    m_i_frag;       /* Fragment number */
-                       __u8    m_i_fsize;      /* Fragment size */
-                       __u16   m_pad1;
-                       __u32   m_i_reserved2[2];
-               } masix2;
        } osd2;                         /* OS dependent 2 */
 };
 
@@ -371,9 +375,6 @@ struct ext2_inode_large {
                struct {
                        __u32  h_i_translator;
                } hurd1;
-               struct {
-                       __u32  m_i_reserved1;
-               } masix1;
        } osd1;                         /* OS dependent 1 */
        __u32   i_block[EXT2_N_BLOCKS];/* Pointers to blocks */
        __u32   i_generation;   /* File version (for NFS) */
@@ -383,7 +384,7 @@ struct ext2_inode_large {
        union {
                struct {
                        __u16   l_i_blocks_hi;
-                       __u16   i_pad1;
+                       __u16   l_i_file_acl_high;
                        __u16   l_i_uid_high;   /* these 2 fields    */
                        __u16   l_i_gid_high;   /* were reserved2[0] */
                        __u32   l_i_reserved2;
@@ -396,12 +397,6 @@ struct ext2_inode_large {
                        __u16   h_i_gid_high;
                        __u32   h_i_author;
                } hurd2;
-               struct {
-                       __u8    m_i_frag;       /* Fragment number */
-                       __u8    m_i_fsize;      /* Fragment size */
-                       __u16   m_pad1;
-                       __u32   m_i_reserved2[2];
-               } masix2;
        } osd2;                         /* OS dependent 2 */
        __u16   i_extra_isize;
        __u16   i_pad1;
@@ -410,6 +405,7 @@ struct ext2_inode_large {
        __u32   i_atime_extra;  /* extra Access time (nsec << 2 | epoch) */
        __u32   i_crtime;       /* File creation time */
        __u32   i_crtime_extra; /* extra File creation time (nsec << 2 | epoch)*/
+       __u32   i_version_hi;   /* high 32 bits for 64-bit version */
 };
 
 #define i_size_high    i_dir_acl
@@ -423,8 +419,6 @@ struct ext2_inode_large {
 #define i_uid_high     osd2.linux2.l_i_uid_high
 #define i_gid_high     osd2.linux2.l_i_gid_high
 #define i_reserved2    osd2.linux2.l_i_reserved2
-#define inode_uid(inode)       ((inode).i_uid | (inode).i_uid_high << 16)
-#define inode_gid(inode)       ((inode).i_gid | (inode).i_gid_high << 16)
 #else
 #if defined(__GNU__)
 
@@ -434,34 +428,28 @@ struct ext2_inode_large {
 #define i_uid_high     osd2.hurd2.h_i_uid_high
 #define i_gid_high     osd2.hurd2.h_i_gid_high
 #define i_author       osd2.hurd2.h_i_author
-#define inode_uid(inode)       ((inode).i_uid | (inode).i_uid_high << 16)
-#define inode_gid(inode)       ((inode).i_gid | (inode).i_gid_high << 16)
-
-#else
-#if defined(__masix__)
 
-#define i_reserved1    osd1.masix1.m_i_reserved1
-#define i_frag         osd2.masix2.m_i_frag
-#define i_fsize                osd2.masix2.m_i_fsize
-#define i_reserved2    osd2.masix2.m_i_reserved2
-#define inode_uid(inode)       ((inode).i_uid)
-#define inode_gid(inode)       ((inode).i_gid)
-
-#endif  /* __masix__ */
 #endif  /* __GNU__ */
 #endif /* defined(__KERNEL__) || defined(__linux__) */
 
+#define inode_uid(inode)       ((inode).i_uid | (inode).osd2.linux2.l_i_uid_high << 16)
+#define inode_gid(inode)       ((inode).i_gid | (inode).osd2.linux2.l_i_gid_high << 16)
+#define ext2fs_set_i_uid_high(inode,x) ((inode).osd2.linux2.l_i_uid_high = (x))
+#define ext2fs_set_i_gid_high(inode,x) ((inode).osd2.linux2.l_i_gid_high = (x))
+
 /*
  * File system states
  */
 #define EXT2_VALID_FS                  0x0001  /* Unmounted cleanly */
 #define EXT2_ERROR_FS                  0x0002  /* Errors detected */
+#define EXT3_ORPHAN_FS                 0x0004  /* Orphans being recovered */
 
 /*
  * Misc. filesystem flags
  */
 #define EXT2_FLAGS_SIGNED_HASH         0x0001  /* Signed dirhash in use */
 #define EXT2_FLAGS_UNSIGNED_HASH       0x0002  /* Unsigned dirhash in use */
+#define EXT2_FLAGS_TEST_FILESYS                0x0004  /* OK for use on development code */
 
 /*
  * Mount flags
@@ -576,7 +564,11 @@ struct ext2_super_block {
        __u16   s_raid_stride;          /* RAID stride */
        __u16   s_mmp_interval;         /* # seconds to wait in MMP checking */
        __u64   s_mmp_block;            /* Block for multi-mount protection */
-       __u32   s_reserved[164];        /* Padding to the end of the block */
+       __u32   s_raid_stripe_width;    /* blocks on all data disks (N*stride)*/
+       __u8    s_log_groups_per_flex;  /* FLEX_BG group size */
+       __u8    s_reserved_char_pad;
+       __u16   s_reserved_pad;         /* Padding to next 32bits */
+       __u32   s_reserved[162];        /* Padding to the end of the block */
 };
 
 /*
@@ -584,7 +576,7 @@ struct ext2_super_block {
  */
 #define EXT2_OS_LINUX          0
 #define EXT2_OS_HURD           1
-#define EXT2_OS_MASIX          2
+#define EXT2_OBSO_OS_MASIX     2
 #define EXT2_OS_FREEBSD                3
 #define EXT2_OS_LITES          4
 
@@ -639,12 +631,14 @@ struct ext2_super_block {
 #define EXT3_FEATURE_INCOMPAT_EXTENTS          0x0040
 #define EXT4_FEATURE_INCOMPAT_64BIT            0x0080
 #define EXT4_FEATURE_INCOMPAT_MMP              0x0100
+#define EXT4_FEATURE_INCOMPAT_FLEX_BG          0x0200
 
 
 #define EXT2_FEATURE_COMPAT_SUPP       0
 #define EXT2_FEATURE_INCOMPAT_SUPP     (EXT2_FEATURE_INCOMPAT_FILETYPE)
 #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)
 
 /*