ReactOS Fundraising Campaign 2012
 
€ 4,410 / € 30,000

Information | Donate

Home | Info | Community | Development | myReactOS | Contact Us

  1. Home
  2. Community
  3. Development
  4. myReactOS
  5. Fundraiser 2012

  1. Main Page
  2. Alphabetical List
  3. Data Structures
  4. Directories
  5. File List
  6. Data Fields
  7. Globals
  8. Related Pages

ReactOS Development > Doxygen

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 
00021 /*
00022  * The second extended filesystem constants/structures
00023  */
00024 
00025 
00026 /*
00027  * Define EXT2_PREALLOCATE to preallocate data blocks for expanding files
00028  */
00029 #define EXT2_PREALLOCATE
00030 #define EXT2_DEFAULT_PREALLOC_BLOCKS    8
00031 
00032 /*
00033  * The second extended file system version
00034  */
00035 #define EXT2FS_DATE     "95/08/09"
00036 #define EXT2FS_VERSION      "0.5b"
00037 
00038 /*
00039  * Debug code
00040  */
00041 
00042 /*
00043  * Special inodes numbers
00044  */
00045 #define EXT2_BAD_INO         1  /* Bad blocks inode */
00046 #define EXT2_ROOT_INO        2  /* Root inode */
00047 #define EXT2_ACL_IDX_INO     3  /* ACL inode */
00048 #define EXT2_ACL_DATA_INO    4  /* ACL inode */
00049 #define EXT2_BOOT_LOADER_INO     5  /* Boot loader inode */
00050 #define EXT2_UNDEL_DIR_INO   6  /* Undelete directory inode */
00051 
00052 /* First non-reserved inode for old ext2 filesystems */
00053 #define EXT2_GOOD_OLD_FIRST_INO 11
00054 
00055 /*
00056  * The second extended file system magic number
00057  */
00058 #define EXT2_SUPER_MAGIC    0xEF53
00059 
00060 /*
00061  * Maximal count of links to a file
00062  */
00063 #define EXT2_LINK_MAX       32000
00064 
00065 /*
00066  * Macro-instructions used to manage several block sizes
00067  */
00068 #define EXT2_MIN_BLOCK_SIZE     1024
00069 #define EXT2_MAX_BLOCK_SIZE     4096
00070 #define EXT2_MIN_BLOCK_LOG_SIZE       10
00071 #ifdef __KERNEL__
00072 # define EXT2_BLOCK_SIZE(s)     ((s)->s_blocksize)
00073 #else
00074 # define EXT2_BLOCK_SIZE(s)     (EXT2_MIN_BLOCK_SIZE << (s)->s_log_block_size)
00075 #endif
00076 #define EXT2_ACLE_PER_BLOCK(s)      (EXT2_BLOCK_SIZE(s) / sizeof (struct ext2_acl_entry))
00077 #define EXT2_ADDR_PER_BLOCK(s)      (EXT2_BLOCK_SIZE(s) / sizeof (__u32))
00078 #ifdef __KERNEL__
00079 # define EXT2_BLOCK_SIZE_BITS(s)    ((s)->s_blocksize_bits)
00080 #else
00081 # define EXT2_BLOCK_SIZE_BITS(s)    ((s)->s_log_block_size + 10)
00082 #endif
00083 #ifdef __KERNEL__
00084 #define EXT2_ADDR_PER_BLOCK_BITS(s) ((s)->u.ext2_sb.s_addr_per_block_bits)
00085 #define EXT2_INODE_SIZE(s)      ((s)->u.ext2_sb.s_inode_size)
00086 #define EXT2_FIRST_INO(s)       ((s)->u.ext2_sb.s_first_ino)
00087 #else
00088 #define EXT2_INODE_SIZE(s)  (((s)->s_rev_level == EXT2_GOOD_OLD_REV) ? \
00089                  EXT2_GOOD_OLD_INODE_SIZE : \
00090                  (s)->s_inode_size)
00091 #define EXT2_FIRST_INO(s)   (((s)->s_rev_level == EXT2_GOOD_OLD_REV) ? \
00092                  EXT2_GOOD_OLD_FIRST_INO : \
00093                  (s)->s_first_ino)
00094 #endif
00095 
00096 /*
00097  * Macro-instructions used to manage fragments
00098  */
00099 #define EXT2_MIN_FRAG_SIZE      1024
00100 #define EXT2_MAX_FRAG_SIZE      4096
00101 #define EXT2_MIN_FRAG_LOG_SIZE        10
00102 #ifdef __KERNEL__
00103 # define EXT2_FRAG_SIZE(s)      ((s)->u.ext2_sb.s_frag_size)
00104 # define EXT2_FRAGS_PER_BLOCK(s)    ((s)->u.ext2_sb.s_frags_per_block)
00105 #else
00106 # define EXT2_FRAG_SIZE(s)      (EXT2_MIN_FRAG_SIZE << (s)->s_log_frag_size)
00107 # define EXT2_FRAGS_PER_BLOCK(s)    (EXT2_BLOCK_SIZE(s) / EXT2_FRAG_SIZE(s))
00108 #endif
00109 
00110 /*
00111  * ACL structures
00112  */
00113 struct ext2_acl_header  /* Header of Access Control Lists */
00114 {
00115     __u32   aclh_size;
00116     __u32   aclh_file_count;
00117     __u32   aclh_acle_count;
00118     __u32   aclh_first_acle;
00119 };
00120 
00121 struct ext2_acl_entry   /* Access Control List Entry */
00122 {
00123     __u32   acle_size;
00124     __u16   acle_perms; /* Access permissions */
00125     __u16   acle_type;  /* Type of entry */
00126     __u16   acle_tag;   /* User or group identity */
00127     __u16   acle_pad1;
00128     __u32   acle_next;  /* Pointer on next entry for the */
00129                     /* same inode or on next free entry */
00130 };
00131 
00132 /*
00133  * Structure of a blocks group descriptor
00134  */
00135 struct ext2_group_desc
00136 {
00137     __u32   bg_block_bitmap;        /* Blocks bitmap block */
00138     __u32   bg_inode_bitmap;        /* Inodes bitmap block */
00139     __u32   bg_inode_table;     /* Inodes table block */
00140     __u16   bg_free_blocks_count;   /* Free blocks count */
00141     __u16   bg_free_inodes_count;   /* Free inodes count */
00142     __u16   bg_used_dirs_count; /* Directories count */
00143     __u16   bg_pad;
00144     __u32   bg_reserved[3];
00145 };
00146 
00147 /*
00148  * Macro-instructions used to manage group descriptors
00149  */
00150 #ifdef __KERNEL__
00151 # define EXT2_BLOCKS_PER_GROUP(s)   ((s)->u.ext2_sb.s_blocks_per_group)
00152 # define EXT2_DESC_PER_BLOCK(s)     ((s)->u.ext2_sb.s_desc_per_block)
00153 # define EXT2_INODES_PER_GROUP(s)   ((s)->u.ext2_sb.s_inodes_per_group)
00154 # define EXT2_DESC_PER_BLOCK_BITS(s)    ((s)->u.ext2_sb.s_desc_per_block_bits)
00155 #else
00156 # define EXT2_BLOCKS_PER_GROUP(s)   ((s)->s_blocks_per_group)
00157 # define EXT2_DESC_PER_BLOCK(s)     (EXT2_BLOCK_SIZE(s) / sizeof (struct ext2_group_desc))
00158 # define EXT2_INODES_PER_GROUP(s)   ((s)->s_inodes_per_group)
00159 #endif
00160 
00161 /*
00162  * Constants relative to the data blocks
00163  */
00164 #define EXT2_NDIR_BLOCKS        12
00165 #define EXT2_IND_BLOCK          EXT2_NDIR_BLOCKS
00166 #define EXT2_DIND_BLOCK         (EXT2_IND_BLOCK + 1)
00167 #define EXT2_TIND_BLOCK         (EXT2_DIND_BLOCK + 1)
00168 #define EXT2_N_BLOCKS           (EXT2_TIND_BLOCK + 1)
00169 
00170 /*
00171  * Inode flags
00172  */
00173 #define EXT2_SECRM_FL           0x00000001 /* Secure deletion */
00174 #define EXT2_UNRM_FL            0x00000002 /* Undelete */
00175 #define EXT2_COMPR_FL           0x00000004 /* Compress file */
00176 #define EXT2_SYNC_FL            0x00000008 /* Synchronous updates */
00177 #define EXT2_IMMUTABLE_FL       0x00000010 /* Immutable file */
00178 #define EXT2_APPEND_FL          0x00000020 /* writes to file may only append */
00179 #define EXT2_NODUMP_FL          0x00000040 /* do not dump file */
00180 #define EXT2_NOATIME_FL         0x00000080 /* do not update atime */
00181 /* Reserved for compression usage... */
00182 #define EXT2_DIRTY_FL           0x00000100
00183 #define EXT2_COMPRBLK_FL        0x00000200 /* One or more compressed clusters */
00184 #define EXT2_NOCOMP_FL          0x00000400 /* Don't compress */
00185 #define EXT2_ECOMPR_FL          0x00000800 /* Compression error */
00186 /* End compression flags --- maybe not all used */  
00187 #define EXT2_BTREE_FL           0x00001000 /* btree format dir */
00188 #define EXT2_RESERVED_FL        0x80000000 /* reserved for ext2 lib */
00189 
00190 #define EXT2_FL_USER_VISIBLE        0x00001FFF /* User visible flags */
00191 #define EXT2_FL_USER_MODIFIABLE     0x000000FF /* User modifiable flags */
00192 
00193 /*
00194  * ioctl commands
00195  */
00196 #define EXT2_IOC_GETFLAGS       _IOR('f', 1, long)
00197 #define EXT2_IOC_SETFLAGS       _IOW('f', 2, long)
00198 #define EXT2_IOC_GETVERSION     _IOR('v', 1, long)
00199 #define EXT2_IOC_SETVERSION     _IOW('v', 2, long)
00200 
00201 /*
00202  * Structure of an inode on the disk
00203  */
00204 struct ext2_inode {
00205     __u16   i_mode;     /* File mode */
00206     __u16   i_uid;      /* Low 16 bits of Owner Uid */
00207     __u32   i_size;     /* Size in bytes */
00208     __u32   i_atime;    /* Access time */
00209     __u32   i_ctime;    /* Creation time */
00210     __u32   i_mtime;    /* Modification time */
00211     __u32   i_dtime;    /* Deletion Time */
00212     __u16   i_gid;      /* Low 16 bits of Group Id */
00213     __u16   i_links_count;  /* Links count */
00214     __u32   i_blocks;   /* Blocks count */
00215     __u32   i_flags;    /* File flags */
00216     union {
00217         struct {
00218             __u32  l_i_reserved1;
00219         } linux1;
00220         struct {
00221             __u32  h_i_translator;
00222         } hurd1;
00223         struct {
00224             __u32  m_i_reserved1;
00225         } masix1;
00226     } osd1;             /* OS dependent 1 */
00227     __u32   i_block[EXT2_N_BLOCKS];/* Pointers to blocks */
00228     __u32   i_generation;   /* File version (for NFS) */
00229     __u32   i_file_acl; /* File ACL */
00230     __u32   i_dir_acl;  /* Directory ACL */
00231     __u32   i_faddr;    /* Fragment address */
00232     union {
00233         struct {
00234             __u8    l_i_frag;   /* Fragment number */
00235             __u8    l_i_fsize;  /* Fragment size */
00236             __u16   i_pad1;
00237             __u16   l_i_uid_high;   /* these 2 fields    */
00238             __u16   l_i_gid_high;   /* were reserved2[0] */
00239             __u32   l_i_reserved2;
00240         } linux2;
00241         struct {
00242             __u8    h_i_frag;   /* Fragment number */
00243             __u8    h_i_fsize;  /* Fragment size */
00244             __u16   h_i_mode_high;
00245             __u16   h_i_uid_high;
00246             __u16   h_i_gid_high;
00247             __u32   h_i_author;
00248         } hurd2;
00249         struct {
00250             __u8    m_i_frag;   /* Fragment number */
00251             __u8    m_i_fsize;  /* Fragment size */
00252             __u16   m_pad1;
00253             __u32   m_i_reserved2[2];
00254         } masix2;
00255     } osd2;             /* OS dependent 2 */
00256 };
00257 
00258 #define i_size_high i_dir_acl
00259 
00260 #if defined(__KERNEL__) || defined(__linux__)
00261 #define i_reserved1 osd1.linux1.l_i_reserved1
00262 #define i_frag      osd2.linux2.l_i_frag
00263 #define i_fsize     osd2.linux2.l_i_fsize
00264 #define i_uid_low   i_uid
00265 #define i_gid_low   i_gid
00266 #define i_uid_high  osd2.linux2.l_i_uid_high
00267 #define i_gid_high  osd2.linux2.l_i_gid_high
00268 #define i_reserved2 osd2.linux2.l_i_reserved2
00269 #endif
00270 
00271 #ifdef  __hurd__
00272 #define i_translator    osd1.hurd1.h_i_translator
00273 #define i_frag      osd2.hurd2.h_i_frag;
00274 #define i_fsize     osd2.hurd2.h_i_fsize;
00275 #define i_uid_high  osd2.hurd2.h_i_uid_high
00276 #define i_gid_high  osd2.hurd2.h_i_gid_high
00277 #define i_author    osd2.hurd2.h_i_author
00278 #endif
00279 
00280 #ifdef  __masix__
00281 #define i_reserved1 osd1.masix1.m_i_reserved1
00282 #define i_frag      osd2.masix2.m_i_frag
00283 #define i_fsize     osd2.masix2.m_i_fsize
00284 #define i_reserved2 osd2.masix2.m_i_reserved2
00285 #endif
00286 
00287 /*
00288  * File system states
00289  */
00290 #define EXT2_VALID_FS           0x0001  /* Unmounted cleanly */
00291 #define EXT2_ERROR_FS           0x0002  /* Errors detected */
00292 
00293 /*
00294  * Mount flags
00295  */
00296 #define EXT2_MOUNT_CHECK        0x0001  /* Do mount-time checks */
00297 #define EXT2_MOUNT_GRPID        0x0004  /* Create files with directory's group */
00298 #define EXT2_MOUNT_DEBUG        0x0008  /* Some debugging messages */
00299 #define EXT2_MOUNT_ERRORS_CONT      0x0010  /* Continue on errors */
00300 #define EXT2_MOUNT_ERRORS_RO        0x0020  /* Remount fs ro on errors */
00301 #define EXT2_MOUNT_ERRORS_PANIC     0x0040  /* Panic on errors */
00302 #define EXT2_MOUNT_MINIX_DF     0x0080  /* Mimics the Minix statfs */
00303 #define EXT2_MOUNT_NO_UID32     0x0200  /* Disable 32-bit UIDs */
00304 
00305 #define clear_opt(o, opt)       o &= ~EXT2_MOUNT_##opt
00306 #define set_opt(o, opt)         o |= EXT2_MOUNT_##opt
00307 #define test_opt(sb, opt)       ((sb)->u.ext2_sb.s_mount_opt & \
00308                      EXT2_MOUNT_##opt)
00309 /*
00310  * Maximal mount counts between two filesystem checks
00311  */
00312 #define EXT2_DFL_MAX_MNT_COUNT      20  /* Allow 20 mounts */
00313 #define EXT2_DFL_CHECKINTERVAL      0   /* Don't use interval check */
00314 
00315 /*
00316  * Behaviour when detecting errors
00317  */
00318 #define EXT2_ERRORS_CONTINUE        1   /* Continue execution */
00319 #define EXT2_ERRORS_RO          2   /* Remount fs read-only */
00320 #define EXT2_ERRORS_PANIC       3   /* Panic */
00321 #define EXT2_ERRORS_DEFAULT     EXT2_ERRORS_CONTINUE
00322 
00323 /*
00324  * Structure of the super block
00325  */
00326 struct ext2_super_block {
00327     __u32   s_inodes_count;     /* Inodes count */
00328     __u32   s_blocks_count;     /* Blocks count */
00329     __u32   s_r_blocks_count;   /* Reserved blocks count */
00330     __u32   s_free_blocks_count;    /* Free blocks count */
00331     __u32   s_free_inodes_count;    /* Free inodes count */
00332     __u32   s_first_data_block; /* First Data Block */
00333     __u32   s_log_block_size;   /* Block size */
00334     __s32   s_log_frag_size;    /* Fragment size */
00335     __u32   s_blocks_per_group; /* # Blocks per group */
00336     __u32   s_frags_per_group;  /* # Fragments per group */
00337     __u32   s_inodes_per_group; /* # Inodes per group */
00338     __u32   s_mtime;        /* Mount time */
00339     __u32   s_wtime;        /* Write time */
00340     __u16   s_mnt_count;        /* Mount count */
00341     __s16   s_max_mnt_count;    /* Maximal mount count */
00342     __u16   s_magic;        /* Magic signature */
00343     __u16   s_state;        /* File system state */
00344     __u16   s_errors;       /* Behaviour when detecting errors */
00345     __u16   s_minor_rev_level;  /* minor revision level */
00346     __u32   s_lastcheck;        /* time of last check */
00347     __u32   s_checkinterval;    /* max. time between checks */
00348     __u32   s_creator_os;       /* OS */
00349     __u32   s_rev_level;        /* Revision level */
00350     __u16   s_def_resuid;       /* Default uid for reserved blocks */
00351     __u16   s_def_resgid;       /* Default gid for reserved blocks */
00352     /*
00353      * These fields are for EXT2_DYNAMIC_REV superblocks only.
00354      *
00355      * Note: the difference between the compatible feature set and
00356      * the incompatible feature set is that if there is a bit set
00357      * in the incompatible feature set that the kernel doesn't
00358      * know about, it should refuse to mount the filesystem.
00359      * 
00360      * e2fsck's requirements are more strict; if it doesn't know
00361      * about a feature in either the compatible or incompatible
00362      * feature set, it must abort and not try to meddle with
00363      * things it doesn't understand...
00364      */
00365     __u32   s_first_ino;        /* First non-reserved inode */
00366     __u16   s_inode_size;       /* size of inode structure */
00367     __u16   s_block_group_nr;   /* block group # of this superblock */
00368     __u32   s_feature_compat;   /* compatible feature set */
00369     __u32   s_feature_incompat;     /* incompatible feature set */
00370     __u32   s_feature_ro_compat;    /* readonly-compatible feature set */
00371     __u8    s_uuid[16];     /* 128-bit uuid for volume */
00372     char    s_volume_name[16];  /* volume name */
00373     char    s_last_mounted[64];     /* directory where last mounted */
00374     __u32   s_algorithm_usage_bitmap; /* For compression */
00375     /*
00376      * Performance hints.  Directory preallocation should only
00377      * happen if the EXT2_COMPAT_PREALLOC flag is on.
00378      */
00379     __u8    s_prealloc_blocks;  /* Nr of blocks to try to preallocate*/
00380     __u8    s_prealloc_dir_blocks;  /* Nr to preallocate for dirs */
00381     __u16   s_padding1;
00382     __u32   s_reserved[204];    /* Padding to the end of the block */
00383 };
00384 
00385 #ifdef __KERNEL__
00386 #define EXT2_SB(sb) (&((sb)->u.ext2_sb))
00387 #else
00388 /* Assume that user mode programs are passing in an ext2fs superblock, not
00389  * a kernel struct super_block.  This will allow us to call the feature-test
00390  * macros from user land. */
00391 #define EXT2_SB(sb) (sb)
00392 #endif
00393 
00394 /*
00395  * Codes for operating systems
00396  */
00397 #define EXT2_OS_LINUX       0
00398 #define EXT2_OS_HURD        1
00399 #define EXT2_OS_MASIX       2
00400 #define EXT2_OS_FREEBSD     3
00401 #define EXT2_OS_LITES       4
00402 
00403 /*
00404  * Revision levels
00405  */
00406 #define EXT2_GOOD_OLD_REV   0   /* The good old (original) format */
00407 #define EXT2_DYNAMIC_REV    1   /* V2 format w/ dynamic inode sizes */
00408 
00409 #define EXT2_CURRENT_REV    EXT2_GOOD_OLD_REV
00410 #define EXT2_MAX_SUPP_REV   EXT2_DYNAMIC_REV
00411 
00412 #define EXT2_GOOD_OLD_INODE_SIZE 128
00413 
00414 /*
00415  * Feature set definitions
00416  */
00417 
00418 #define EXT2_HAS_COMPAT_FEATURE(sb,mask)            \
00419     ( EXT2_SB(sb)->s_es->s_feature_compat & cpu_to_le32(mask) )
00420 #define EXT2_HAS_RO_COMPAT_FEATURE(sb,mask)         \
00421     ( EXT2_SB(sb)->s_es->s_feature_ro_compat & cpu_to_le32(mask) )
00422 #define EXT2_HAS_INCOMPAT_FEATURE(sb,mask)          \
00423     ( EXT2_SB(sb)->s_es->s_feature_incompat & cpu_to_le32(mask) )
00424 #define EXT2_SET_COMPAT_FEATURE(sb,mask)            \
00425     EXT2_SB(sb)->s_es->s_feature_compat |= cpu_to_le32(mask)
00426 #define EXT2_SET_RO_COMPAT_FEATURE(sb,mask)         \
00427     EXT2_SB(sb)->s_es->s_feature_ro_compat |= cpu_to_le32(mask)
00428 #define EXT2_SET_INCOMPAT_FEATURE(sb,mask)          \
00429     EXT2_SB(sb)->s_es->s_feature_incompat |= cpu_to_le32(mask)
00430 #define EXT2_CLEAR_COMPAT_FEATURE(sb,mask)          \
00431     EXT2_SB(sb)->s_es->s_feature_compat &= ~cpu_to_le32(mask)
00432 #define EXT2_CLEAR_RO_COMPAT_FEATURE(sb,mask)           \
00433     EXT2_SB(sb)->s_es->s_feature_ro_compat &= ~cpu_to_le32(mask)
00434 #define EXT2_CLEAR_INCOMPAT_FEATURE(sb,mask)            \
00435     EXT2_SB(sb)->s_es->s_feature_incompat &= ~cpu_to_le32(mask)
00436 
00437 #define EXT2_FEATURE_COMPAT_DIR_PREALLOC    0x0001
00438 
00439 #define EXT2_FEATURE_RO_COMPAT_SPARSE_SUPER 0x0001
00440 #define EXT2_FEATURE_RO_COMPAT_LARGE_FILE   0x0002
00441 #define EXT2_FEATURE_RO_COMPAT_BTREE_DIR    0x0004
00442 
00443 #define EXT2_FEATURE_INCOMPAT_COMPRESSION   0x0001
00444 #define EXT2_FEATURE_INCOMPAT_FILETYPE      0x0002
00445 
00446 #define EXT2_FEATURE_COMPAT_SUPP    0
00447 #define EXT2_FEATURE_INCOMPAT_SUPP  EXT2_FEATURE_INCOMPAT_FILETYPE
00448 #define EXT2_FEATURE_RO_COMPAT_SUPP (EXT2_FEATURE_RO_COMPAT_SPARSE_SUPER| \
00449                      EXT2_FEATURE_RO_COMPAT_LARGE_FILE| \
00450                      EXT2_FEATURE_RO_COMPAT_BTREE_DIR)
00451 
00452 /*
00453  * Default values for user and/or group using reserved blocks
00454  */
00455 #define EXT2_DEF_RESUID     0
00456 #define EXT2_DEF_RESGID     0
00457 
00458 /*
00459  * Structure of a directory entry
00460  */
00461 #define EXT2_NAME_LEN 255
00462 
00463 struct ext2_dir_entry {
00464     __u32   inode;          /* Inode number */
00465     __u16   rec_len;        /* Directory entry length */
00466     __u16   name_len;       /* Name length */
00467     char    name[EXT2_NAME_LEN];    /* File name */
00468 };
00469 
00470 /*
00471  * The new version of the directory entry.  Since EXT2 structures are
00472  * stored in intel byte order, and the name_len field could never be
00473  * bigger than 255 chars, it's safe to reclaim the extra byte for the
00474  * file_type field.
00475  */
00476 struct ext2_dir_entry_2 {
00477     __u32   inode;          /* Inode number */
00478     __u16   rec_len;        /* Directory entry length */
00479     __u8    name_len;       /* Name length */
00480     __u8    file_type;
00481     char    name[EXT2_NAME_LEN];    /* File name */
00482 };
00483 
00484 /*
00485  * Ext2 directory file types.  Only the low 3 bits are used.  The
00486  * other bits are reserved for now.
00487  */
00488 #define EXT2_FT_UNKNOWN     0
00489 #define EXT2_FT_REG_FILE    1
00490 #define EXT2_FT_DIR         2
00491 #define EXT2_FT_CHRDEV      3
00492 #define EXT2_FT_BLKDEV      4
00493 #define EXT2_FT_FIFO        5
00494 #define EXT2_FT_SOCK        6
00495 #define EXT2_FT_SYMLINK     7
00496 
00497 #define EXT2_FT_MAX     8
00498 
00499 /*
00500  * EXT2_DIR_PAD defines the directory entries boundaries
00501  *
00502  * NOTE: It must be a multiple of 4
00503  */
00504 #define EXT2_DIR_PAD            4
00505 #define EXT2_DIR_ROUND          (EXT2_DIR_PAD - 1)
00506 #define EXT2_DIR_REC_LEN(name_len)  (((name_len) + 8 + EXT2_DIR_ROUND) & \
00507                      ~EXT2_DIR_ROUND)
00508 
00509 #ifdef __KERNEL__
00510 /*
00511  * Function prototypes
00512  */
00513 
00514 /*
00515  * Ok, these declarations are also in <linux/kernel.h> but none of the
00516  * ext2 source programs needs to include it so they are duplicated here.
00517  */
00518 # define NORET_TYPE    
00519 # define ATTRIB_NORET  __attribute__((noreturn))
00520 # define NORET_AND     noreturn,
00521 
00522 /* acl.c */
00523 extern int ext2_permission (struct inode *, int);
00524 
00525 /* balloc.c */
00526 extern int ext2_bg_has_super(struct super_block *sb, int group);
00527 extern unsigned long ext2_bg_num_gdb(struct super_block *sb, int group);
00528 extern int ext2_new_block (struct inode *, unsigned long,
00529                __u32 *, __u32 *, int *);
00530 extern void ext2_free_blocks (struct inode *, unsigned long,
00531                   unsigned long);
00532 extern unsigned long ext2_count_free_blocks (struct super_block *);
00533 extern void ext2_check_blocks_bitmap (struct super_block *);
00534 extern struct ext2_group_desc * ext2_get_group_desc(struct super_block * sb,
00535                             unsigned int block_group,
00536                             struct buffer_head ** bh);
00537 
00538 /* bitmap.c */
00539 extern unsigned long ext2_count_free (struct buffer_head *, unsigned);
00540 
00541 /* dir.c */
00542 extern int ext2_check_dir_entry (const char *, struct inode *,
00543                  struct ext2_dir_entry_2 *, struct buffer_head *,
00544                  unsigned long);
00545 
00546 /* file.c */
00547 extern int ext2_read (struct inode *, struct file *, char *, int);
00548 extern int ext2_write (struct inode *, struct file *, char *, int);
00549 
00550 /* fsync.c */
00551 extern int ext2_sync_file (struct file *, struct dentry *, int);
00552 extern int ext2_fsync_inode (struct inode *, int);
00553 
00554 /* ialloc.c */
00555 extern struct inode * ext2_new_inode (const struct inode *, int);
00556 extern void ext2_free_inode (struct inode *);
00557 extern unsigned long ext2_count_free_inodes (struct super_block *);
00558 extern void ext2_check_inodes_bitmap (struct super_block *);
00559 
00560 /* inode.c */
00561 
00562 extern struct buffer_head * ext2_getblk (struct inode *, long, int, int *);
00563 extern struct buffer_head * ext2_bread (struct inode *, int, int, int *);
00564 
00565 extern void ext2_read_inode (struct inode *);
00566 extern void ext2_write_inode (struct inode *, int);
00567 extern void ext2_put_inode (struct inode *);
00568 extern void ext2_delete_inode (struct inode *);
00569 extern int ext2_sync_inode (struct inode *);
00570 extern void ext2_discard_prealloc (struct inode *);
00571 
00572 /* ioctl.c */
00573 extern int ext2_ioctl (struct inode *, struct file *, unsigned int,
00574                unsigned long);
00575 
00576 /* namei.c */
00577 extern struct inode_operations ext2_dir_inode_operations;
00578 
00579 /* super.c */
00580 extern void ext2_error (struct super_block *, const char *, const char *, ...)
00581     __attribute__ ((format (printf, 3, 4)));
00582 extern NORET_TYPE void ext2_panic (struct super_block *, const char *,
00583                    const char *, ...)
00584     __attribute__ ((NORET_AND format (printf, 3, 4)));
00585 extern void ext2_warning (struct super_block *, const char *, const char *, ...)
00586     __attribute__ ((format (printf, 3, 4)));
00587 extern void ext2_update_dynamic_rev (struct super_block *sb);
00588 extern void ext2_put_super (struct super_block *);
00589 extern void ext2_write_super (struct super_block *);
00590 extern int ext2_remount (struct super_block *, int *, char *);
00591 extern struct super_block * ext2_read_super (struct super_block *,void *,int);
00592 extern int ext2_statfs (struct super_block *, struct statfs *);
00593 
00594 /* truncate.c */
00595 extern void ext2_truncate (struct inode *);
00596 
00597 /*
00598  * Inodes and files operations
00599  */
00600 
00601 /* dir.c */
00602 extern struct file_operations ext2_dir_operations;
00603 
00604 /* file.c */
00605 extern struct inode_operations ext2_file_inode_operations;
00606 extern struct file_operations ext2_file_operations;
00607 
00608 /* symlink.c */
00609 extern struct inode_operations ext2_fast_symlink_inode_operations;
00610 
00611 extern struct address_space_operations ext2_aops;
00612 
00613 #endif  /* __KERNEL__ */
00614 
00615 #endif  /* _LINUX_EXT2_FS_H */

Generated on Sun May 27 2012 04:27:38 for ReactOS by doxygen 1.7.6.1

ReactOS is a registered trademark or a trademark of ReactOS Foundation in the United States and other countries.