source: svn/newcon3bcm2_21bu/toolchain/mips-linux-uclibc/include/linux/ext3_fs.h @ 47

Last change on this file since 47 was 47, checked in by megakiss, 11 years ago

459Mhz로 OTC 주파수 변경

  • Property svn:executable set to *
File size: 20.4 KB
Line 
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/types.h>
20
21struct statfs;
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#define EXT3_MAX_RESERVE_BLOCKS         1024
37#define EXT3_RESERVE_WINDOW_NOT_ALLOCATED 0
38/*
39 * Always enable hashed directories
40 */
41#define CONFIG_EXT3_INDEX
42
43/*
44 * Debug code
45 */
46#ifdef EXT3FS_DEBUG
47#define ext3_debug(f, a...)                                             \
48        do {                                                            \
49                printk (KERN_DEBUG "EXT3-fs DEBUG (%s, %d): %s:",       \
50                        __FILE__, __LINE__, __FUNCTION__);              \
51                printk (KERN_DEBUG f, ## a);                            \
52        } while (0)
53#else
54#define ext3_debug(f, a...)     do {} while (0)
55#endif
56
57/*
58 * Special inodes numbers
59 */
60#define EXT3_BAD_INO             1      /* Bad blocks inode */
61#define EXT3_ROOT_INO            2      /* Root inode */
62#define EXT3_BOOT_LOADER_INO     5      /* Boot loader inode */
63#define EXT3_UNDEL_DIR_INO       6      /* Undelete directory inode */
64#define EXT3_RESIZE_INO          7      /* Reserved group descriptors inode */
65#define EXT3_JOURNAL_INO         8      /* Journal inode */
66
67/* First non-reserved inode for old ext3 filesystems */
68#define EXT3_GOOD_OLD_FIRST_INO 11
69
70/*
71 * The second extended file system magic number
72 */
73#define EXT3_SUPER_MAGIC        0xEF53
74
75/*
76 * Maximal count of links to a file
77 */
78#define EXT3_LINK_MAX           32000
79
80/*
81 * Macro-instructions used to manage several block sizes
82 */
83#define EXT3_MIN_BLOCK_SIZE             1024
84#define EXT3_MAX_BLOCK_SIZE             4096
85#define EXT3_MIN_BLOCK_LOG_SIZE           10
86# define EXT3_BLOCK_SIZE(s)             (EXT3_MIN_BLOCK_SIZE << (s)->s_log_block_size)
87#define EXT3_ADDR_PER_BLOCK(s)          (EXT3_BLOCK_SIZE(s) / sizeof (__u32))
88# define EXT3_BLOCK_SIZE_BITS(s)        ((s)->s_log_block_size + 10)
89#define EXT3_INODE_SIZE(s)      (((s)->s_rev_level == EXT3_GOOD_OLD_REV) ? \
90                                 EXT3_GOOD_OLD_INODE_SIZE : \
91                                 (s)->s_inode_size)
92#define EXT3_FIRST_INO(s)       (((s)->s_rev_level == EXT3_GOOD_OLD_REV) ? \
93                                 EXT3_GOOD_OLD_FIRST_INO : \
94                                 (s)->s_first_ino)
95
96/*
97 * Macro-instructions used to manage fragments
98 */
99#define EXT3_MIN_FRAG_SIZE              1024
100#define EXT3_MAX_FRAG_SIZE              4096
101#define EXT3_MIN_FRAG_LOG_SIZE            10
102# define EXT3_FRAG_SIZE(s)              (EXT3_MIN_FRAG_SIZE << (s)->s_log_frag_size)
103# define EXT3_FRAGS_PER_BLOCK(s)        (EXT3_BLOCK_SIZE(s) / EXT3_FRAG_SIZE(s))
104
105/*
106 * Structure of a blocks group descriptor
107 */
108struct ext3_group_desc
109{
110        __le32  bg_block_bitmap;                /* Blocks bitmap block */
111        __le32  bg_inode_bitmap;                /* Inodes bitmap block */
112        __le32  bg_inode_table;         /* Inodes table block */
113        __le16  bg_free_blocks_count;   /* Free blocks count */
114        __le16  bg_free_inodes_count;   /* Free inodes count */
115        __le16  bg_used_dirs_count;     /* Directories count */
116        __u16   bg_pad;
117        __le32  bg_reserved[3];
118};
119
120/*
121 * Macro-instructions used to manage group descriptors
122 */
123# define EXT3_BLOCKS_PER_GROUP(s)       ((s)->s_blocks_per_group)
124# define EXT3_DESC_PER_BLOCK(s)         (EXT3_BLOCK_SIZE(s) / sizeof (struct ext3_group_desc))
125# define EXT3_INODES_PER_GROUP(s)       ((s)->s_inodes_per_group)
126
127/*
128 * Constants relative to the data blocks
129 */
130#define EXT3_NDIR_BLOCKS                12
131#define EXT3_IND_BLOCK                  EXT3_NDIR_BLOCKS
132#define EXT3_DIND_BLOCK                 (EXT3_IND_BLOCK + 1)
133#define EXT3_TIND_BLOCK                 (EXT3_DIND_BLOCK + 1)
134#define EXT3_N_BLOCKS                   (EXT3_TIND_BLOCK + 1)
135
136/*
137 * Inode flags
138 */
139#define EXT3_SECRM_FL                   0x00000001 /* Secure deletion */
140#define EXT3_UNRM_FL                    0x00000002 /* Undelete */
141#define EXT3_COMPR_FL                   0x00000004 /* Compress file */
142#define EXT3_SYNC_FL                    0x00000008 /* Synchronous updates */
143#define EXT3_IMMUTABLE_FL               0x00000010 /* Immutable file */
144#define EXT3_APPEND_FL                  0x00000020 /* writes to file may only append */
145#define EXT3_NODUMP_FL                  0x00000040 /* do not dump file */
146#define EXT3_NOATIME_FL                 0x00000080 /* do not update atime */
147/* Reserved for compression usage... */
148#define EXT3_DIRTY_FL                   0x00000100
149#define EXT3_COMPRBLK_FL                0x00000200 /* One or more compressed clusters */
150#define EXT3_NOCOMPR_FL                 0x00000400 /* Don't compress */
151#define EXT3_ECOMPR_FL                  0x00000800 /* Compression error */
152/* End compression flags --- maybe not all used */
153#define EXT3_INDEX_FL                   0x00001000 /* hash-indexed directory */
154#define EXT3_IMAGIC_FL                  0x00002000 /* AFS directory */
155#define EXT3_JOURNAL_DATA_FL            0x00004000 /* file data should be journaled */
156#define EXT3_NOTAIL_FL                  0x00008000 /* file tail should not be merged */
157#define EXT3_DIRSYNC_FL                 0x00010000 /* dirsync behaviour (directories only) */
158#define EXT3_TOPDIR_FL                  0x00020000 /* Top of directory hierarchies*/
159#define EXT3_RESERVED_FL                0x80000000 /* reserved for ext3 lib */
160
161#define EXT3_FL_USER_VISIBLE            0x0003DFFF /* User visible flags */
162#define EXT3_FL_USER_MODIFIABLE         0x000380FF /* User modifiable flags */
163
164/*
165 * Inode dynamic state flags
166 */
167#define EXT3_STATE_JDATA                0x00000001 /* journaled data exists */
168#define EXT3_STATE_NEW                  0x00000002 /* inode is newly created */
169#define EXT3_STATE_XATTR                0x00000004 /* has in-inode xattrs */
170
171/* Used to pass group descriptor data when online resize is done */
172struct ext3_new_group_input {
173        __u32 group;            /* Group number for this data */
174        __u32 block_bitmap;     /* Absolute block number of block bitmap */
175        __u32 inode_bitmap;     /* Absolute block number of inode bitmap */
176        __u32 inode_table;      /* Absolute block number of inode table start */
177        __u32 blocks_count;     /* Total number of blocks in this group */
178        __u16 reserved_blocks;  /* Number of reserved blocks in this group */
179        __u16 unused;
180};
181
182/* The struct ext3_new_group_input in kernel space, with free_blocks_count */
183struct ext3_new_group_data {
184        __u32 group;
185        __u32 block_bitmap;
186        __u32 inode_bitmap;
187        __u32 inode_table;
188        __u32 blocks_count;
189        __u16 reserved_blocks;
190        __u16 unused;
191        __u32 free_blocks_count;
192};
193
194
195/*
196 * ioctl commands
197 */
198#define EXT3_IOC_GETFLAGS               _IOR('f', 1, long)
199#define EXT3_IOC_SETFLAGS               _IOW('f', 2, long)
200#define EXT3_IOC_GETVERSION             _IOR('f', 3, long)
201#define EXT3_IOC_SETVERSION             _IOW('f', 4, long)
202#define EXT3_IOC_GROUP_EXTEND           _IOW('f', 7, unsigned long)
203#define EXT3_IOC_GROUP_ADD              _IOW('f', 8,struct ext3_new_group_input)
204#define EXT3_IOC_GETVERSION_OLD         _IOR('v', 1, long)
205#define EXT3_IOC_SETVERSION_OLD         _IOW('v', 2, long)
206#ifdef CONFIG_JBD_DEBUG
207#define EXT3_IOC_WAIT_FOR_READONLY      _IOR('f', 99, long)
208#endif
209#define EXT3_IOC_GETRSVSZ               _IOR('f', 5, long)
210#define EXT3_IOC_SETRSVSZ               _IOW('f', 6, long)
211
212/*
213 * Structure of an inode on the disk
214 */
215struct ext3_inode {
216        __le16  i_mode;         /* File mode */
217        __le16  i_uid;          /* Low 16 bits of Owner Uid */
218        __le32  i_size;         /* Size in bytes */
219        __le32  i_atime;        /* Access time */
220        __le32  i_ctime;        /* Creation time */
221        __le32  i_mtime;        /* Modification time */
222        __le32  i_dtime;        /* Deletion Time */
223        __le16  i_gid;          /* Low 16 bits of Group Id */
224        __le16  i_links_count;  /* Links count */
225        __le32  i_blocks;       /* Blocks count */
226        __le32  i_flags;        /* File flags */
227        union {
228                struct {
229                        __u32  l_i_reserved1;
230                } linux1;
231                struct {
232                        __u32  h_i_translator;
233                } hurd1;
234                struct {
235                        __u32  m_i_reserved1;
236                } masix1;
237        } osd1;                         /* OS dependent 1 */
238        __le32  i_block[EXT3_N_BLOCKS];/* Pointers to blocks */
239        __le32  i_generation;   /* File version (for NFS) */
240        __le32  i_file_acl;     /* File ACL */
241        __le32  i_dir_acl;      /* Directory ACL */
242        __le32  i_faddr;        /* Fragment address */
243        union {
244                struct {
245                        __u8    l_i_frag;       /* Fragment number */
246                        __u8    l_i_fsize;      /* Fragment size */
247                        __u16   i_pad1;
248                        __le16  l_i_uid_high;   /* these 2 fields    */
249                        __le16  l_i_gid_high;   /* were reserved2[0] */
250                        __u32   l_i_reserved2;
251                } linux2;
252                struct {
253                        __u8    h_i_frag;       /* Fragment number */
254                        __u8    h_i_fsize;      /* Fragment size */
255                        __u16   h_i_mode_high;
256                        __u16   h_i_uid_high;
257                        __u16   h_i_gid_high;
258                        __u32   h_i_author;
259                } hurd2;
260                struct {
261                        __u8    m_i_frag;       /* Fragment number */
262                        __u8    m_i_fsize;      /* Fragment size */
263                        __u16   m_pad1;
264                        __u32   m_i_reserved2[2];
265                } masix2;
266        } osd2;                         /* OS dependent 2 */
267        __le16  i_extra_isize;
268        __le16  i_pad1;
269};
270
271#define i_size_high     i_dir_acl
272
273#if defined(__linux__)
274
275#define i_reserved1     osd1.linux1.l_i_reserved1
276#define i_frag          osd2.linux2.l_i_frag
277#define i_fsize         osd2.linux2.l_i_fsize
278#define i_uid_low       i_uid
279#define i_gid_low       i_gid
280#define i_uid_high      osd2.linux2.l_i_uid_high
281#define i_gid_high      osd2.linux2.l_i_gid_high
282#define i_reserved2     osd2.linux2.l_i_reserved2
283
284#elif defined(__GNU__)
285
286#define i_translator    osd1.hurd1.h_i_translator
287#define i_frag          osd2.hurd2.h_i_frag;
288#define i_fsize         osd2.hurd2.h_i_fsize;
289#define i_uid_high      osd2.hurd2.h_i_uid_high
290#define i_gid_high      osd2.hurd2.h_i_gid_high
291#define i_author        osd2.hurd2.h_i_author
292
293#elif defined(__masix__)
294
295#define i_reserved1     osd1.masix1.m_i_reserved1
296#define i_frag          osd2.masix2.m_i_frag
297#define i_fsize         osd2.masix2.m_i_fsize
298#define i_reserved2     osd2.masix2.m_i_reserved2
299
300#endif /* defined(__linux__) */
301
302/*
303 * File system states
304 */
305#define EXT3_VALID_FS                   0x0001  /* Unmounted cleanly */
306#define EXT3_ERROR_FS                   0x0002  /* Errors detected */
307#define EXT3_ORPHAN_FS                  0x0004  /* Orphans being recovered */
308
309/*
310 * Mount flags
311 */
312#define EXT3_MOUNT_CHECK                0x00001 /* Do mount-time checks */
313#define EXT3_MOUNT_OLDALLOC             0x00002  /* Don't use the new Orlov allocator */
314#define EXT3_MOUNT_GRPID                0x00004 /* Create files with directory's group */
315#define EXT3_MOUNT_DEBUG                0x00008 /* Some debugging messages */
316#define EXT3_MOUNT_ERRORS_CONT          0x00010 /* Continue on errors */
317#define EXT3_MOUNT_ERRORS_RO            0x00020 /* Remount fs ro on errors */
318#define EXT3_MOUNT_ERRORS_PANIC         0x00040 /* Panic on errors */
319#define EXT3_MOUNT_MINIX_DF             0x00080 /* Mimics the Minix statfs */
320#define EXT3_MOUNT_NOLOAD               0x00100 /* Don't use existing journal*/
321#define EXT3_MOUNT_ABORT                0x00200 /* Fatal error detected */
322#define EXT3_MOUNT_DATA_FLAGS           0x00C00 /* Mode for data writes: */
323#define EXT3_MOUNT_JOURNAL_DATA         0x00400 /* Write data to journal */
324#define EXT3_MOUNT_ORDERED_DATA         0x00800 /* Flush data before commit */
325#define EXT3_MOUNT_WRITEBACK_DATA       0x00C00 /* No data ordering */
326#define EXT3_MOUNT_UPDATE_JOURNAL       0x01000 /* Update the journal format */
327#define EXT3_MOUNT_NO_UID32             0x02000  /* Disable 32-bit UIDs */
328#define EXT3_MOUNT_XATTR_USER           0x04000 /* Extended user attributes */
329#define EXT3_MOUNT_POSIX_ACL            0x08000 /* POSIX Access Control Lists */
330#define EXT3_MOUNT_RESERVATION          0x10000 /* Preallocation */
331#define EXT3_MOUNT_BARRIER              0x20000 /* Use block barriers */
332#define EXT3_MOUNT_NOBH                 0x40000 /* No bufferheads */
333
334/* Compatibility, for having both ext2_fs.h and ext3_fs.h included at once */
335#ifndef _LINUX_EXT2_FS_H
336#define clear_opt(o, opt)               o &= ~EXT3_MOUNT_##opt
337#define set_opt(o, opt)                 o |= EXT3_MOUNT_##opt
338#define test_opt(sb, opt)               (EXT3_SB(sb)->s_mount_opt & \
339                                         EXT3_MOUNT_##opt)
340#else
341#define EXT2_MOUNT_NOLOAD               EXT3_MOUNT_NOLOAD
342#define EXT2_MOUNT_ABORT                EXT3_MOUNT_ABORT
343#define EXT2_MOUNT_DATA_FLAGS           EXT3_MOUNT_DATA_FLAGS
344#endif
345
346#define ext3_set_bit                    ext2_set_bit
347#define ext3_set_bit_atomic             ext2_set_bit_atomic
348#define ext3_clear_bit                  ext2_clear_bit
349#define ext3_clear_bit_atomic           ext2_clear_bit_atomic
350#define ext3_test_bit                   ext2_test_bit
351#define ext3_find_first_zero_bit        ext2_find_first_zero_bit
352#define ext3_find_next_zero_bit         ext2_find_next_zero_bit
353
354/*
355 * Maximal mount counts between two filesystem checks
356 */
357#define EXT3_DFL_MAX_MNT_COUNT          20      /* Allow 20 mounts */
358#define EXT3_DFL_CHECKINTERVAL          0       /* Don't use interval check */
359
360/*
361 * Behaviour when detecting errors
362 */
363#define EXT3_ERRORS_CONTINUE            1       /* Continue execution */
364#define EXT3_ERRORS_RO                  2       /* Remount fs read-only */
365#define EXT3_ERRORS_PANIC               3       /* Panic */
366#define EXT3_ERRORS_DEFAULT             EXT3_ERRORS_CONTINUE
367
368/*
369 * Structure of the super block
370 */
371struct ext3_super_block {
372/*00*/  __le32  s_inodes_count;         /* Inodes count */
373        __le32  s_blocks_count;         /* Blocks count */
374        __le32  s_r_blocks_count;       /* Reserved blocks count */
375        __le32  s_free_blocks_count;    /* Free blocks count */
376/*10*/  __le32  s_free_inodes_count;    /* Free inodes count */
377        __le32  s_first_data_block;     /* First Data Block */
378        __le32  s_log_block_size;       /* Block size */
379        __le32  s_log_frag_size;        /* Fragment size */
380/*20*/  __le32  s_blocks_per_group;     /* # Blocks per group */
381        __le32  s_frags_per_group;      /* # Fragments per group */
382        __le32  s_inodes_per_group;     /* # Inodes per group */
383        __le32  s_mtime;                /* Mount time */
384/*30*/  __le32  s_wtime;                /* Write time */
385        __le16  s_mnt_count;            /* Mount count */
386        __le16  s_max_mnt_count;        /* Maximal mount count */
387        __le16  s_magic;                /* Magic signature */
388        __le16  s_state;                /* File system state */
389        __le16  s_errors;               /* Behaviour when detecting errors */
390        __le16  s_minor_rev_level;      /* minor revision level */
391/*40*/  __le32  s_lastcheck;            /* time of last check */
392        __le32  s_checkinterval;        /* max. time between checks */
393        __le32  s_creator_os;           /* OS */
394        __le32  s_rev_level;            /* Revision level */
395/*50*/  __le16  s_def_resuid;           /* Default uid for reserved blocks */
396        __le16  s_def_resgid;           /* Default gid for reserved blocks */
397        /*
398         * These fields are for EXT3_DYNAMIC_REV superblocks only.
399         *
400         * Note: the difference between the compatible feature set and
401         * the incompatible feature set is that if there is a bit set
402         * in the incompatible feature set that the kernel doesn't
403         * know about, it should refuse to mount the filesystem.
404         *
405         * e2fsck's requirements are more strict; if it doesn't know
406         * about a feature in either the compatible or incompatible
407         * feature set, it must abort and not try to meddle with
408         * things it doesn't understand...
409         */
410        __le32  s_first_ino;            /* First non-reserved inode */
411        __le16   s_inode_size;          /* size of inode structure */
412        __le16  s_block_group_nr;       /* block group # of this superblock */
413        __le32  s_feature_compat;       /* compatible feature set */
414/*60*/  __le32  s_feature_incompat;     /* incompatible feature set */
415        __le32  s_feature_ro_compat;    /* readonly-compatible feature set */
416/*68*/  __u8    s_uuid[16];             /* 128-bit uuid for volume */
417/*78*/  char    s_volume_name[16];      /* volume name */
418/*88*/  char    s_last_mounted[64];     /* directory where last mounted */
419/*C8*/  __le32  s_algorithm_usage_bitmap; /* For compression */
420        /*
421         * Performance hints.  Directory preallocation should only
422         * happen if the EXT3_FEATURE_COMPAT_DIR_PREALLOC flag is on.
423         */
424        __u8    s_prealloc_blocks;      /* Nr of blocks to try to preallocate*/
425        __u8    s_prealloc_dir_blocks;  /* Nr to preallocate for dirs */
426        __u16   s_reserved_gdt_blocks;  /* Per group desc for online growth */
427        /*
428         * Journaling support valid if EXT3_FEATURE_COMPAT_HAS_JOURNAL set.
429         */
430/*D0*/  __u8    s_journal_uuid[16];     /* uuid of journal superblock */
431/*E0*/  __le32  s_journal_inum;         /* inode number of journal file */
432        __le32  s_journal_dev;          /* device number of journal file */
433        __le32  s_last_orphan;          /* start of list of inodes to delete */
434        __le32  s_hash_seed[4];         /* HTREE hash seed */
435        __u8    s_def_hash_version;     /* Default hash version to use */
436        __u8    s_reserved_char_pad;
437        __u16   s_reserved_word_pad;
438        __le32  s_default_mount_opts;
439        __le32  s_first_meta_bg;        /* First metablock block group */
440        __u32   s_reserved[190];        /* Padding to the end of the block */
441};
442
443/* Assume that user mode programs are passing in an ext3fs superblock, not
444 * a kernel struct super_block.  This will allow us to call the feature-test
445 * macros from user land. */
446#define EXT3_SB(sb)     (sb)
447
448#define NEXT_ORPHAN(inode) EXT3_I(inode)->i_dtime
449
450/*
451 * Codes for operating systems
452 */
453#define EXT3_OS_LINUX           0
454#define EXT3_OS_HURD            1
455#define EXT3_OS_MASIX           2
456#define EXT3_OS_FREEBSD         3
457#define EXT3_OS_LITES           4
458
459/*
460 * Revision levels
461 */
462#define EXT3_GOOD_OLD_REV       0       /* The good old (original) format */
463#define EXT3_DYNAMIC_REV        1       /* V2 format w/ dynamic inode sizes */
464
465#define EXT3_CURRENT_REV        EXT3_GOOD_OLD_REV
466#define EXT3_MAX_SUPP_REV       EXT3_DYNAMIC_REV
467
468#define EXT3_GOOD_OLD_INODE_SIZE 128
469
470/*
471 * Feature set definitions
472 */
473
474#define EXT3_HAS_COMPAT_FEATURE(sb,mask)                        \
475        ( EXT3_SB(sb)->s_es->s_feature_compat & __cpu_to_le32(mask) )
476#define EXT3_HAS_RO_COMPAT_FEATURE(sb,mask)                     \
477        ( EXT3_SB(sb)->s_es->s_feature_ro_compat & __cpu_to_le32(mask) )
478#define EXT3_HAS_INCOMPAT_FEATURE(sb,mask)                      \
479        ( EXT3_SB(sb)->s_es->s_feature_incompat & __cpu_to_le32(mask) )
480#define EXT3_SET_COMPAT_FEATURE(sb,mask)                        \
481        EXT3_SB(sb)->s_es->s_feature_compat |= __cpu_to_le32(mask)
482#define EXT3_SET_RO_COMPAT_FEATURE(sb,mask)                     \
483        EXT3_SB(sb)->s_es->s_feature_ro_compat |= __cpu_to_le32(mask)
484#define EXT3_SET_INCOMPAT_FEATURE(sb,mask)                      \
485        EXT3_SB(sb)->s_es->s_feature_incompat |= __cpu_to_le32(mask)
486#define EXT3_CLEAR_COMPAT_FEATURE(sb,mask)                      \
487        EXT3_SB(sb)->s_es->s_feature_compat &= ~__cpu_to_le32(mask)
488#define EXT3_CLEAR_RO_COMPAT_FEATURE(sb,mask)                   \
489        EXT3_SB(sb)->s_es->s_feature_ro_compat &= ~__cpu_to_le32(mask)
490#define EXT3_CLEAR_INCOMPAT_FEATURE(sb,mask)                    \
491        EXT3_SB(sb)->s_es->s_feature_incompat &= ~__cpu_to_le32(mask)
492
493#define EXT3_FEATURE_COMPAT_DIR_PREALLOC        0x0001
494#define EXT3_FEATURE_COMPAT_IMAGIC_INODES       0x0002
495#define EXT3_FEATURE_COMPAT_HAS_JOURNAL         0x0004
496#define EXT3_FEATURE_COMPAT_EXT_ATTR            0x0008
497#define EXT3_FEATURE_COMPAT_RESIZE_INODE        0x0010
498#define EXT3_FEATURE_COMPAT_DIR_INDEX           0x0020
499
500#define EXT3_FEATURE_RO_COMPAT_SPARSE_SUPER     0x0001
501#define EXT3_FEATURE_RO_COMPAT_LARGE_FILE       0x0002
502#define EXT3_FEATURE_RO_COMPAT_BTREE_DIR        0x0004
503
504#define EXT3_FEATURE_INCOMPAT_COMPRESSION       0x0001
505#define EXT3_FEATURE_INCOMPAT_FILETYPE          0x0002
506#define EXT3_FEATURE_INCOMPAT_RECOVER           0x0004 /* Needs recovery */
507#define EXT3_FEATURE_INCOMPAT_JOURNAL_DEV       0x0008 /* Journal device */
508#define EXT3_FEATURE_INCOMPAT_META_BG           0x0010
509
510#define EXT3_FEATURE_COMPAT_SUPP        EXT2_FEATURE_COMPAT_EXT_ATTR
511#define EXT3_FEATURE_INCOMPAT_SUPP      (EXT3_FEATURE_INCOMPAT_FILETYPE| \
512                                         EXT3_FEATURE_INCOMPAT_RECOVER| \
513                                         EXT3_FEATURE_INCOMPAT_META_BG)
514#define EXT3_FEATURE_RO_COMPAT_SUPP     (EXT3_FEATURE_RO_COMPAT_SPARSE_SUPER| \
515                                         EXT3_FEATURE_RO_COMPAT_LARGE_FILE| \
516                                         EXT3_FEATURE_RO_COMPAT_BTREE_DIR)
517
518/*
519 * Default values for user and/or group using reserved blocks
520 */
521#define EXT3_DEF_RESUID         0
522#define EXT3_DEF_RESGID         0
523
524/*
525 * Default mount options
526 */
527#define EXT3_DEFM_DEBUG         0x0001
528#define EXT3_DEFM_BSDGROUPS     0x0002
529#define EXT3_DEFM_XATTR_USER    0x0004
530#define EXT3_DEFM_ACL           0x0008
531#define EXT3_DEFM_UID16         0x0010
532#define EXT3_DEFM_JMODE         0x0060
533#define EXT3_DEFM_JMODE_DATA    0x0020
534#define EXT3_DEFM_JMODE_ORDERED 0x0040
535#define EXT3_DEFM_JMODE_WBACK   0x0060
536
537/*
538 * Structure of a directory entry
539 */
540#define EXT3_NAME_LEN 255
541
542struct ext3_dir_entry {
543        __le32  inode;                  /* Inode number */
544        __le16  rec_len;                /* Directory entry length */
545        __le16  name_len;               /* Name length */
546        char    name[EXT3_NAME_LEN];    /* File name */
547};
548
549/*
550 * The new version of the directory entry.  Since EXT3 structures are
551 * stored in intel byte order, and the name_len field could never be
552 * bigger than 255 chars, it's safe to reclaim the extra byte for the
553 * file_type field.
554 */
555struct ext3_dir_entry_2 {
556        __le32  inode;                  /* Inode number */
557        __le16  rec_len;                /* Directory entry length */
558        __u8    name_len;               /* Name length */
559        __u8    file_type;
560        char    name[EXT3_NAME_LEN];    /* File name */
561};
562
563/*
564 * Ext3 directory file types.  Only the low 3 bits are used.  The
565 * other bits are reserved for now.
566 */
567#define EXT3_FT_UNKNOWN         0
568#define EXT3_FT_REG_FILE        1
569#define EXT3_FT_DIR             2
570#define EXT3_FT_CHRDEV          3
571#define EXT3_FT_BLKDEV          4
572#define EXT3_FT_FIFO            5
573#define EXT3_FT_SOCK            6
574#define EXT3_FT_SYMLINK         7
575
576#define EXT3_FT_MAX             8
577
578/*
579 * EXT3_DIR_PAD defines the directory entries boundaries
580 *
581 * NOTE: It must be a multiple of 4
582 */
583#define EXT3_DIR_PAD                    4
584#define EXT3_DIR_ROUND                  (EXT3_DIR_PAD - 1)
585#define EXT3_DIR_REC_LEN(name_len)      (((name_len) + 8 + EXT3_DIR_ROUND) & \
586                                         ~EXT3_DIR_ROUND)
587/*
588 * Hash Tree Directory indexing
589 * (c) Daniel Phillips, 2001
590 */
591
592#ifdef CONFIG_EXT3_INDEX
593  #define is_dx(dir) (EXT3_HAS_COMPAT_FEATURE(dir->i_sb, \
594                                              EXT3_FEATURE_COMPAT_DIR_INDEX) && \
595                      (EXT3_I(dir)->i_flags & EXT3_INDEX_FL))
596#define EXT3_DIR_LINK_MAX(dir) (!is_dx(dir) && (dir)->i_nlink >= EXT3_LINK_MAX)
597#define EXT3_DIR_LINK_EMPTY(dir) ((dir)->i_nlink == 2 || (dir)->i_nlink == 1)
598#else
599  #define is_dx(dir) 0
600#define EXT3_DIR_LINK_MAX(dir) ((dir)->i_nlink >= EXT3_LINK_MAX)
601#define EXT3_DIR_LINK_EMPTY(dir) ((dir)->i_nlink == 2)
602#endif
603
604/* Legal values for the dx_root hash_version field: */
605
606#define DX_HASH_LEGACY          0
607#define DX_HASH_HALF_MD4        1
608#define DX_HASH_TEA             2
609
610/* hash info structure used by the directory hash */
611struct dx_hash_info
612{
613        __u32           hash;
614        __u32           minor_hash;
615        __s32           hash_version;
616        __u32           *seed;
617};
618
619#define EXT3_HTREE_EOF  0x7fffffff
620
621#endif  /* _LINUX_EXT3_FS_H */
Note: See TracBrowser for help on using the repository browser.