ReactOS  0.4.14-dev-342-gdc047f9
ext3_fs.h
Go to the documentation of this file.
1 /*
2  * linux/include/linux/ext3_fs.h
3  *
4  * Copyright (C) 1992, 1993, 1994, 1995
5  * Remy Card (card@masi.ibp.fr)
6  * Laboratoire MASI - Institut Blaise Pascal
7  * Universite Pierre et Marie Curie (Paris VI)
8  *
9  * from
10  *
11  * linux/include/linux/minix_fs.h
12  *
13  * Copyright (C) 1991, 1992 Linus Torvalds
14  */
15 
16 #ifndef _LINUX_EXT3_FS_H
17 #define _LINUX_EXT3_FS_H
18 
19 #include <linux/module.h>
20 #include <linux/fs.h>
21 #include <linux/magic.h>
22 
23 /*
24  * The second extended filesystem constants/structures
25  */
26 
27 /*
28  * Define EXT3FS_DEBUG to produce debug messages
29  */
30 #undef EXT3FS_DEBUG
31 
32 /*
33  * Define EXT3_RESERVATION to reserve data blocks for expanding files
34  */
35 #define EXT3_DEFAULT_RESERVE_BLOCKS 8
36 /*max window size: 1024(direct blocks) + 3([t,d]indirect blocks) */
37 #define EXT3_MAX_RESERVE_BLOCKS 1027
38 #define EXT3_RESERVE_WINDOW_NOT_ALLOCATED 0
39 
40 /*
41  * Debug code
42  */
43 #ifdef EXT3FS_DEBUG
44 #define ext3_debug(f, a...) \
45  do { \
46  printk (KERN_DEBUG "EXT3-fs DEBUG (%s, %d): %s:", \
47  __FILE__, __LINE__, __FUNCTION__); \
48  printk (KERN_DEBUG f, ## a); \
49  } while (0)
50 #else
51 #define ext3_debug
52 #endif
53 
54 /*
55  * Special inodes numbers
56  */
57 #define EXT3_BAD_INO 1 /* Bad blocks inode */
58 #define EXT3_ROOT_INO 2 /* Root inode */
59 #define EXT3_BOOT_LOADER_INO 5 /* Boot loader inode */
60 #define EXT3_UNDEL_DIR_INO 6 /* Undelete directory inode */
61 #define EXT3_RESIZE_INO 7 /* Reserved group descriptors inode */
62 #define EXT3_JOURNAL_INO 8 /* Journal inode */
63 
64 /* First non-reserved inode for old ext3 filesystems */
65 #define EXT3_GOOD_OLD_FIRST_INO 11
66 
67 /*
68  * Maximal count of links to a file
69  */
70 #define EXT3_LINK_MAX 32000
71 
72 /*
73  * Macro-instructions used to manage several block sizes
74  */
75 #define EXT3_MIN_BLOCK_SIZE 1024
76 #define EXT3_MAX_BLOCK_SIZE 65536
77 #define EXT3_MIN_BLOCK_LOG_SIZE 10
78 #ifdef __KERNEL__
79 # define EXT3_BLOCK_SIZE(s) ((s)->s_blocksize)
80 #else
81 # define EXT3_BLOCK_SIZE(s) (EXT3_MIN_BLOCK_SIZE << (s)->s_log_block_size)
82 #endif
83 #define EXT3_ADDR_PER_BLOCK(s) (EXT3_BLOCK_SIZE(s) / sizeof (__u32))
84 #ifdef __KERNEL__
85 # define EXT3_BLOCK_SIZE_BITS(s) ((s)->s_blocksize_bits)
86 #else
87 # define EXT3_BLOCK_SIZE_BITS(s) ((s)->s_log_block_size + 10)
88 #endif
89 #ifdef __KERNEL__
90 #define EXT3_ADDR_PER_BLOCK_BITS(s) (EXT3_SB(s)->s_addr_per_block_bits)
91 #define EXT3_INODE_SIZE(s) (EXT3_SB(s)->s_inode_size)
92 #define EXT3_FIRST_INO(s) (EXT3_SB(s)->s_first_ino)
93 #else
94 #define EXT3_INODE_SIZE(s) (((s)->s_rev_level == EXT3_GOOD_OLD_REV) ? \
95  EXT3_GOOD_OLD_INODE_SIZE : \
96  (s)->s_inode_size)
97 #define EXT3_FIRST_INO(s) (((s)->s_rev_level == EXT3_GOOD_OLD_REV) ? \
98  EXT3_GOOD_OLD_FIRST_INO : \
99  (s)->s_first_ino)
100 #endif
101 
102 /*
103  * Macro-instructions used to manage fragments
104  */
105 #define EXT3_MIN_FRAG_SIZE 1024
106 #define EXT3_MAX_FRAG_SIZE 4096
107 #define EXT3_MIN_FRAG_LOG_SIZE 10
108 #ifdef __KERNEL__
109 # define EXT3_FRAG_SIZE(s) (EXT3_SB(s)->s_frag_size)
110 # define EXT3_FRAGS_PER_BLOCK(s) (EXT3_SB(s)->s_frags_per_block)
111 #else
112 # define EXT3_FRAG_SIZE(s) (EXT3_MIN_FRAG_SIZE << (s)->s_log_frag_size)
113 # define EXT3_FRAGS_PER_BLOCK(s) (EXT3_BLOCK_SIZE(s) / EXT3_FRAG_SIZE(s))
114 #endif
115 
116 /*
117  * Structure of a blocks group descriptor
118  */
120 {
121  __le32 bg_block_bitmap; /* Blocks bitmap block */
122  __le32 bg_inode_bitmap; /* Inodes bitmap block */
123  __le32 bg_inode_table; /* Inodes table block */
124  __le16 bg_free_blocks_count; /* Free blocks count */
125  __le16 bg_free_inodes_count; /* Free inodes count */
126  __le16 bg_used_dirs_count; /* Directories count */
129 };
130 
131 /*
132  * Structure of a blocks group descriptor
133  */
135 {
136  __le32 bg_block_bitmap; /* Blocks bitmap block */
137  __le32 bg_inode_bitmap; /* Inodes bitmap block */
138  __le32 bg_inode_table; /* Inodes table block */
139  __le16 bg_free_blocks_count;/* Free blocks count */
140  __le16 bg_free_inodes_count;/* Free inodes count */
141  __le16 bg_used_dirs_count; /* Directories count */
142  __le16 bg_flags; /* EXT4_BG_flags (INODE_UNINIT, etc) */
143  __u32 bg_reserved[2]; /* Likely block/inode bitmap checksum */
144  __le16 bg_itable_unused; /* Unused inodes count */
145  __le16 bg_checksum; /* crc16(sb_uuid+group+desc) */
146  __le32 bg_block_bitmap_hi; /* Blocks bitmap block MSB */
147  __le32 bg_inode_bitmap_hi; /* Inodes bitmap block MSB */
148  __le32 bg_inode_table_hi; /* Inodes table block MSB */
149  __le16 bg_free_blocks_count_hi;/* Free blocks count MSB */
150  __le16 bg_free_inodes_count_hi;/* Free inodes count MSB */
151  __le16 bg_used_dirs_count_hi; /* Directories count MSB */
152  __le16 bg_itable_unused_hi; /* Unused inodes count MSB */
154 };
155 
156 /*
157  * Structure of a flex block group info
158  */
159 
160 struct flex_groups {
163 };
164 
165 #define EXT4_BG_INODE_UNINIT 0x0001 /* Inode table/bitmap not in use */
166 #define EXT4_BG_BLOCK_UNINIT 0x0002 /* Block bitmap not in use */
167 #define EXT4_BG_INODE_ZEROED 0x0004 /* On-disk itable initialized to zero */
168 
169 #define EXT4_MIN_BLOCK_SIZE 1024
170 #define EXT4_MIN_DESC_SIZE 32
171 #define EXT4_MIN_DESC_SIZE_64BIT 64
172 #define EXT4_MAX_DESC_SIZE EXT4_MIN_BLOCK_SIZE
173 
174 #define EXT4_DESC_SIZE(s) (EXT3_SB(s)->s_desc_size)
175 
176 /*
177  * Macro-instructions used to manage group descriptors
178  */
179 #ifdef __KERNEL__
180 # define EXT3_BLOCKS_PER_GROUP(s) (EXT3_SB(s)->s_blocks_per_group)
181 # define EXT3_DESC_PER_BLOCK(s) (EXT3_SB(s)->s_desc_per_block)
182 # define EXT3_INODES_PER_GROUP(s) (EXT3_SB(s)->s_inodes_per_group)
183 # define EXT3_DESC_PER_BLOCK_BITS(s) (EXT3_SB(s)->s_desc_per_block_bits)
184 # define EXT4_BLOCKS_PER_GROUP(s) (EXT3_SB(s)->s_blocks_per_group)
185 # define EXT4_DESC_PER_BLOCK(s) (EXT3_SB(s)->s_desc_per_block)
186 # define EXT4_INODES_PER_GROUP(s) (EXT3_SB(s)->s_inodes_per_group)
187 # define EXT4_DESC_PER_BLOCK_BITS(s) (EXT3_SB(s)->s_desc_per_block_bits)
188 #else
189 # define EXT3_BLOCKS_PER_GROUP(s) ((s)->s_blocks_per_group)
190 # define EXT3_DESC_PER_BLOCK(s) (EXT3_BLOCK_SIZE(s) / sizeof (struct ext3_group_desc))
191 # define EXT3_INODES_PER_GROUP(s) ((s)->s_inodes_per_group)
192 #endif
193 
194 /*
195  * Constants relative to the data blocks
196  */
197 #define EXT3_NDIR_BLOCKS 12
198 #define EXT3_IND_BLOCK EXT3_NDIR_BLOCKS
199 #define EXT3_DIND_BLOCK (EXT3_IND_BLOCK + 1)
200 #define EXT3_TIND_BLOCK (EXT3_DIND_BLOCK + 1)
201 #define EXT3_N_BLOCKS (EXT3_TIND_BLOCK + 1)
202 
203 /*
204  * Inode flags
205  */
206 #define EXT3_SECRM_FL 0x00000001 /* Secure deletion */
207 #define EXT3_UNRM_FL 0x00000002 /* Undelete */
208 #define EXT3_COMPR_FL 0x00000004 /* Compress file */
209 #define EXT3_SYNC_FL 0x00000008 /* Synchronous updates */
210 #define EXT3_IMMUTABLE_FL 0x00000010 /* Immutable file */
211 #define EXT3_APPEND_FL 0x00000020 /* writes to file may only append */
212 #define EXT3_NODUMP_FL 0x00000040 /* do not dump file */
213 #define EXT3_NOATIME_FL 0x00000080 /* do not update atime */
214 /* Reserved for compression usage... */
215 #define EXT3_DIRTY_FL 0x00000100
216 #define EXT3_COMPRBLK_FL 0x00000200 /* One or more compressed clusters */
217 #define EXT3_NOCOMPR_FL 0x00000400 /* Don't compress */
218 #define EXT3_ECOMPR_FL 0x00000800 /* Compression error */
219 /* End compression flags --- maybe not all used */
220 #define EXT3_INDEX_FL 0x00001000 /* hash-indexed directory */
221 #define EXT3_IMAGIC_FL 0x00002000 /* AFS directory */
222 #define EXT3_JOURNAL_DATA_FL 0x00004000 /* file data should be journaled */
223 #define EXT3_NOTAIL_FL 0x00008000 /* file tail should not be merged */
224 #define EXT3_DIRSYNC_FL 0x00010000 /* dirsync behaviour (directories only) */
225 #define EXT3_TOPDIR_FL 0x00020000 /* Top of directory hierarchies*/
226 #define EXT3_RESERVED_FL 0x80000000 /* reserved for ext3 lib */
227 
228 #define EXT3_FL_USER_VISIBLE 0x0003DFFF /* User visible flags */
229 #define EXT3_FL_USER_MODIFIABLE 0x000380FF /* User modifiable flags */
230 
231 /*
232  * Inode dynamic state flags
233  */
234 #define EXT3_STATE_JDATA 0x00000001 /* journaled data exists */
235 #define EXT3_STATE_NEW 0x00000002 /* inode is newly created */
236 #define EXT3_STATE_XATTR 0x00000004 /* has in-inode xattrs */
237 
238 
239 /*
240  * Ext4 Inode flags
241  */
242 #define EXT4_SECRM_FL 0x00000001 /* Secure deletion */
243 #define EXT4_UNRM_FL 0x00000002 /* Undelete */
244 #define EXT4_COMPR_FL 0x00000004 /* Compress file */
245 #define EXT4_SYNC_FL 0x00000008 /* Synchronous updates */
246 #define EXT4_IMMUTABLE_FL 0x00000010 /* Immutable file */
247 #define EXT4_APPEND_FL 0x00000020 /* writes to file may only append */
248 #define EXT4_NODUMP_FL 0x00000040 /* do not dump file */
249 #define EXT4_NOATIME_FL 0x00000080 /* do not update atime */
250 /* Reserved for compression usage... */
251 #define EXT4_DIRTY_FL 0x00000100
252 #define EXT4_COMPRBLK_FL 0x00000200 /* One or more compressed clusters */
253 #define EXT4_NOCOMPR_FL 0x00000400 /* Don't compress */
254 #define EXT4_ECOMPR_FL 0x00000800 /* Compression error */
255 /* End compression flags --- maybe not all used */
256 #define EXT4_INDEX_FL 0x00001000 /* hash-indexed directory */
257 #define EXT4_IMAGIC_FL 0x00002000 /* AFS directory */
258 #define EXT4_JOURNAL_DATA_FL 0x00004000 /* file data should be journaled */
259 #define EXT4_NOTAIL_FL 0x00008000 /* file tail should not be merged */
260 #define EXT4_DIRSYNC_FL 0x00010000 /* dirsync behaviour (directories only) */
261 #define EXT4_TOPDIR_FL 0x00020000 /* Top of directory hierarchies*/
262 #define EXT4_HUGE_FILE_FL 0x00040000 /* Set to each huge file */
263 #define EXT4_EXTENTS_FL 0x00080000 /* Inode uses extents */
264 #define EXT4_EXT_MIGRATE 0x00100000 /* Inode is migrating */
265 #define EXT4_RESERVED_FL 0x80000000 /* reserved for ext4 lib */
266 
267 #define EXT4_FL_USER_VISIBLE 0x000BDFFF /* User visible flags */
268 #define EXT4_FL_USER_MODIFIABLE 0x000B80FF /* User modifiable flags */
269 
270 /* Used to pass group descriptor data when online resize is done */
272  __u32 group; /* Group number for this data */
273  __u32 block_bitmap; /* Absolute block number of block bitmap */
274  __u32 inode_bitmap; /* Absolute block number of inode bitmap */
275  __u32 inode_table; /* Absolute block number of inode table start */
276  __u32 blocks_count; /* Total number of blocks in this group */
277  __u16 reserved_blocks; /* Number of reserved blocks in this group */
279 };
280 
281 /* The struct ext3_new_group_input in kernel space, with free_blocks_count */
291 };
292 
293 
294 /*
295  * ioctl commands
296  */
297 #define EXT3_IOC_GETFLAGS FS_IOC_GETFLAGS
298 #define EXT3_IOC_SETFLAGS FS_IOC_SETFLAGS
299 #define EXT3_IOC_GETVERSION _IOR('f', 3, long)
300 #define EXT3_IOC_SETVERSION _IOW('f', 4, long)
301 #define EXT3_IOC_GROUP_EXTEND _IOW('f', 7, unsigned long)
302 #define EXT3_IOC_GROUP_ADD _IOW('f', 8,struct ext3_new_group_input)
303 #define EXT3_IOC_GETVERSION_OLD FS_IOC_GETVERSION
304 #define EXT3_IOC_SETVERSION_OLD FS_IOC_SETVERSION
305 #ifdef CONFIG_JBD_DEBUG
306 #define EXT3_IOC_WAIT_FOR_READONLY _IOR('f', 99, long)
307 #endif
308 #define EXT3_IOC_GETRSVSZ _IOR('f', 5, long)
309 #define EXT3_IOC_SETRSVSZ _IOW('f', 6, long)
310 
311 /*
312  * ioctl commands in 32 bit emulation
313  */
314 #define EXT3_IOC32_GETFLAGS FS_IOC32_GETFLAGS
315 #define EXT3_IOC32_SETFLAGS FS_IOC32_SETFLAGS
316 #define EXT3_IOC32_GETVERSION _IOR('f', 3, int)
317 #define EXT3_IOC32_SETVERSION _IOW('f', 4, int)
318 #define EXT3_IOC32_GETRSVSZ _IOR('f', 5, int)
319 #define EXT3_IOC32_SETRSVSZ _IOW('f', 6, int)
320 #define EXT3_IOC32_GROUP_EXTEND _IOW('f', 7, unsigned int)
321 #ifdef CONFIG_JBD_DEBUG
322 #define EXT3_IOC32_WAIT_FOR_READONLY _IOR('f', 99, int)
323 #endif
324 #define EXT3_IOC32_GETVERSION_OLD FS_IOC32_GETVERSION
325 #define EXT3_IOC32_SETVERSION_OLD FS_IOC32_SETVERSION
326 
327 
328 /*
329  * Mount options
330  */
332  unsigned long s_mount_opt;
335  unsigned long s_commit_interval;
336 #ifdef CONFIG_QUOTA
337  int s_jquota_fmt;
338  char *s_qf_names[MAXQUOTAS];
339 #endif
340 };
341 
342 /*
343  * Structure of an inode on the disk
344  */
345 struct ext3_inode {
346  __le16 i_mode; /* File mode */
347  __le16 i_uid; /* Low 16 bits of Owner Uid */
348  __le32 i_size; /* Size in bytes */
349  __le32 i_atime; /* Access time */
350  __le32 i_ctime; /* Creation time */
351  __le32 i_mtime; /* Modification time */
352  __le32 i_dtime; /* Deletion Time */
353  __le16 i_gid; /* Low 16 bits of Group Id */
354  __le16 i_links_count; /* Links count */
355  __le32 i_blocks; /* Blocks count */
356  __le32 i_flags; /* File flags */
357  union {
358  struct {
360  } linux1;
361  struct {
363  } hurd1;
364  struct {
366  } masix1;
367  } osd1; /* OS dependent 1 */
368  __le32 i_block[EXT3_N_BLOCKS];/* Pointers to blocks */
369  __le32 i_generation; /* File version (for NFS) */
370  __le32 i_file_acl_lo; /* File ACL */
372  __le32 i_obso_faddr; /* Obsoleted fragment address */
373  union {
374  struct {
375  __le16 l_i_blocks_high; /* were l_i_reserved1 */
377  __le16 l_i_uid_high; /* these 2 fields */
378  __le16 l_i_gid_high; /* were reserved2[0] */
380  } linux2;
381  struct {
382  __le16 h_i_reserved1; /* Obsoleted fragment number/size which are removed in ext4 */
387  } hurd2;
388  struct {
389  __le16 h_i_reserved1; /* Obsoleted fragment number/size which are removed in ext4 */
392  } masix2;
393  } osd2; /* OS dependent 2 */
396  __le32 i_ctime_extra; /* extra Change time (nsec << 2 | epoch) */
397  __le32 i_mtime_extra; /* extra Modification time(nsec << 2 | epoch) */
398  __le32 i_atime_extra; /* extra Access time (nsec << 2 | epoch) */
399  __le32 i_crtime; /* File Creation time */
400  __le32 i_crtime_extra; /* extra FileCreationtime (nsec << 2 | epoch) */
401  __le32 i_version_hi; /* high 32 bits for 64-bit version */
402 };
403 
404 #define i_disk_version osd1.linux1.l_i_version
405 
406 #if defined(__KERNEL__) || defined(__linux__)
407 #define i_reserved1 osd1.linux1.l_i_reserved1
408 #define i_file_acl_high osd2.linux2.l_i_file_acl_high
409 #define i_blocks_high osd2.linux2.l_i_blocks_high
410 #define i_uid_low i_uid
411 #define i_gid_low i_gid
412 #define i_uid_high osd2.linux2.l_i_uid_high
413 #define i_gid_high osd2.linux2.l_i_gid_high
414 #define i_reserved2 osd2.linux2.l_i_reserved2
415 #endif
416 /*
417  * File system states
418  */
419 #define EXT3_VALID_FS 0x0001 /* Unmounted cleanly */
420 #define EXT3_ERROR_FS 0x0002 /* Errors detected */
421 #define EXT3_ORPHAN_FS 0x0004 /* Orphans being recovered */
422 
423 /*
424  * Mount flags
425  */
426 #define EXT3_MOUNT_CHECK 0x00001 /* Do mount-time checks */
427 #define EXT3_MOUNT_OLDALLOC 0x00002 /* Don't use the new Orlov allocator */
428 #define EXT3_MOUNT_GRPID 0x00004 /* Create files with directory's group */
429 #define EXT3_MOUNT_DEBUG 0x00008 /* Some debugging messages */
430 #define EXT3_MOUNT_ERRORS_CONT 0x00010 /* Continue on errors */
431 #define EXT3_MOUNT_ERRORS_RO 0x00020 /* Remount fs ro on errors */
432 #define EXT3_MOUNT_ERRORS_PANIC 0x00040 /* Panic on errors */
433 #define EXT3_MOUNT_MINIX_DF 0x00080 /* Mimics the Minix statfs */
434 #define EXT3_MOUNT_NOLOAD 0x00100 /* Don't use existing journal*/
435 #define EXT3_MOUNT_ABORT 0x00200 /* Fatal error detected */
436 #define EXT3_MOUNT_DATA_FLAGS 0x00C00 /* Mode for data writes: */
437 #define EXT3_MOUNT_JOURNAL_DATA 0x00400 /* Write data to journal */
438 #define EXT3_MOUNT_ORDERED_DATA 0x00800 /* Flush data before commit */
439 #define EXT3_MOUNT_WRITEBACK_DATA 0x00C00 /* No data ordering */
440 #define EXT3_MOUNT_UPDATE_JOURNAL 0x01000 /* Update the journal format */
441 #define EXT3_MOUNT_NO_UID32 0x02000 /* Disable 32-bit UIDs */
442 #define EXT3_MOUNT_XATTR_USER 0x04000 /* Extended user attributes */
443 #define EXT3_MOUNT_POSIX_ACL 0x08000 /* POSIX Access Control Lists */
444 #define EXT3_MOUNT_RESERVATION 0x10000 /* Preallocation */
445 #define EXT3_MOUNT_BARRIER 0x20000 /* Use block barriers */
446 #define EXT3_MOUNT_NOBH 0x40000 /* No bufferheads */
447 #define EXT3_MOUNT_QUOTA 0x80000 /* Some quota option set */
448 #define EXT3_MOUNT_USRQUOTA 0x100000 /* "old" user quota */
449 #define EXT3_MOUNT_GRPQUOTA 0x200000 /* "old" group quota */
450 
451 /* Compatibility, for having both ext2_fs.h and ext3_fs.h included at once */
452 #ifndef _LINUX_EXT2_FS_H
453 #define clear_opt(o, opt) o &= ~EXT3_MOUNT_##opt
454 #define set_opt(o, opt) o |= EXT3_MOUNT_##opt
455 #define test_opt(sb, opt) (EXT3_SB(sb)->s_mount_opt & \
456  EXT3_MOUNT_##opt)
457 #else
458 #define EXT2_MOUNT_NOLOAD EXT3_MOUNT_NOLOAD
459 #define EXT2_MOUNT_ABORT EXT3_MOUNT_ABORT
460 #define EXT2_MOUNT_DATA_FLAGS EXT3_MOUNT_DATA_FLAGS
461 #endif
462 
463 #define ext3_set_bit ext2_set_bit
464 #define ext3_set_bit_atomic ext2_set_bit_atomic
465 #define ext3_clear_bit ext2_clear_bit
466 #define ext3_clear_bit_atomic ext2_clear_bit_atomic
467 #define ext3_test_bit ext2_test_bit
468 #define ext3_find_first_zero_bit ext2_find_first_zero_bit
469 #define ext3_find_next_zero_bit ext2_find_next_zero_bit
470 
471 /*
472  * Maximal mount counts between two filesystem checks
473  */
474 #define EXT3_DFL_MAX_MNT_COUNT 20 /* Allow 20 mounts */
475 #define EXT3_DFL_CHECKINTERVAL 0 /* Don't use interval check */
476 
477 /*
478  * Behaviour when detecting errors
479  */
480 #define EXT3_ERRORS_CONTINUE 1 /* Continue execution */
481 #define EXT3_ERRORS_RO 2 /* Remount fs read-only */
482 #define EXT3_ERRORS_PANIC 3 /* Panic */
483 #define EXT3_ERRORS_DEFAULT EXT3_ERRORS_CONTINUE
484 
485 /*
486  * Structure of the super block
487  */
489  /*00*/
490  __le32 s_inodes_count; /* Inodes count */
491  __le32 s_blocks_count; /* Blocks count */
492  __le32 s_r_blocks_count; /* Reserved blocks count */
493  __le32 s_free_blocks_count; /* Free blocks count */
494  /*10*/
495  __le32 s_free_inodes_count; /* Free inodes count */
496  __le32 s_first_data_block; /* First Data Block */
497  __le32 s_log_block_size; /* Block size */
498  __le32 s_obso_log_frag_size; /* Obsoleted fragment size */
499  /*20*/
500  __le32 s_blocks_per_group; /* # Blocks per group */
501  __le32 s_obso_frags_per_group; /* Obsoleted fragments per group */
502  __le32 s_inodes_per_group; /* # Inodes per group */
503  __le32 s_mtime; /* Mount time */
504  /*30*/
505  __le32 s_wtime; /* Write time */
506  __le16 s_mnt_count; /* Mount count */
507  __le16 s_max_mnt_count; /* Maximal mount count */
508  __le16 s_magic; /* Magic signature */
509  __le16 s_state; /* File system state */
510  __le16 s_errors; /* Behaviour when detecting errors */
511  __le16 s_minor_rev_level; /* minor revision level */
512  /*40*/
513  __le32 s_lastcheck; /* time of last check */
514  __le32 s_checkinterval; /* max. time between checks */
516  __le32 s_rev_level; /* Revision level */
517  /*50*/
518  __le16 s_def_resuid; /* Default uid for reserved blocks */
519  __le16 s_def_resgid; /* Default gid for reserved blocks */
520  /*
521  * These fields are for EXT4_DYNAMIC_REV superblocks only.
522  *
523  * Note: the difference between the compatible feature set and
524  * the incompatible feature set is that if there is a bit set
525  * in the incompatible feature set that the kernel doesn't
526  * know about, it should refuse to mount the filesystem.
527  *
528  * e2fsck's requirements are more strict; if it doesn't know
529  * about a feature in either the compatible or incompatible
530  * feature set, it must abort and not try to meddle with
531  * things it doesn't understand...
532  */
533  __le32 s_first_ino; /* First non-reserved inode */
534  __le16 s_inode_size; /* size of inode structure */
535  __le16 s_block_group_nr; /* block group # of this superblock */
536  __le32 s_feature_compat; /* compatible feature set */
537  /*60*/
538  __le32 s_feature_incompat; /* incompatible feature set */
539  __le32 s_feature_ro_compat; /* readonly-compatible feature set */
540  /*68*/
541  __u8 s_uuid[16]; /* 128-bit uuid for volume */
542  /*78*/
543  char s_volume_name[16]; /* volume name */
544  /*88*/
545  char s_last_mounted[64]; /* directory where last mounted */
546  /*C8*/
547  __le32 s_algorithm_usage_bitmap; /* For compression */
548  /*
549  * Performance hints. Directory preallocation should only
550  * happen if the EXT4_FEATURE_COMPAT_DIR_PREALLOC flag is on.
551  */
552  __u8 s_prealloc_blocks; /* Nr of blocks to try to preallocate*/
553  __u8 s_prealloc_dir_blocks; /* Nr to preallocate for dirs */
554  __le16 s_reserved_gdt_blocks; /* Per group desc for online growth */
555  /*
556  * Journaling support valid if EXT4_FEATURE_COMPAT_HAS_JOURNAL set.
557  */
558  /*D0*/
559  __u8 s_journal_uuid[16]; /* uuid of journal superblock */
560  /*E0*/
561  __le32 s_journal_inum; /* inode number of journal file */
562  __le32 s_journal_dev; /* device number of journal file */
563  __le32 s_last_orphan; /* start of list of inodes to delete */
564  __le32 s_hash_seed[4]; /* HTREE hash seed */
565  __u8 s_def_hash_version; /* Default hash version to use */
567  __le16 s_desc_size; /* size of group descriptor */
568  /*100*/
570  __le32 s_first_meta_bg; /* First metablock block group */
571  __le32 s_mkfs_time; /* When the filesystem was created */
572  __le32 s_jnl_blocks[17]; /* Backup of the journal inode */
573  /* 64bit support valid if EXT4_FEATURE_COMPAT_64BIT */
574  /*150*/
575  __le32 s_blocks_count_hi; /* Blocks count */
576  __le32 s_r_blocks_count_hi; /* Reserved blocks count */
577  __le32 s_free_blocks_count_hi; /* Free blocks count */
578  __le16 s_min_extra_isize; /* All inodes have at least # bytes */
579  __le16 s_want_extra_isize; /* New inodes should reserve # bytes */
580  __le32 s_flags; /* Miscellaneous flags */
581  __le16 s_raid_stride; /* RAID stride */
582  __le16 s_mmp_interval; /* # seconds to wait in MMP checking */
583  __le64 s_mmp_block; /* Block for multi-mount protection */
584  __le32 s_raid_stripe_width; /* blocks on all data disks (N*stride)*/
585  __u8 s_log_groups_per_flex; /* FLEX_BG group size */
588  __u32 s_reserved[162]; /* Padding to the end of the block */
589 };
590 
591 #ifdef __KERNEL__
592 #include <linux/ext3_fs_i.h>
593 #include <linux/ext3_fs_sb.h>
594 static inline struct ext3_sb_info * EXT3_SB(struct super_block *sb)
595 {
596  return sb->s_fs_info;
597 }
598 static inline struct inode *EXT3_I(struct inode *inode)
599 {
600  return inode;
601 }
602 
603 static inline int ext3_valid_inum(struct super_block *sb, unsigned long ino)
604 {
605  return ino == EXT3_ROOT_INO ||
606  ino == EXT3_JOURNAL_INO ||
607  ino == EXT3_RESIZE_INO ||
608  (ino >= EXT3_FIRST_INO(sb) &&
609  ino <= le32_to_cpu(EXT3_SB(sb)->s_es->s_inodes_count));
610 }
611 #else
612 /* Assume that user mode programs are passing in an ext3fs superblock, not
613  * a kernel struct super_block. This will allow us to call the feature-test
614  * macros from user land. */
615 #define EXT3_SB(sb) (sb)
616 #endif
617 
618 
619 #define NEXT_ORPHAN(inode) EXT3_I(inode)->i_dtime
620 
621 /*
622  * Codes for operating systems
623  */
624 #define EXT3_OS_LINUX 0
625 #define EXT3_OS_HURD 1
626 #define EXT3_OS_MASIX 2
627 #define EXT3_OS_FREEBSD 3
628 #define EXT3_OS_LITES 4
629 
630 /*
631  * Revision levels
632  */
633 #define EXT3_GOOD_OLD_REV 0 /* The good old (original) format */
634 #define EXT3_DYNAMIC_REV 1 /* V2 format w/ dynamic inode sizes */
635 
636 #define EXT3_CURRENT_REV EXT3_GOOD_OLD_REV
637 #define EXT3_MAX_SUPP_REV EXT3_DYNAMIC_REV
638 
639 #define EXT3_GOOD_OLD_INODE_SIZE 128
640 
641 /*
642  * Feature set definitions
643  */
644 
645 #define EXT3_HAS_COMPAT_FEATURE(sb,mask) \
646  ( EXT3_SB(sb)->s_es->s_feature_compat & cpu_to_le32(mask) )
647 #define EXT3_HAS_RO_COMPAT_FEATURE(sb,mask) \
648  ( EXT3_SB(sb)->s_es->s_feature_ro_compat & cpu_to_le32(mask) )
649 #define EXT3_HAS_INCOMPAT_FEATURE(sb,mask) \
650  ( EXT3_SB(sb)->s_es->s_feature_incompat & cpu_to_le32(mask) )
651 #define EXT3_SET_COMPAT_FEATURE(sb,mask) \
652  EXT3_SB(sb)->s_es->s_feature_compat |= cpu_to_le32(mask)
653 #define EXT3_SET_RO_COMPAT_FEATURE(sb,mask) \
654  EXT3_SB(sb)->s_es->s_feature_ro_compat |= cpu_to_le32(mask)
655 #define EXT3_SET_INCOMPAT_FEATURE(sb,mask) \
656  EXT3_SB(sb)->s_es->s_feature_incompat |= cpu_to_le32(mask)
657 #define EXT3_CLEAR_COMPAT_FEATURE(sb,mask) \
658  EXT3_SB(sb)->s_es->s_feature_compat &= ~cpu_to_le32(mask)
659 #define EXT3_CLEAR_RO_COMPAT_FEATURE(sb,mask) \
660  EXT3_SB(sb)->s_es->s_feature_ro_compat &= ~cpu_to_le32(mask)
661 #define EXT3_CLEAR_INCOMPAT_FEATURE(sb,mask) \
662  EXT3_SB(sb)->s_es->s_feature_incompat &= ~cpu_to_le32(mask)
663 
664 #define EXT3_FEATURE_COMPAT_DIR_PREALLOC 0x0001
665 #define EXT3_FEATURE_COMPAT_IMAGIC_INODES 0x0002
666 #define EXT3_FEATURE_COMPAT_HAS_JOURNAL 0x0004
667 #define EXT3_FEATURE_COMPAT_EXT_ATTR 0x0008
668 #define EXT3_FEATURE_COMPAT_RESIZE_INODE 0x0010
669 #define EXT3_FEATURE_COMPAT_DIR_INDEX 0x0020
670 
671 #define EXT3_FEATURE_RO_COMPAT_SPARSE_SUPER 0x0001
672 #define EXT3_FEATURE_RO_COMPAT_LARGE_FILE 0x0002
673 #define EXT3_FEATURE_RO_COMPAT_BTREE_DIR 0x0004
674 #define EXT4_FEATURE_RO_COMPAT_GDT_CSUM 0x0010
675 #define EXT4_FEATURE_RO_COMPAT_DIR_NLINK 0x0020
676 #define EXT4_FEATURE_RO_COMPAT_EXTRA_ISIZE 0x0040
677 
678 #define EXT3_FEATURE_INCOMPAT_COMPRESSION 0x0001
679 #define EXT3_FEATURE_INCOMPAT_FILETYPE 0x0002
680 #define EXT3_FEATURE_INCOMPAT_RECOVER 0x0004 /* Needs recovery */
681 #define EXT3_FEATURE_INCOMPAT_JOURNAL_DEV 0x0008 /* Journal device */
682 #define EXT3_FEATURE_INCOMPAT_META_BG 0x0010
683 #define EXT3_FEATURE_INCOMPAT_EXTENTS 0x0040 /* extents support */
684 #define EXT3_FEATURE_INCOMPAT_MMP 0x0100
685 #define EXT3_FEATURE_INCOMPAT_DIRDATA 0x1000
686 
687 #define EXT3_FEATURE_COMPAT_SUPP EXT2_FEATURE_COMPAT_EXT_ATTR
688 
689 #define EXT4_FEATURE_COMPAT_DIR_PREALLOC 0x0001
690 #define EXT4_FEATURE_COMPAT_IMAGIC_INODES 0x0002
691 #define EXT4_FEATURE_COMPAT_HAS_JOURNAL 0x0004
692 #define EXT4_FEATURE_COMPAT_EXT_ATTR 0x0008
693 #define EXT4_FEATURE_COMPAT_RESIZE_INODE 0x0010
694 #define EXT4_FEATURE_COMPAT_DIR_INDEX 0x0020
695 
696 #define EXT4_FEATURE_RO_COMPAT_SPARSE_SUPER 0x0001
697 #define EXT4_FEATURE_RO_COMPAT_LARGE_FILE 0x0002
698 #define EXT4_FEATURE_RO_COMPAT_BTREE_DIR 0x0004
699 #define EXT4_FEATURE_RO_COMPAT_HUGE_FILE 0x0008
700 #define EXT4_FEATURE_RO_COMPAT_GDT_CSUM 0x0010
701 #define EXT4_FEATURE_RO_COMPAT_DIR_NLINK 0x0020
702 #define EXT4_FEATURE_RO_COMPAT_EXTRA_ISIZE 0x0040
703 
704 #define EXT4_FEATURE_INCOMPAT_COMPRESSION 0x0001
705 #define EXT4_FEATURE_INCOMPAT_FILETYPE 0x0002
706 #define EXT4_FEATURE_INCOMPAT_RECOVER 0x0004 /* Needs recovery */
707 #define EXT4_FEATURE_INCOMPAT_JOURNAL_DEV 0x0008 /* Journal device */
708 #define EXT4_FEATURE_INCOMPAT_META_BG 0x0010
709 #define EXT4_FEATURE_INCOMPAT_EXTENTS 0x0040 /* extents support */
710 #define EXT4_FEATURE_INCOMPAT_64BIT 0x0080
711 #define EXT4_FEATURE_INCOMPAT_MMP 0x0100
712 #define EXT4_FEATURE_INCOMPAT_FLEX_BG 0x0200
713 #define EXT4_FEATURE_INCOMPAT_DIRDATA 0x1000 /* used by Lustre - ldiskfs */
714 #define EXT4_FEATURE_INCOMPAT_BG_USE_META_CSUM 0x2000 /* use crc32c for bg */
715 #define EXT4_FEATURE_INCOMPAT_LARGEDIR 0x4000 /* >2GB or 3-lvl htree */
716 #define EXT4_FEATURE_INCOMPAT_INLINEDATA 0x8000 /* data in inode */
717 
718 #define EXT4_FEATURE_INCOMPAT_SUPP ( \
719  EXT4_FEATURE_INCOMPAT_FILETYPE| \
720  EXT4_FEATURE_INCOMPAT_RECOVER| \
721  EXT4_FEATURE_INCOMPAT_META_BG| \
722  EXT4_FEATURE_INCOMPAT_EXTENTS| \
723  EXT4_FEATURE_INCOMPAT_FLEX_BG)
724 #define EXT4_FEATURE_RO_COMPAT_SUPP ( \
725  EXT4_FEATURE_RO_COMPAT_SPARSE_SUPER| \
726  EXT4_FEATURE_RO_COMPAT_LARGE_FILE| \
727  EXT4_FEATURE_RO_COMPAT_GDT_CSUM| \
728  EXT4_FEATURE_RO_COMPAT_DIR_NLINK | \
729  EXT4_FEATURE_RO_COMPAT_EXTRA_ISIZE | \
730  EXT4_FEATURE_RO_COMPAT_BTREE_DIR | \
731  EXT4_FEATURE_RO_COMPAT_HUGE_FILE)
732 
733 #define EXT4_BG_INODE_UNINIT 0x0001 /* Inode table/bitmap not in use */
734 #define EXT4_BG_BLOCK_UNINIT 0x0002 /* Block bitmap not in use */
735 #define EXT4_BG_INODE_ZEROED 0x0004 /* On-disk itable initialized to zero */
736 
737 /*
738  * Default values for user and/or group using reserved blocks
739  */
740 #define EXT3_DEF_RESUID 0
741 #define EXT3_DEF_RESGID 0
742 
743 /*
744  * Default mount options
745  */
746 #define EXT3_DEFM_DEBUG 0x0001
747 #define EXT3_DEFM_BSDGROUPS 0x0002
748 #define EXT3_DEFM_XATTR_USER 0x0004
749 #define EXT3_DEFM_ACL 0x0008
750 #define EXT3_DEFM_UID16 0x0010
751 #define EXT3_DEFM_JMODE 0x0060
752 #define EXT3_DEFM_JMODE_DATA 0x0020
753 #define EXT3_DEFM_JMODE_ORDERED 0x0040
754 #define EXT3_DEFM_JMODE_WBACK 0x0060
755 
756 /*
757  * Structure of a directory entry
758  */
759 #define EXT3_NAME_LEN 255
760 
762  __le32 inode; /* Inode number */
763  __le16 rec_len; /* Directory entry length */
764  __le16 name_len; /* Name length */
765  char name[EXT3_NAME_LEN]; /* File name */
766 };
767 
768 /*
769  * The new version of the directory entry. Since EXT3 structures are
770  * stored in intel byte order, and the name_len field could never be
771  * bigger than 255 chars, it's safe to reclaim the extra byte for the
772  * file_type field.
773  */
775  __le32 inode; /* Inode number */
776  __le16 rec_len; /* Directory entry length */
777  __u8 name_len; /* Name length */
779  char name[EXT3_NAME_LEN]; /* File name */
780 };
781 
782 /*
783  * Ext3 directory file types. Only the low 3 bits are used. The
784  * other bits are reserved for now.
785  */
786 #define EXT3_FT_UNKNOWN 0
787 #define EXT3_FT_REG_FILE 1
788 #define EXT3_FT_DIR 2
789 #define EXT3_FT_CHRDEV 3
790 #define EXT3_FT_BLKDEV 4
791 #define EXT3_FT_FIFO 5
792 #define EXT3_FT_SOCK 6
793 #define EXT3_FT_SYMLINK 7
794 
795 #define EXT3_FT_MAX 8
796 #define EXT3_FT_MASK 0xf
797 
798 #if EXT3_FT_MAX > EXT3_FT_MASK
799 #error "conflicting EXT3_FT_MAX and EXT3_FT_MASK"
800 #endif
801 
802 #define EXT3_LUFID_MAGIC 0xAD200907UL
803 
804 #pragma pack(1)
806  __u32 edp_magic; /* EXT3_LUFID_MAGIC */
807  char edp_len; /* size of edp_data in bytes */
808  char edp_data[0]; /* packed array of data */
809 } __attribute__((packed));
810 #pragma pack()
811 
812 static inline unsigned char *ext3_dentry_get_data(struct super_block *sb,
813  struct ext3_dentry_param* p)
814 
815 {
817  return NULL;
818  if (p && p->edp_magic == EXT3_LUFID_MAGIC)
819  return &p->edp_len;
820  else
821  return NULL;
822 }
823 
824 /*
825  * Compute the total directory entry data length.
826  * This includes the filename and an implicit NUL terminator (always present),
827  * and optional extensions. Each extension has a bit set in the high 4 bits of
828  * de->file_type, and the extension length is the first byte in each entry.
829  */
830 
831 static inline int ext3_get_dirent_data_len(struct ext3_dir_entry_2 *de)
832 {
833  char *len = de->name + de->name_len + 1 /* NUL terminator */;
834  int dlen = 0;
835  __u8 extra_data_flags = (de->file_type & ~EXT3_FT_MASK) >> 4;
836 
837  while (extra_data_flags) {
838  if (extra_data_flags & 1) {
839  dlen += *len + (dlen == 0);
840  len += *len;
841  }
842  extra_data_flags >>= 1;
843  }
844  return dlen;
845 }
846 
847 /*
848  * d_type has 4 unused bits, so it can hold four types data. these different
849  * type of data (e.g. lustre data, high 32 bits of 64-bit inode number) can be
850  * stored, in flag order, after file-name in ext3 dirent.
851 */
852 /*
853  * this flag is added to d_type if ext3 dirent has extra data after
854  * filename. this data length is variable and length is stored in first byte
855  * of data. data start after filename NUL byte.
856  * This is used by Lustre FS.
857  */
858 
859 #define EXT3_DIRENT_LUFID 0x10
860 /*
861  * EXT3_DIR_PAD defines the directory entries boundaries
862  *
863  * NOTE: It must be a multiple of 4
864  */
865 #define EXT3_DIR_PAD 4
866 #define EXT3_DIR_ROUND (EXT3_DIR_PAD - 1)
867 #define EXT3_DIR_REC_LEN(len) (((len) + 8 + EXT3_DIR_ROUND) & \
868  ~EXT3_DIR_ROUND)
869 #define EXT3_MAX_REC_LEN ((1<<16)-1)
870 
871 static inline unsigned ext3_rec_len_from_disk(__le16 dlen)
872 {
873  unsigned len = le16_to_cpu(dlen);
874 
875  if (len == EXT3_MAX_REC_LEN || len == 0)
876  return 1 << 16;
877  return len;
878 }
879 
880 static inline __le16 ext3_rec_len_to_disk(unsigned len)
881 {
882  if (len == (1 << 16))
884  else if (len > (1 << 16))
885  BUG();
886  return cpu_to_le16(len);
887 }
888 
889 /*
890  * Hash Tree Directory indexing
891  * (c) Daniel Phillips, 2001
892  */
893 
894 #ifdef EXT2_HTREE_INDEX
895 #define is_dx(dir) (EXT3_HAS_COMPAT_FEATURE(dir->i_sb, \
896  EXT3_FEATURE_COMPAT_DIR_INDEX) && \
897  (EXT3_I(dir)->i_flags & EXT3_INDEX_FL))
898 #define EXT3_DIR_LINK_MAX(dir) (!is_dx(dir) && (dir)->i_nlink >= EXT3_LINK_MAX)
899 #define EXT3_DIR_LINK_EMPTY(dir) ((dir)->i_nlink == 2 || (dir)->i_nlink == 1)
900 #else
901 #define is_dx(dir) 0
902 #define EXT3_DIR_LINK_MAX(dir) ((dir)->i_nlink >= EXT3_LINK_MAX)
903 #define EXT3_DIR_LINK_EMPTY(dir) ((dir)->i_nlink == 2)
904 #endif
905 
906 /* Legal values for the dx_root hash_version field: */
907 
908 #define DX_HASH_LEGACY 0
909 #define DX_HASH_HALF_MD4 1
910 #define DX_HASH_TEA 2
911 #define DX_HASH_LEGACY_UNSIGNED 3
912 #define DX_HASH_HALF_MD4_UNSIGNED 4
913 #define DX_HASH_TEA_UNSIGNED 5
914 
915 
916 #ifdef __KERNEL__
917 
918 /* hash info structure used by the directory hash */
919 struct dx_hash_info
920 {
921  u32 hash;
922  u32 minor_hash;
923  int hash_version;
924  u32 *seed;
925 };
926 
927 #define EXT3_HTREE_EOF 0x7fffffff
928 
929 /* 32 and 64 bit signed EOF for dx directories */
930 #define EXT4_HTREE_EOF_32BIT ((1UL << (32 - 1)) - 1)
931 #define EXT4_HTREE_EOF_64BIT ((1ULL << (64 - 1)) - 1
932 
933 /*
934  * Control parameters used by ext3_htree_next_block
935  */
936 #define HASH_NB_ALWAYS 1
937 
938 
939 /*
940  * Describe an inode's exact location on disk and in memory
941  */
942 struct ext3_iloc
943 {
944  struct buffer_head *bh;
945  unsigned long offset;
946  unsigned long block_group;
947 };
948 
949 static inline struct ext3_inode *ext3_raw_inode(struct ext3_iloc *iloc)
950 {
951  return (struct ext3_inode *) (iloc->bh->b_data + iloc->offset);
952 }
953 
954 /*
955  * This structure is stuffed into the struct file's private_data field
956  * for directories. It is where we put information so that we can do
957  * readdir operations in hash tree order.
958  */
959 struct dir_private_info {
960  struct rb_root root;
961  struct rb_node *curr_node;
962  struct fname *extra_fname;
963  loff_t last_pos;
964  __u32 curr_hash;
965  __u32 curr_minor_hash;
966  __u32 next_hash;
967 };
968 
969 /* calculate the first block number of the group */
970 static inline ext3_fsblk_t
971 ext3_group_first_block_no(struct super_block *sb, unsigned long group_no)
972 {
973  return group_no * (ext3_fsblk_t)EXT3_BLOCKS_PER_GROUP(sb) +
974  le32_to_cpu(EXT3_SB(sb)->s_es->s_first_data_block);
975 }
976 
977 /*
978  * Special error return code only used by dx_probe() and its callers.
979  */
980 #define ERR_BAD_DX_DIR -75000
981 
982 /*
983  * This structure will be used for multiple mount protection. It will be
984  * written into the block number saved in the s_mmp_block field in the
985  * superblock. Programs that check MMP should assume that if
986  * SEQ_FSCK (or any unknown code above SEQ_MAX) is present then it is NOT safe
987  * to use the filesystem, regardless of how old the timestamp is.
988  */
989 #define EXT3_MMP_MAGIC 0x004D4D50U /* ASCII for MMP */
990 #define EXT3_MMP_SEQ_CLEAN 0xFF4D4D50U /* mmp_seq value for clean unmount */
991 #define EXT3_MMP_SEQ_FSCK 0xE24D4D50U /* mmp_seq value when being fscked */
992 #define EXT3_MMP_SEQ_MAX 0xE24D4D4FU /* maximum valid mmp_seq value */
993 
994 struct mmp_struct {
995  __le32 mmp_magic;
996  __le32 mmp_seq;
997  __le64 mmp_time;
998  char mmp_nodename[64];
999  char mmp_bdevname[32];
1000  __le16 mmp_check_interval;
1001  __le16 mmp_pad1;
1002  __le32 mmp_pad2[227];
1003 };
1004 
1005 /*
1006  * Default interval in seconds to update the MMP sequence number.
1007  */
1008 #define EXT3_MMP_UPDATE_INTERVAL 1
1009 
1010 /*
1011  * Minimum interval for MMP checking in seconds.
1012  */
1013 #define EXT3_MMP_MIN_CHECK_INTERVAL 5
1014 
1015 /*
1016  * Indicates that ctime should not be updated in ext3_xattr_set_handle()
1017  */
1018 #ifndef XATTR_NO_CTIME
1019 #define XATTR_NO_CTIME 0x80
1020 #endif
1021 
1022 /*
1023  * NOTE! unlike strncmp, ext3_match returns 1 for success, 0 for failure.
1024  *
1025  * `len <= EXT3_NAME_LEN' is guaranteed by caller.
1026  * `de != NULL' is guaranteed by caller.
1027  */
1028 static inline int ext3_match (int len, const char * const name,
1029  struct ext3_dir_entry_2 * de)
1030 {
1031  if (len != de->name_len)
1032  return 0;
1033  if (!de->inode)
1034  return 0;
1035  return !_strnicmp(name, de->name, len);
1036 }
1037 
1038 #endif /* __KERNEL__ */
1039 #endif /* _LINUX_EXT3_FS_H */
__le16 bg_free_inodes_count_hi
Definition: ext3_fs.h:150
unsigned char __u8
Definition: compat.h:88
__le32 s_checkinterval
Definition: ext3_fs.h:514
__le16 h_i_reserved1
Definition: ext3_fs.h:382
Definition: ext3_fs.h:761
__le32 i_flags
Definition: ext3_fs.h:356
__le32 i_dtime
Definition: ext3_fs.h:352
__le32 bg_block_bitmap
Definition: ext3_fs.h:121
__le16 s_min_extra_isize
Definition: ext3_fs.h:578
__le16 l_i_uid_high
Definition: ext3_fs.h:377
__le16 i_pad1
Definition: ext3_fs.h:395
__le16 i_uid
Definition: ext3_fs.h:347
__le32 i_atime_extra
Definition: ext3_fs.h:398
__le32 i_block[EXT3_N_BLOCKS]
Definition: ext3_fs.h:368
__le32 s_free_blocks_count_hi
Definition: ext3_fs.h:577
#define EXT3_MAX_REC_LEN
Definition: ext3_fs.h:869
__le32 s_default_mount_opts
Definition: ext3_fs.h:569
GLuint GLenum GLsizei GLsizei GLint GLint GLboolean packed
Definition: glext.h:9271
__le32 s_blocks_count
Definition: ext3_fs.h:491
__le16 bg_free_inodes_count
Definition: ext3_fs.h:140
__le32 s_creator_os
Definition: ext3_fs.h:515
__u32 free_blocks
Definition: ext3_fs.h:162
__le32 i_file_acl_lo
Definition: ext3_fs.h:370
__u32 h_i_author
Definition: ext3_fs.h:386
__le64 s_mmp_block
Definition: ext3_fs.h:583
superblock * sb
Definition: btrfs.c:4137
Definition: ext3_fs.h:774
__le16 bg_used_dirs_count
Definition: ext3_fs.h:141
unsigned long s_mount_opt
Definition: ext3_fs.h:332
#define EXT3_ROOT_INO
Definition: ext3_fs.h:58
__u16 bg_pad
Definition: ext3_fs.h:127
Definition: fs.h:64
__le16 name_len
Definition: ext3_fs.h:764
#define le16_to_cpu
Definition: module.h:149
__le16 l_i_gid_high
Definition: ext3_fs.h:378
__le32 i_version_hi
Definition: ext3_fs.h:401
__u8 s_journal_uuid[16]
Definition: ext3_fs.h:559
GLintptr offset
Definition: glext.h:5920
union ext3_inode::@683 osd1
#define EXT3_LUFID_MAGIC
Definition: ext3_fs.h:802
__le32 l_i_version
Definition: ext3_fs.h:359
__le32 bg_inode_bitmap
Definition: ext3_fs.h:122
__u16 h_i_gid_high
Definition: ext3_fs.h:385
__le16 bg_free_blocks_count
Definition: ext3_fs.h:139
__le16 i_links_count
Definition: ext3_fs.h:354
__le16 bg_itable_unused
Definition: ext3_fs.h:144
__le16 s_want_extra_isize
Definition: ext3_fs.h:579
__le32 i_size
Definition: ext3_fs.h:348
long uid_t
Definition: various.h:8
__le32 s_feature_compat
Definition: ext3_fs.h:536
ULONG32 u32
Definition: btrfs.h:14
__le32 s_r_blocks_count_hi
Definition: ext3_fs.h:576
__le32 bg_inode_table_hi
Definition: ext3_fs.h:148
__le32 s_obso_frags_per_group
Definition: ext3_fs.h:501
__le32 inode
Definition: ext3_fs.h:762
__le16 s_block_group_nr
Definition: ext3_fs.h:535
__u8 s_reserved_char_pad2
Definition: ext3_fs.h:586
__le16 bg_used_dirs_count_hi
Definition: ext3_fs.h:151
#define EXT3_NAME_LEN
Definition: ext3_fs.h:759
Definition: fs.h:78
__le32 i_mtime_extra
Definition: ext3_fs.h:397
char s_volume_name[16]
Definition: ext3_fs.h:543
__le16 s_mmp_interval
Definition: ext3_fs.h:582
__le32 s_free_blocks_count
Definition: ext3_fs.h:493
__le32 s_journal_dev
Definition: ext3_fs.h:562
__le16 s_mnt_count
Definition: ext3_fs.h:506
char name[EXT3_NAME_LEN]
Definition: ext3_fs.h:779
__u32 s_reserved[162]
Definition: ext3_fs.h:588
char s_last_mounted[64]
Definition: ext3_fs.h:545
int hash
Definition: main.c:58
__le16 bg_free_inodes_count
Definition: ext3_fs.h:125
UINT gid_t
Definition: types.h:89
#define EXT3_FEATURE_INCOMPAT_DIRDATA
Definition: ext3_fs.h:685
__le32 i_obso_faddr
Definition: ext3_fs.h:372
struct ext3_dentry_param __attribute__((packed))
__le32 s_wtime
Definition: ext3_fs.h:505
__u8 file_type
Definition: ext3_fs.h:778
_Check_return_ _CRTIMP int __cdecl _strnicmp(_In_reads_or_z_(_MaxCount) const char *_Str1, _In_reads_or_z_(_MaxCount) const char *_Str2, _In_ size_t _MaxCount)
__le32 s_algorithm_usage_bitmap
Definition: ext3_fs.h:547
__le16 rec_len
Definition: ext3_fs.h:763
__u32 bg_reserved[2]
Definition: ext3_fs.h:143
#define le32_to_cpu
Definition: module.h:147
__le32 i_generation
Definition: ext3_fs.h:369
#define __le16
Definition: types.h:39
smooth NULL
Definition: ftsmooth.c:416
struct ext3_inode::@683::@685 linux1
__le32 bg_inode_table
Definition: ext3_fs.h:138
__le16 i_mode
Definition: ext3_fs.h:346
__le32 i_atime
Definition: ext3_fs.h:349
__le16 s_reserved_gdt_blocks
Definition: ext3_fs.h:554
__u8 s_reserved_char_pad
Definition: ext3_fs.h:566
static int ext3_get_dirent_data_len(struct ext3_dir_entry_2 *de)
Definition: ext3_fs.h:831
__le16 bg_used_dirs_count
Definition: ext3_fs.h:126
__u32 h_i_translator
Definition: ext3_fs.h:362
__le32 s_feature_incompat
Definition: ext3_fs.h:538
__le32 i_size_high
Definition: ext3_fs.h:371
__le16 s_reserved_pad
Definition: ext3_fs.h:587
struct ext3_inode::@683::@687 masix1
__le32 s_free_inodes_count
Definition: ext3_fs.h:495
__le32 s_inodes_count
Definition: ext3_fs.h:490
__le32 i_mtime
Definition: ext3_fs.h:351
__le32 s_first_data_block
Definition: ext3_fs.h:496
struct ext3_inode::@684::@688 linux2
__u32 free_inodes
Definition: ext3_fs.h:161
__u8 s_def_hash_version
Definition: ext3_fs.h:565
__le32 bg_block_bitmap
Definition: ext3_fs.h:136
__le32 s_lastcheck
Definition: ext3_fs.h:513
__le16 s_minor_rev_level
Definition: ext3_fs.h:511
__u16 h_i_mode_high
Definition: ext3_fs.h:383
__u8 s_uuid[16]
Definition: ext3_fs.h:541
__le16 s_def_resuid
Definition: ext3_fs.h:518
__le32 bg_reserved[3]
Definition: ext3_fs.h:128
unsigned short __u16
Definition: compat.h:89
__le32 s_journal_inum
Definition: ext3_fs.h:561
__le32 s_raid_stripe_width
Definition: ext3_fs.h:584
__le32 bg_inode_table
Definition: ext3_fs.h:123
__le32 s_blocks_per_group
Definition: ext3_fs.h:500
__u32 m_i_reserved1
Definition: ext3_fs.h:365
unsigned int __u32
Definition: compat.h:90
__le32 inode
Definition: ext3_fs.h:775
__le16 s_max_mnt_count
Definition: ext3_fs.h:507
#define EXT3_FIRST_INO(s)
Definition: ext3_fs.h:97
__u32 bg_reserved2[3]
Definition: ext3_fs.h:153
__le32 i_ctime
Definition: ext3_fs.h:350
unsigned __int64 loff_t
Definition: types.h:80
#define EXT3_HAS_INCOMPAT_FEATURE(sb, mask)
Definition: ext3_fs.h:649
char edp_data[0]
Definition: ext3_fs.h:808
__u8 s_prealloc_blocks
Definition: ext3_fs.h:552
__le32 s_rev_level
Definition: ext3_fs.h:516
__le32 bg_inode_bitmap
Definition: ext3_fs.h:137
__u32 l_i_reserved2
Definition: ext3_fs.h:379
__u8 s_log_groups_per_flex
Definition: ext3_fs.h:585
GLenum GLsizei len
Definition: glext.h:6722
__le16 bg_free_blocks_count
Definition: ext3_fs.h:124
__u16 h_i_uid_high
Definition: ext3_fs.h:384
union ext3_inode::@684 osd2
__le32 i_crtime
Definition: ext3_fs.h:399
__le16 s_errors
Definition: ext3_fs.h:510
__le16 bg_free_blocks_count_hi
Definition: ext3_fs.h:149
__le32 s_obso_log_frag_size
Definition: ext3_fs.h:498
struct ext3_inode::@684::@689 hurd2
__u32 m_i_reserved2[2]
Definition: ext3_fs.h:391
__u8 s_prealloc_dir_blocks
Definition: ext3_fs.h:553
struct ext3_inode::@684::@690 masix2
static __le16 ext3_rec_len_to_disk(unsigned len)
Definition: ext3_fs.h:880
__le16 s_desc_size
Definition: ext3_fs.h:567
__le16 s_state
Definition: ext3_fs.h:509
__u16 reserved_blocks
Definition: ext3_fs.h:288
__le32 s_last_orphan
Definition: ext3_fs.h:563
__u8 name_len
Definition: ext3_fs.h:777
#define __le64
Definition: types.h:41
__le32 s_log_block_size
Definition: ext3_fs.h:497
__le16 i_extra_isize
Definition: ext3_fs.h:394
__le32 s_blocks_count_hi
Definition: ext3_fs.h:575
__le32 s_first_meta_bg
Definition: ext3_fs.h:570
__le32 s_hash_seed[4]
Definition: ext3_fs.h:564
__le32 s_mkfs_time
Definition: ext3_fs.h:571
#define EXT3_RESIZE_INO
Definition: ext3_fs.h:61
__le32 s_inodes_per_group
Definition: ext3_fs.h:502
__le32 s_jnl_blocks[17]
Definition: ext3_fs.h:572
static unsigned ext3_rec_len_from_disk(__le16 dlen)
Definition: ext3_fs.h:871
unsigned long s_commit_interval
Definition: ext3_fs.h:335
__le16 bg_flags
Definition: ext3_fs.h:142
Definition: name.c:36
#define BUG()
Definition: types.h:115
__u32 free_blocks_count
Definition: ext3_fs.h:290
Definition: rbtree.h:97
__le32 s_flags
Definition: ext3_fs.h:580
__le16 i_gid
Definition: ext3_fs.h:353
__le32 s_mtime
Definition: ext3_fs.h:503
__le16 rec_len
Definition: ext3_fs.h:776
__le16 s_def_resgid
Definition: ext3_fs.h:519
unsigned long long ext3_fsblk_t
Definition: ext3_fs_i.h:26
__le32 i_ctime_extra
Definition: ext3_fs.h:396
__le32 s_r_blocks_count
Definition: ext3_fs.h:492
#define EXT3_BLOCKS_PER_GROUP(s)
Definition: ext3_fs.h:189
#define EXT3_FT_MASK
Definition: ext3_fs.h:796
GLfloat GLfloat p
Definition: glext.h:8902
__le16 bg_itable_unused_hi
Definition: ext3_fs.h:152
__le16 bg_checksum
Definition: ext3_fs.h:145
#define cpu_to_le16
Definition: module.h:148
__le16 m_i_file_acl_high
Definition: ext3_fs.h:390
__le32 i_crtime_extra
Definition: ext3_fs.h:400
__le32 bg_inode_bitmap_hi
Definition: ext3_fs.h:147
__le16 s_inode_size
Definition: ext3_fs.h:534
#define EXT3_N_BLOCKS
Definition: ext3_fs.h:201
#define EXT3_SB(sb)
Definition: ext3_fs.h:615
__le16 s_raid_stride
Definition: ext3_fs.h:581
__le32 s_feature_ro_compat
Definition: ext3_fs.h:539
struct ext3_inode::@683::@686 hurd1
__le32 bg_block_bitmap_hi
Definition: ext3_fs.h:146
static unsigned char * ext3_dentry_get_data(struct super_block *sb, struct ext3_dentry_param *p)
Definition: ext3_fs.h:812
__le16 s_magic
Definition: ext3_fs.h:508
__le16 l_i_file_acl_high
Definition: ext3_fs.h:376
__le16 l_i_blocks_high
Definition: ext3_fs.h:375
__le32 i_blocks
Definition: ext3_fs.h:355
#define __le32
Definition: types.h:40
__le32 s_first_ino
Definition: ext3_fs.h:533
#define EXT3_JOURNAL_INO
Definition: ext3_fs.h:62