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