os/linux-2.6-tag--devboard-R2_10-4/include/linux/ext2_fs.h

Go to the documentation of this file.
00001 /*
00002  *  linux/include/linux/ext2_fs.h
00003  *
00004  * Copyright (C) 1992, 1993, 1994, 1995
00005  * Remy Card (card@masi.ibp.fr)
00006  * Laboratoire MASI - Institut Blaise Pascal
00007  * Universite Pierre et Marie Curie (Paris VI)
00008  *
00009  *  from
00010  *
00011  *  linux/include/linux/minix_fs.h
00012  *
00013  *  Copyright (C) 1991, 1992  Linus Torvalds
00014  */
00015 
00016 #ifndef _LINUX_EXT2_FS_H
00017 #define _LINUX_EXT2_FS_H
00018 
00019 #include <linux/types.h>
00020 #include <linux/magic.h>
00021 
00022 #if defined(CONFIG_ETRAX_ARCH_V32) || defined(CONFIG_ETRAX_ARCH_V10)
00023 #include <asm-generic/bitops/ext2-non-atomic.h>
00024 #endif
00025 
00026 /*
00027  * The second extended filesystem constants/structures
00028  */
00029 
00030 /*
00031  * Define EXT2FS_DEBUG to produce debug messages
00032  */
00033 #undef EXT2FS_DEBUG
00034 
00035 /*
00036  * Define EXT2_PREALLOCATE to preallocate data blocks for expanding files
00037  */
00038 #define EXT2_PREALLOCATE
00039 #define EXT2_DEFAULT_PREALLOC_BLOCKS    8
00040 
00041 /*
00042  * The second extended file system version
00043  */
00044 #define EXT2FS_DATE             "95/08/09"
00045 #define EXT2FS_VERSION          "0.5b"
00046 
00047 /*
00048  * Debug code
00049  */
00050 #ifdef EXT2FS_DEBUG
00051 #       define ext2_debug(f, a...)      { \
00052                                         printk ("EXT2-fs DEBUG (%s, %d): %s:", \
00053                                                 __FILE__, __LINE__, __FUNCTION__); \
00054                                         printk (f, ## a); \
00055                                         }
00056 #else
00057 #       define ext2_debug(f, a...)      
00058 #endif
00059 
00060 /*
00061  * Special inode numbers
00062  */
00063 #define EXT2_BAD_INO             1      /* Bad blocks inode */
00064 #define EXT2_ROOT_INO            2      /* Root inode */
00065 #define EXT2_BOOT_LOADER_INO     5      /* Boot loader inode */
00066 #define EXT2_UNDEL_DIR_INO       6      /* Undelete directory inode */
00067 
00068 /* First non-reserved inode for old ext2 filesystems */
00069 #define EXT2_GOOD_OLD_FIRST_INO 11
00070 
00071 #ifdef __KERNEL__
00072 #include <linux/ext2_fs_sb.h>
00073 static inline struct ext2_sb_info *EXT2_SB(struct super_block *sb)
00074 {
00075         return sb->s_fs_info;
00076 }
00077 #else
00078 /* Assume that user mode programs are passing in an ext2fs superblock, not
00079  * a kernel struct super_block.  This will allow us to call the feature-test
00080  * macros from user land. */
00081 #define EXT2_SB(sb)     (sb)
00082 #endif
00083 
00084 /*
00085  * Maximal count of links to a file
00086  */
00087 #define EXT2_LINK_MAX           32000
00088 
00089 /*
00090  * Macro-instructions used to manage several block sizes
00091  */
00092 #define EXT2_MIN_BLOCK_SIZE             1024
00093 #define EXT2_MAX_BLOCK_SIZE             4096
00094 #define EXT2_MIN_BLOCK_LOG_SIZE           10
00095 #ifdef __KERNEL__
00096 # define EXT2_BLOCK_SIZE(s)             ((s)->s_blocksize)
00097 #else
00098 # define EXT2_BLOCK_SIZE(s)             (EXT2_MIN_BLOCK_SIZE << (s)->s_log_block_size)
00099 #endif
00100 #define EXT2_ADDR_PER_BLOCK(s)          (EXT2_BLOCK_SIZE(s) / sizeof (__u32))
00101 #ifdef __KERNEL__
00102 # define EXT2_BLOCK_SIZE_BITS(s)        ((s)->s_blocksize_bits)
00103 #else
00104 # define EXT2_BLOCK_SIZE_BITS(s)        ((s)->s_log_block_size + 10)
00105 #endif
00106 #ifdef __KERNEL__
00107 #define EXT2_ADDR_PER_BLOCK_BITS(s)     (EXT2_SB(s)->s_addr_per_block_bits)
00108 #define EXT2_INODE_SIZE(s)              (EXT2_SB(s)->s_inode_size)
00109 #define EXT2_FIRST_INO(s)               (EXT2_SB(s)->s_first_ino)
00110 #else
00111 #define EXT2_INODE_SIZE(s)      (((s)->s_rev_level == EXT2_GOOD_OLD_REV) ? \
00112                                  EXT2_GOOD_OLD_INODE_SIZE : \
00113                                  (s)->s_inode_size)
00114 #define EXT2_FIRST_INO(s)       (((s)->s_rev_level == EXT2_GOOD_OLD_REV) ? \
00115                                  EXT2_GOOD_OLD_FIRST_INO : \
00116                                  (s)->s_first_ino)
00117 #endif
00118 
00119 /*
00120  * Macro-instructions used to manage fragments
00121  */
00122 #define EXT2_MIN_FRAG_SIZE              1024
00123 #define EXT2_MAX_FRAG_SIZE              4096
00124 #define EXT2_MIN_FRAG_LOG_SIZE            10
00125 #ifdef __KERNEL__
00126 # define EXT2_FRAG_SIZE(s)              (EXT2_SB(s)->s_frag_size)
00127 # define EXT2_FRAGS_PER_BLOCK(s)        (EXT2_SB(s)->s_frags_per_block)
00128 #else
00129 # define EXT2_FRAG_SIZE(s)              (EXT2_MIN_FRAG_SIZE << (s)->s_log_frag_size)
00130 # define EXT2_FRAGS_PER_BLOCK(s)        (EXT2_BLOCK_SIZE(s) / EXT2_FRAG_SIZE(s))
00131 #endif
00132 
00133 /*
00134  * Structure of a blocks group descriptor
00135  */
00136 struct ext2_group_desc
00137 {
00138         __le32  bg_block_bitmap;                /* Blocks bitmap block */
00139         __le32  bg_inode_bitmap;                /* Inodes bitmap block */
00140         __le32  bg_inode_table;         /* Inodes table block */
00141         __le16  bg_free_blocks_count;   /* Free blocks count */
00142         __le16  bg_free_inodes_count;   /* Free inodes count */
00143         __le16  bg_used_dirs_count;     /* Directories count */
00144         __le16  bg_pad;
00145         __le32  bg_reserved[3];
00146 };
00147 
00148 /*
00149  * Macro-instructions used to manage group descriptors
00150  */
00151 #ifdef __KERNEL__
00152 # define EXT2_BLOCKS_PER_GROUP(s)       (EXT2_SB(s)->s_blocks_per_group)
00153 # define EXT2_DESC_PER_BLOCK(s)         (EXT2_SB(s)->s_desc_per_block)
00154 # define EXT2_INODES_PER_GROUP(s)       (EXT2_SB(s)->s_inodes_per_group)
00155 # define EXT2_DESC_PER_BLOCK_BITS(s)    (EXT2_SB(s)->s_desc_per_block_bits)
00156 #else
00157 # define EXT2_BLOCKS_PER_GROUP(s)       ((s)->s_blocks_per_group)
00158 # define EXT2_DESC_PER_BLOCK(s)         (EXT2_BLOCK_SIZE(s) / sizeof (struct ext2_group_desc))
00159 # define EXT2_INODES_PER_GROUP(s)       ((s)->s_inodes_per_group)
00160 #endif
00161 
00162 /*
00163  * Constants relative to the data blocks
00164  */
00165 #define EXT2_NDIR_BLOCKS                12
00166 #define EXT2_IND_BLOCK                  EXT2_NDIR_BLOCKS
00167 #define EXT2_DIND_BLOCK                 (EXT2_IND_BLOCK + 1)
00168 #define EXT2_TIND_BLOCK                 (EXT2_DIND_BLOCK + 1)
00169 #define EXT2_N_BLOCKS                   (EXT2_TIND_BLOCK + 1)
00170 
00171 /*
00172  * Inode flags (GETFLAGS/SETFLAGS)
00173  */
00174 #define EXT2_SECRM_FL                   FS_SECRM_FL     /* Secure deletion */
00175 #define EXT2_UNRM_FL                    FS_UNRM_FL      /* Undelete */
00176 #define EXT2_COMPR_FL                   FS_COMPR_FL     /* Compress file */
00177 #define EXT2_SYNC_FL                    FS_SYNC_FL      /* Synchronous updates */
00178 #define EXT2_IMMUTABLE_FL               FS_IMMUTABLE_FL /* Immutable file */
00179 #define EXT2_APPEND_FL                  FS_APPEND_FL    /* writes to file may only append */
00180 #define EXT2_NODUMP_FL                  FS_NODUMP_FL    /* do not dump file */
00181 #define EXT2_NOATIME_FL                 FS_NOATIME_FL   /* do not update atime */
00182 /* Reserved for compression usage... */
00183 #define EXT2_DIRTY_FL                   FS_DIRTY_FL
00184 #define EXT2_COMPRBLK_FL                FS_COMPRBLK_FL  /* One or more compressed clusters */
00185 #define EXT2_NOCOMP_FL                  FS_NOCOMP_FL    /* Don't compress */
00186 #define EXT2_ECOMPR_FL                  FS_ECOMPR_FL    /* Compression error */
00187 /* End compression flags --- maybe not all used */      
00188 #define EXT2_BTREE_FL                   FS_BTREE_FL     /* btree format dir */
00189 #define EXT2_INDEX_FL                   FS_INDEX_FL     /* hash-indexed directory */
00190 #define EXT2_IMAGIC_FL                  FS_IMAGIC_FL    /* AFS directory */
00191 #define EXT2_JOURNAL_DATA_FL            FS_JOURNAL_DATA_FL /* Reserved for ext3 */
00192 #define EXT2_NOTAIL_FL                  FS_NOTAIL_FL    /* file tail should not be merged */
00193 #define EXT2_DIRSYNC_FL                 FS_DIRSYNC_FL   /* dirsync behaviour (directories only) */
00194 #define EXT2_TOPDIR_FL                  FS_TOPDIR_FL    /* Top of directory hierarchies*/
00195 #define EXT2_RESERVED_FL                FS_RESERVED_FL  /* reserved for ext2 lib */
00196 
00197 #define EXT2_FL_USER_VISIBLE            FS_FL_USER_VISIBLE      /* User visible flags */
00198 #define EXT2_FL_USER_MODIFIABLE         FS_FL_USER_MODIFIABLE   /* User modifiable flags */
00199 
00200 /*
00201  * ioctl commands
00202  */
00203 #define EXT2_IOC_GETFLAGS               FS_IOC_GETFLAGS
00204 #define EXT2_IOC_SETFLAGS               FS_IOC_SETFLAGS
00205 #define EXT2_IOC_GETVERSION             FS_IOC_GETVERSION
00206 #define EXT2_IOC_SETVERSION             FS_IOC_SETVERSION
00207 
00208 /*
00209  * ioctl commands in 32 bit emulation
00210  */
00211 #define EXT2_IOC32_GETFLAGS             FS_IOC32_GETFLAGS
00212 #define EXT2_IOC32_SETFLAGS             FS_IOC32_SETFLAGS
00213 #define EXT2_IOC32_GETVERSION           FS_IOC32_GETVERSION
00214 #define EXT2_IOC32_SETVERSION           FS_IOC32_SETVERSION
00215 
00216 /*
00217  * Structure of an inode on the disk
00218  */
00219 struct ext2_inode {
00220         __le16  i_mode;         /* File mode */
00221         __le16  i_uid;          /* Low 16 bits of Owner Uid */
00222         __le32  i_size;         /* Size in bytes */
00223         __le32  i_atime;        /* Access time */
00224         __le32  i_ctime;        /* Creation time */
00225         __le32  i_mtime;        /* Modification time */
00226         __le32  i_dtime;        /* Deletion Time */
00227         __le16  i_gid;          /* Low 16 bits of Group Id */
00228         __le16  i_links_count;  /* Links count */
00229         __le32  i_blocks;       /* Blocks count */
00230         __le32  i_flags;        /* File flags */
00231         union {
00232                 struct {
00233                         __le32  l_i_reserved1;
00234                 } linux1;
00235                 struct {
00236                         __le32  h_i_translator;
00237                 } hurd1;
00238                 struct {
00239                         __le32  m_i_reserved1;
00240                 } masix1;
00241         } osd1;                         /* OS dependent 1 */
00242         __le32  i_block[EXT2_N_BLOCKS];/* Pointers to blocks */
00243         __le32  i_generation;   /* File version (for NFS) */
00244         __le32  i_file_acl;     /* File ACL */
00245         __le32  i_dir_acl;      /* Directory ACL */
00246         __le32  i_faddr;        /* Fragment address */
00247         union {
00248                 struct {
00249                         __u8    l_i_frag;       /* Fragment number */
00250                         __u8    l_i_fsize;      /* Fragment size */
00251                         __u16   i_pad1;
00252                         __le16  l_i_uid_high;   /* these 2 fields    */
00253                         __le16  l_i_gid_high;   /* were reserved2[0] */
00254                         __u32   l_i_reserved2;
00255                 } linux2;
00256                 struct {
00257                         __u8    h_i_frag;       /* Fragment number */
00258                         __u8    h_i_fsize;      /* Fragment size */
00259                         __le16  h_i_mode_high;
00260                         __le16  h_i_uid_high;
00261                         __le16  h_i_gid_high;
00262                         __le32  h_i_author;
00263                 } hurd2;
00264                 struct {
00265                         __u8    m_i_frag;       /* Fragment number */
00266                         __u8    m_i_fsize;      /* Fragment size */
00267                         __u16   m_pad1;
00268                         __u32   m_i_reserved2[2];
00269                 } masix2;
00270         } osd2;                         /* OS dependent 2 */
00271 };
00272 
00273 #define i_size_high     i_dir_acl
00274 
00275 #if defined(__KERNEL__) || defined(__linux__)
00276 #define i_reserved1     osd1.linux1.l_i_reserved1
00277 #define i_frag          osd2.linux2.l_i_frag
00278 #define i_fsize         osd2.linux2.l_i_fsize
00279 #define i_uid_low       i_uid
00280 #define i_gid_low       i_gid
00281 #define i_uid_high      osd2.linux2.l_i_uid_high
00282 #define i_gid_high      osd2.linux2.l_i_gid_high
00283 #define i_reserved2     osd2.linux2.l_i_reserved2
00284 #endif
00285 
00286 #ifdef  __hurd__
00287 #define i_translator    osd1.hurd1.h_i_translator
00288 #define i_frag          osd2.hurd2.h_i_frag;
00289 #define i_fsize         osd2.hurd2.h_i_fsize;
00290 #define i_uid_high      osd2.hurd2.h_i_uid_high
00291 #define i_gid_high      osd2.hurd2.h_i_gid_high
00292 #define i_author        osd2.hurd2.h_i_author
00293 #endif
00294 
00295 #ifdef  __masix__
00296 #define i_reserved1     osd1.masix1.m_i_reserved1
00297 #define i_frag          osd2.masix2.m_i_frag
00298 #define i_fsize         osd2.masix2.m_i_fsize
00299 #define i_reserved2     osd2.masix2.m_i_reserved2
00300 #endif
00301 
00302 /*
00303  * File system states
00304  */
00305 #define EXT2_VALID_FS                   0x0001  /* Unmounted cleanly */
00306 #define EXT2_ERROR_FS                   0x0002  /* Errors detected */
00307 
00308 /*
00309  * Mount flags
00310  */
00311 #define EXT2_MOUNT_CHECK                0x000001  /* Do mount-time checks */
00312 #define EXT2_MOUNT_OLDALLOC             0x000002  /* Don't use the new Orlov allocator */
00313 #define EXT2_MOUNT_GRPID                0x000004  /* Create files with directory's group */
00314 #define EXT2_MOUNT_DEBUG                0x000008  /* Some debugging messages */
00315 #define EXT2_MOUNT_ERRORS_CONT          0x000010  /* Continue on errors */
00316 #define EXT2_MOUNT_ERRORS_RO            0x000020  /* Remount fs ro on errors */
00317 #define EXT2_MOUNT_ERRORS_PANIC         0x000040  /* Panic on errors */
00318 #define EXT2_MOUNT_MINIX_DF             0x000080  /* Mimics the Minix statfs */
00319 #define EXT2_MOUNT_NOBH                 0x000100  /* No buffer_heads */
00320 #define EXT2_MOUNT_NO_UID32             0x000200  /* Disable 32-bit UIDs */
00321 #define EXT2_MOUNT_XATTR_USER           0x004000  /* Extended user attributes */
00322 #define EXT2_MOUNT_POSIX_ACL            0x008000  /* POSIX Access Control Lists */
00323 #define EXT2_MOUNT_XIP                  0x010000  /* Execute in place */
00324 #define EXT2_MOUNT_USRQUOTA             0x020000 /* user quota */
00325 #define EXT2_MOUNT_GRPQUOTA             0x040000 /* group quota */
00326 
00327 
00328 #define clear_opt(o, opt)               o &= ~EXT2_MOUNT_##opt
00329 #define set_opt(o, opt)                 o |= EXT2_MOUNT_##opt
00330 #define test_opt(sb, opt)               (EXT2_SB(sb)->s_mount_opt & \
00331                                          EXT2_MOUNT_##opt)
00332 /*
00333  * Maximal mount counts between two filesystem checks
00334  */
00335 #define EXT2_DFL_MAX_MNT_COUNT          20      /* Allow 20 mounts */
00336 #define EXT2_DFL_CHECKINTERVAL          0       /* Don't use interval check */
00337 
00338 /*
00339  * Behaviour when detecting errors
00340  */
00341 #define EXT2_ERRORS_CONTINUE            1       /* Continue execution */
00342 #define EXT2_ERRORS_RO                  2       /* Remount fs read-only */
00343 #define EXT2_ERRORS_PANIC               3       /* Panic */
00344 #define EXT2_ERRORS_DEFAULT             EXT2_ERRORS_CONTINUE
00345 
00346 /*
00347  * Structure of the super block
00348  */
00349 struct ext2_super_block {
00350         __le32  s_inodes_count;         /* Inodes count */
00351         __le32  s_blocks_count;         /* Blocks count */
00352         __le32  s_r_blocks_count;       /* Reserved blocks count */
00353         __le32  s_free_blocks_count;    /* Free blocks count */
00354         __le32  s_free_inodes_count;    /* Free inodes count */
00355         __le32  s_first_data_block;     /* First Data Block */
00356         __le32  s_log_block_size;       /* Block size */
00357         __le32  s_log_frag_size;        /* Fragment size */
00358         __le32  s_blocks_per_group;     /* # Blocks per group */
00359         __le32  s_frags_per_group;      /* # Fragments per group */
00360         __le32  s_inodes_per_group;     /* # Inodes per group */
00361         __le32  s_mtime;                /* Mount time */
00362         __le32  s_wtime;                /* Write time */
00363         __le16  s_mnt_count;            /* Mount count */
00364         __le16  s_max_mnt_count;        /* Maximal mount count */
00365         __le16  s_magic;                /* Magic signature */
00366         __le16  s_state;                /* File system state */
00367         __le16  s_errors;               /* Behaviour when detecting errors */
00368         __le16  s_minor_rev_level;      /* minor revision level */
00369         __le32  s_lastcheck;            /* time of last check */
00370         __le32  s_checkinterval;        /* max. time between checks */
00371         __le32  s_creator_os;           /* OS */
00372         __le32  s_rev_level;            /* Revision level */
00373         __le16  s_def_resuid;           /* Default uid for reserved blocks */
00374         __le16  s_def_resgid;           /* Default gid for reserved blocks */
00375         /*
00376          * These fields are for EXT2_DYNAMIC_REV superblocks only.
00377          *
00378          * Note: the difference between the compatible feature set and
00379          * the incompatible feature set is that if there is a bit set
00380          * in the incompatible feature set that the kernel doesn't
00381          * know about, it should refuse to mount the filesystem.
00382          * 
00383          * e2fsck's requirements are more strict; if it doesn't know
00384          * about a feature in either the compatible or incompatible
00385          * feature set, it must abort and not try to meddle with
00386          * things it doesn't understand...
00387          */
00388         __le32  s_first_ino;            /* First non-reserved inode */
00389         __le16   s_inode_size;          /* size of inode structure */
00390         __le16  s_block_group_nr;       /* block group # of this superblock */
00391         __le32  s_feature_compat;       /* compatible feature set */
00392         __le32  s_feature_incompat;     /* incompatible feature set */
00393         __le32  s_feature_ro_compat;    /* readonly-compatible feature set */
00394         __u8    s_uuid[16];             /* 128-bit uuid for volume */
00395         char    s_volume_name[16];      /* volume name */
00396         char    s_last_mounted[64];     /* directory where last mounted */
00397         __le32  s_algorithm_usage_bitmap; /* For compression */
00398         /*
00399          * Performance hints.  Directory preallocation should only
00400          * happen if the EXT2_COMPAT_PREALLOC flag is on.
00401          */
00402         __u8    s_prealloc_blocks;      /* Nr of blocks to try to preallocate*/
00403         __u8    s_prealloc_dir_blocks;  /* Nr to preallocate for dirs */
00404         __u16   s_padding1;
00405         /*
00406          * Journaling support valid if EXT3_FEATURE_COMPAT_HAS_JOURNAL set.
00407          */
00408         __u8    s_journal_uuid[16];     /* uuid of journal superblock */
00409         __u32   s_journal_inum;         /* inode number of journal file */
00410         __u32   s_journal_dev;          /* device number of journal file */
00411         __u32   s_last_orphan;          /* start of list of inodes to delete */
00412         __u32   s_hash_seed[4];         /* HTREE hash seed */
00413         __u8    s_def_hash_version;     /* Default hash version to use */
00414         __u8    s_reserved_char_pad;
00415         __u16   s_reserved_word_pad;
00416         __le32  s_default_mount_opts;
00417         __le32  s_first_meta_bg;        /* First metablock block group */
00418         __u32   s_reserved[190];        /* Padding to the end of the block */
00419 };
00420 
00421 /*
00422  * Codes for operating systems
00423  */
00424 #define EXT2_OS_LINUX           0
00425 #define EXT2_OS_HURD            1
00426 #define EXT2_OS_MASIX           2
00427 #define EXT2_OS_FREEBSD         3
00428 #define EXT2_OS_LITES           4
00429 
00430 /*
00431  * Revision levels
00432  */
00433 #define EXT2_GOOD_OLD_REV       0       /* The good old (original) format */
00434 #define EXT2_DYNAMIC_REV        1       /* V2 format w/ dynamic inode sizes */
00435 
00436 #define EXT2_CURRENT_REV        EXT2_GOOD_OLD_REV
00437 #define EXT2_MAX_SUPP_REV       EXT2_DYNAMIC_REV
00438 
00439 #define EXT2_GOOD_OLD_INODE_SIZE 128
00440 
00441 /*
00442  * Feature set definitions
00443  */
00444 
00445 #define EXT2_HAS_COMPAT_FEATURE(sb,mask)                        \
00446         ( EXT2_SB(sb)->s_es->s_feature_compat & cpu_to_le32(mask) )
00447 #define EXT2_HAS_RO_COMPAT_FEATURE(sb,mask)                     \
00448         ( EXT2_SB(sb)->s_es->s_feature_ro_compat & cpu_to_le32(mask) )
00449 #define EXT2_HAS_INCOMPAT_FEATURE(sb,mask)                      \
00450         ( EXT2_SB(sb)->s_es->s_feature_incompat & cpu_to_le32(mask) )
00451 #define EXT2_SET_COMPAT_FEATURE(sb,mask)                        \
00452         EXT2_SB(sb)->s_es->s_feature_compat |= cpu_to_le32(mask)
00453 #define EXT2_SET_RO_COMPAT_FEATURE(sb,mask)                     \
00454         EXT2_SB(sb)->s_es->s_feature_ro_compat |= cpu_to_le32(mask)
00455 #define EXT2_SET_INCOMPAT_FEATURE(sb,mask)                      \
00456         EXT2_SB(sb)->s_es->s_feature_incompat |= cpu_to_le32(mask)
00457 #define EXT2_CLEAR_COMPAT_FEATURE(sb,mask)                      \
00458         EXT2_SB(sb)->s_es->s_feature_compat &= ~cpu_to_le32(mask)
00459 #define EXT2_CLEAR_RO_COMPAT_FEATURE(sb,mask)                   \
00460         EXT2_SB(sb)->s_es->s_feature_ro_compat &= ~cpu_to_le32(mask)
00461 #define EXT2_CLEAR_INCOMPAT_FEATURE(sb,mask)                    \
00462         EXT2_SB(sb)->s_es->s_feature_incompat &= ~cpu_to_le32(mask)
00463 
00464 #define EXT2_FEATURE_COMPAT_DIR_PREALLOC        0x0001
00465 #define EXT2_FEATURE_COMPAT_IMAGIC_INODES       0x0002
00466 #define EXT3_FEATURE_COMPAT_HAS_JOURNAL         0x0004
00467 #define EXT2_FEATURE_COMPAT_EXT_ATTR            0x0008
00468 #define EXT2_FEATURE_COMPAT_RESIZE_INO          0x0010
00469 #define EXT2_FEATURE_COMPAT_DIR_INDEX           0x0020
00470 #define EXT2_FEATURE_COMPAT_ANY                 0xffffffff
00471 
00472 #define EXT2_FEATURE_RO_COMPAT_SPARSE_SUPER     0x0001
00473 #define EXT2_FEATURE_RO_COMPAT_LARGE_FILE       0x0002
00474 #define EXT2_FEATURE_RO_COMPAT_BTREE_DIR        0x0004
00475 #define EXT2_FEATURE_RO_COMPAT_ANY              0xffffffff
00476 
00477 #define EXT2_FEATURE_INCOMPAT_COMPRESSION       0x0001
00478 #define EXT2_FEATURE_INCOMPAT_FILETYPE          0x0002
00479 #define EXT3_FEATURE_INCOMPAT_RECOVER           0x0004
00480 #define EXT3_FEATURE_INCOMPAT_JOURNAL_DEV       0x0008
00481 #define EXT2_FEATURE_INCOMPAT_META_BG           0x0010
00482 #define EXT2_FEATURE_INCOMPAT_ANY               0xffffffff
00483 
00484 #define EXT2_FEATURE_COMPAT_SUPP        EXT2_FEATURE_COMPAT_EXT_ATTR
00485 #define EXT2_FEATURE_INCOMPAT_SUPP      (EXT2_FEATURE_INCOMPAT_FILETYPE| \
00486                                          EXT2_FEATURE_INCOMPAT_META_BG)
00487 #define EXT2_FEATURE_RO_COMPAT_SUPP     (EXT2_FEATURE_RO_COMPAT_SPARSE_SUPER| \
00488                                          EXT2_FEATURE_RO_COMPAT_LARGE_FILE| \
00489                                          EXT2_FEATURE_RO_COMPAT_BTREE_DIR)
00490 #define EXT2_FEATURE_RO_COMPAT_UNSUPPORTED      ~EXT2_FEATURE_RO_COMPAT_SUPP
00491 #define EXT2_FEATURE_INCOMPAT_UNSUPPORTED       ~EXT2_FEATURE_INCOMPAT_SUPP
00492 
00493 /*
00494  * Default values for user and/or group using reserved blocks
00495  */
00496 #define EXT2_DEF_RESUID         0
00497 #define EXT2_DEF_RESGID         0
00498 
00499 /*
00500  * Default mount options
00501  */
00502 #define EXT2_DEFM_DEBUG         0x0001
00503 #define EXT2_DEFM_BSDGROUPS     0x0002
00504 #define EXT2_DEFM_XATTR_USER    0x0004
00505 #define EXT2_DEFM_ACL           0x0008
00506 #define EXT2_DEFM_UID16         0x0010
00507     /* Not used by ext2, but reserved for use by ext3 */
00508 #define EXT3_DEFM_JMODE         0x0060 
00509 #define EXT3_DEFM_JMODE_DATA    0x0020
00510 #define EXT3_DEFM_JMODE_ORDERED 0x0040
00511 #define EXT3_DEFM_JMODE_WBACK   0x0060
00512 
00513 /*
00514  * Structure of a directory entry
00515  */
00516 #define EXT2_NAME_LEN 255
00517 
00518 struct ext2_dir_entry {
00519         __le32  inode;                  /* Inode number */
00520         __le16  rec_len;                /* Directory entry length */
00521         __le16  name_len;               /* Name length */
00522         char    name[EXT2_NAME_LEN];    /* File name */
00523 };
00524 
00525 /*
00526  * The new version of the directory entry.  Since EXT2 structures are
00527  * stored in intel byte order, and the name_len field could never be
00528  * bigger than 255 chars, it's safe to reclaim the extra byte for the
00529  * file_type field.
00530  */
00531 struct ext2_dir_entry_2 {
00532         __le32  inode;                  /* Inode number */
00533         __le16  rec_len;                /* Directory entry length */
00534         __u8    name_len;               /* Name length */
00535         __u8    file_type;
00536         char    name[EXT2_NAME_LEN];    /* File name */
00537 };
00538 
00539 /*
00540  * Ext2 directory file types.  Only the low 3 bits are used.  The
00541  * other bits are reserved for now.
00542  */
00543 enum {
00544         EXT2_FT_UNKNOWN,
00545         EXT2_FT_REG_FILE,
00546         EXT2_FT_DIR,
00547         EXT2_FT_CHRDEV,
00548         EXT2_FT_BLKDEV,
00549         EXT2_FT_FIFO,
00550         EXT2_FT_SOCK,
00551         EXT2_FT_SYMLINK,
00552         EXT2_FT_MAX
00553 };
00554 
00555 /*
00556  * EXT2_DIR_PAD defines the directory entries boundaries
00557  *
00558  * NOTE: It must be a multiple of 4
00559  */
00560 #define EXT2_DIR_PAD                    4
00561 #define EXT2_DIR_ROUND                  (EXT2_DIR_PAD - 1)
00562 #define EXT2_DIR_REC_LEN(name_len)      (((name_len) + 8 + EXT2_DIR_ROUND) & \
00563                                          ~EXT2_DIR_ROUND)
00564 
00565 #endif  /* _LINUX_EXT2_FS_H */

Generated on Fri Nov 28 00:06:24 2008 for elphel by  doxygen 1.5.1