4 * Copyright (C) 1993, 1994, 1995, 1996 Theodore Ts'o.
7 * This file may be redistributed under the terms of the GNU Library
8 * General Public License, version 2.
12 #ifndef _EXT2FS_EXT2FS_H
13 #define _EXT2FS_EXT2FS_H
16 #define EXT2FS_ATTR(x) __attribute__(x)
18 #define EXT2FS_ATTR(x)
26 * Non-GNU C compilers won't necessarily understand inline
28 #if (!defined(__GNUC__) && !defined(__WATCOMC__))
29 #define NO_INLINE_FUNCS
33 * Where the master copy of the superblock is located, and how big
34 * superblocks are supposed to be. We define SUPERBLOCK_SIZE because
35 * the size of the superblock structure is not necessarily trustworthy
36 * (some versions have the padding set up so that the superblock is
39 #define SUPERBLOCK_OFFSET 1024
40 #define SUPERBLOCK_SIZE 1024
42 #define UUID_STR_SIZE 37
45 * The last ext2fs revision level that this version of the library is
48 #define EXT2_LIB_CURRENT_REV EXT2_DYNAMIC_REV
50 #ifdef HAVE_SYS_TYPES_H
51 #include <sys/types.h>
59 #if EXT2_FLAT_INCLUDES
62 #include "ext3_extents.h"
64 #include <ext2fs/ext2_types.h>
65 #include <ext2fs/ext2_fs.h>
66 #include <ext2fs/ext3_extents.h>
67 #endif /* EXT2_FLAT_INCLUDES */
69 #ifdef __CHECK_ENDIAN__
70 #define __bitwise __attribute__((bitwise))
75 typedef __u32 __bitwise ext2_ino_t;
76 typedef __u32 __bitwise blk_t;
77 typedef __u64 __bitwise blk64_t;
78 typedef __u32 __bitwise dgrp_t;
79 typedef __u32 __bitwise ext2_off_t;
80 typedef __u64 __bitwise ext2_off64_t;
81 typedef __s64 __bitwise e2_blkcnt_t;
82 typedef __u32 __bitwise ext2_dirhash_t;
84 #if EXT2_FLAT_INCLUDES
88 #include "ext2_ext_attr.h"
90 #include <et/com_err.h>
91 #include <ext2fs/ext2_io.h>
92 #include <ext2fs/ext2_err.h>
93 #include <ext2fs/ext2_ext_attr.h>
97 * Portability help for Microsoft Visual C++
100 #define EXT2_QSORT_TYPE int __cdecl
102 #define EXT2_QSORT_TYPE int
105 typedef struct struct_ext2_filsys *ext2_filsys;
107 #define EXT2FS_MARK_ERROR 0
108 #define EXT2FS_UNMARK_ERROR 1
109 #define EXT2FS_TEST_ERROR 2
111 typedef struct ext2fs_struct_generic_bitmap *ext2fs_generic_bitmap;
112 typedef struct ext2fs_struct_generic_bitmap *ext2fs_inode_bitmap;
113 typedef struct ext2fs_struct_generic_bitmap *ext2fs_block_bitmap;
115 #define EXT2_FIRST_INODE(s) EXT2_FIRST_INO(s)
119 * Badblocks list definitions
122 typedef struct ext2_struct_u32_list *ext2_badblocks_list;
123 typedef struct ext2_struct_u32_iterate *ext2_badblocks_iterate;
125 typedef struct ext2_struct_u32_list *ext2_u32_list;
126 typedef struct ext2_struct_u32_iterate *ext2_u32_iterate;
129 typedef struct ext2_struct_u32_list *badblocks_list;
130 typedef struct ext2_struct_u32_iterate *badblocks_iterate;
132 #define BADBLOCKS_FLAG_DIRTY 1
135 * ext2_dblist structure and abstractions (see dblist.c)
137 struct ext2_db_entry2 {
140 e2_blkcnt_t blockcnt;
143 /* Ye Olde 32-bit version */
144 struct ext2_db_entry {
150 typedef struct ext2_struct_dblist *ext2_dblist;
152 #define DBLIST_ABORT 1
155 * ext2_fileio definitions
158 #define EXT2_FILE_WRITE 0x0001
159 #define EXT2_FILE_CREATE 0x0002
161 #define EXT2_FILE_MASK 0x00FF
163 #define EXT2_FILE_BUF_DIRTY 0x4000
164 #define EXT2_FILE_BUF_VALID 0x2000
166 typedef struct ext2_file *ext2_file_t;
168 #define EXT2_SEEK_SET 0
169 #define EXT2_SEEK_CUR 1
170 #define EXT2_SEEK_END 2
173 * Flags for the ext2_filsys structure and for ext2fs_open()
175 #define EXT2_FLAG_RW 0x01
176 #define EXT2_FLAG_CHANGED 0x02
177 #define EXT2_FLAG_DIRTY 0x04
178 #define EXT2_FLAG_VALID 0x08
179 #define EXT2_FLAG_IB_DIRTY 0x10
180 #define EXT2_FLAG_BB_DIRTY 0x20
181 #define EXT2_FLAG_SWAP_BYTES 0x40
182 #define EXT2_FLAG_SWAP_BYTES_READ 0x80
183 #define EXT2_FLAG_SWAP_BYTES_WRITE 0x100
184 #define EXT2_FLAG_MASTER_SB_ONLY 0x200
185 #define EXT2_FLAG_FORCE 0x400
186 #define EXT2_FLAG_SUPER_ONLY 0x800
187 #define EXT2_FLAG_JOURNAL_DEV_OK 0x1000
188 #define EXT2_FLAG_IMAGE_FILE 0x2000
189 #define EXT2_FLAG_EXCLUSIVE 0x4000
190 #define EXT2_FLAG_SOFTSUPP_FEATURES 0x8000
191 #define EXT2_FLAG_NOFREE_ON_ERROR 0x10000
192 #define EXT2_FLAG_64BITS 0x20000
193 #define EXT2_FLAG_PRINT_PROGRESS 0x40000
194 #define EXT2_FLAG_DIRECT_IO 0x80000
195 #define EXT2_FLAG_SKIP_MMP 0x100000
198 * Special flag in the ext2 inode i_flag field that means that this is
199 * a new inode. (So that ext2_write_inode() can clear extra fields.)
201 #define EXT2_NEW_INODE_FL 0x80000000
204 * Flags for mkjournal
206 #define EXT2_MKJOURNAL_V1_SUPER 0x0000001 /* create V1 superblock (deprecated) */
207 #define EXT2_MKJOURNAL_LAZYINIT 0x0000002 /* don't zero journal inode before use*/
208 #define EXT2_MKJOURNAL_NO_MNT_CHECK 0x0000004 /* don't check mount status */
210 struct opaque_ext2_group_desc;
212 struct struct_ext2_filsys {
217 struct ext2_super_block * super;
218 unsigned int blocksize;
220 dgrp_t group_desc_count;
221 unsigned long desc_blocks;
222 struct opaque_ext2_group_desc * group_desc;
223 unsigned int inode_blocks_per_group;
224 ext2fs_inode_bitmap inode_map;
225 ext2fs_block_bitmap block_map;
226 /* XXX FIXME-64: not 64-bit safe, but not used? */
227 errcode_t (*get_blocks)(ext2_filsys fs, ext2_ino_t ino, blk_t *blocks);
228 errcode_t (*check_directory)(ext2_filsys fs, ext2_ino_t ino);
229 errcode_t (*write_bitmaps)(ext2_filsys fs);
230 errcode_t (*read_inode)(ext2_filsys fs, ext2_ino_t ino,
231 struct ext2_inode *inode);
232 errcode_t (*write_inode)(ext2_filsys fs, ext2_ino_t ino,
233 struct ext2_inode *inode);
234 ext2_badblocks_list badblocks;
236 __u32 stride; /* for mke2fs */
237 struct ext2_super_block * orig_super;
238 struct ext2_image_hdr * image_header;
241 int cluster_ratio_bits;
242 __u16 default_bitmap_type;
245 * Reserved for future expansion
250 * Reserved for the use of the calling application.
257 struct ext2_inode_cache *icache;
261 * More callback functions
263 errcode_t (*get_alloc_block)(ext2_filsys fs, blk64_t goal,
265 void (*block_alloc_stats)(ext2_filsys fs, blk64_t blk, int inuse);
268 * Buffers for Multiple mount protection(MMP) block.
275 * Time at which e2fsck last updated the MMP block.
277 long mmp_last_written;
280 #if EXT2_FLAT_INCLUDES
281 #include "e2_bitops.h"
283 #include <ext2fs/bitops.h>
287 * 64-bit bitmap backend types
289 #define EXT2FS_BMAP64_BITARRAY 1
290 #define EXT2FS_BMAP64_RBTREE 2
291 #define EXT2FS_BMAP64_AUTODIR 3
294 * Return flags for the block iterator functions
296 #define BLOCK_CHANGED 1
297 #define BLOCK_ABORT 2
298 #define BLOCK_ERROR 4
301 * Block interate flags
303 * BLOCK_FLAG_APPEND, or BLOCK_FLAG_HOLE, indicates that the interator
304 * function should be called on blocks where the block number is zero.
305 * This is used by ext2fs_expand_dir() to be able to add a new block
306 * to an inode. It can also be used for programs that want to be able
307 * to deal with files that contain "holes".
309 * BLOCK_FLAG_DEPTH_TRAVERSE indicates that the iterator function for
310 * the indirect, doubly indirect, etc. blocks should be called after
311 * all of the blocks containined in the indirect blocks are processed.
312 * This is useful if you are going to be deallocating blocks from an
315 * BLOCK_FLAG_DATA_ONLY indicates that the iterator function should be
316 * called for data blocks only.
318 * BLOCK_FLAG_READ_ONLY is a promise by the caller that it will not
319 * modify returned block number.
321 * BLOCK_FLAG_NO_LARGE is for internal use only. It informs
322 * ext2fs_block_iterate2 that large files won't be accepted.
324 #define BLOCK_FLAG_APPEND 1
325 #define BLOCK_FLAG_HOLE 1
326 #define BLOCK_FLAG_DEPTH_TRAVERSE 2
327 #define BLOCK_FLAG_DATA_ONLY 4
328 #define BLOCK_FLAG_READ_ONLY 8
330 #define BLOCK_FLAG_NO_LARGE 0x1000
333 * Magic "block count" return values for the block iterator function.
335 #define BLOCK_COUNT_IND (-1)
336 #define BLOCK_COUNT_DIND (-2)
337 #define BLOCK_COUNT_TIND (-3)
338 #define BLOCK_COUNT_TRANSLATOR (-4)
342 * Flags for ext2fs_move_blocks
344 #define EXT2_BMOVE_GET_DBLIST 0x0001
345 #define EXT2_BMOVE_DEBUG 0x0002
349 * Generic (non-filesystem layout specific) extents structure
352 #define EXT2_EXTENT_FLAGS_LEAF 0x0001
353 #define EXT2_EXTENT_FLAGS_UNINIT 0x0002
354 #define EXT2_EXTENT_FLAGS_SECOND_VISIT 0x0004
356 struct ext2fs_extent {
357 blk64_t e_pblk; /* first physical block */
358 blk64_t e_lblk; /* first logical block extent covers */
359 __u32 e_len; /* number of blocks covered by extent */
360 __u32 e_flags; /* extent flags */
363 typedef struct ext2_extent_handle *ext2_extent_handle_t;
364 typedef struct ext2_extent_path *ext2_extent_path_t;
367 * Flags used by ext2fs_extent_get()
369 #define EXT2_EXTENT_CURRENT 0x0000
370 #define EXT2_EXTENT_MOVE_MASK 0x000F
371 #define EXT2_EXTENT_ROOT 0x0001
372 #define EXT2_EXTENT_LAST_LEAF 0x0002
373 #define EXT2_EXTENT_FIRST_SIB 0x0003
374 #define EXT2_EXTENT_LAST_SIB 0x0004
375 #define EXT2_EXTENT_NEXT_SIB 0x0005
376 #define EXT2_EXTENT_PREV_SIB 0x0006
377 #define EXT2_EXTENT_NEXT_LEAF 0x0007
378 #define EXT2_EXTENT_PREV_LEAF 0x0008
379 #define EXT2_EXTENT_NEXT 0x0009
380 #define EXT2_EXTENT_PREV 0x000A
381 #define EXT2_EXTENT_UP 0x000B
382 #define EXT2_EXTENT_DOWN 0x000C
383 #define EXT2_EXTENT_DOWN_AND_LAST 0x000D
386 * Flags used by ext2fs_extent_insert()
388 #define EXT2_EXTENT_INSERT_AFTER 0x0001 /* insert after handle loc'n */
389 #define EXT2_EXTENT_INSERT_NOSPLIT 0x0002 /* insert may not cause split */
392 * Flags used by ext2fs_extent_delete()
394 #define EXT2_EXTENT_DELETE_KEEP_EMPTY 0x001 /* keep node if last extnt gone */
397 * Flags used by ext2fs_extent_set_bmap()
399 #define EXT2_EXTENT_SET_BMAP_UNINIT 0x0001
402 * Data structure returned by ext2fs_extent_get_info()
404 struct ext2_extent_info {
414 __u32 max_uninit_len;
418 * Flags for directory block reading and writing functions
420 #define EXT2_DIRBLOCK_V2_STRUCT 0x0001
423 * Return flags for the directory iterator functions
425 #define DIRENT_CHANGED 1
426 #define DIRENT_ABORT 2
427 #define DIRENT_ERROR 3
430 * Directory iterator flags
433 #define DIRENT_FLAG_INCLUDE_EMPTY 1
434 #define DIRENT_FLAG_INCLUDE_REMOVED 2
436 #define DIRENT_DOT_FILE 1
437 #define DIRENT_DOT_DOT_FILE 2
438 #define DIRENT_OTHER_FILE 3
439 #define DIRENT_DELETED_FILE 4
442 * Inode scan definitions
444 typedef struct ext2_struct_inode_scan *ext2_inode_scan;
449 #define EXT2_SF_CHK_BADBLOCKS 0x0001
450 #define EXT2_SF_BAD_INODE_BLK 0x0002
451 #define EXT2_SF_BAD_EXTRA_BYTES 0x0004
452 #define EXT2_SF_SKIP_MISSING_ITABLE 0x0008
453 #define EXT2_SF_DO_LAZY 0x0010
456 * ext2fs_check_if_mounted flags
458 #define EXT2_MF_MOUNTED 1
459 #define EXT2_MF_ISROOT 2
460 #define EXT2_MF_READONLY 4
461 #define EXT2_MF_SWAP 8
462 #define EXT2_MF_BUSY 16
465 * Ext2/linux mode flags. We define them here so that we don't need
466 * to depend on the OS's sys/stat.h, since we may be compiling on a
469 #define LINUX_S_IFMT 00170000
470 #define LINUX_S_IFSOCK 0140000
471 #define LINUX_S_IFLNK 0120000
472 #define LINUX_S_IFREG 0100000
473 #define LINUX_S_IFBLK 0060000
474 #define LINUX_S_IFDIR 0040000
475 #define LINUX_S_IFCHR 0020000
476 #define LINUX_S_IFIFO 0010000
477 #define LINUX_S_ISUID 0004000
478 #define LINUX_S_ISGID 0002000
479 #define LINUX_S_ISVTX 0001000
481 #define LINUX_S_IRWXU 00700
482 #define LINUX_S_IRUSR 00400
483 #define LINUX_S_IWUSR 00200
484 #define LINUX_S_IXUSR 00100
486 #define LINUX_S_IRWXG 00070
487 #define LINUX_S_IRGRP 00040
488 #define LINUX_S_IWGRP 00020
489 #define LINUX_S_IXGRP 00010
491 #define LINUX_S_IRWXO 00007
492 #define LINUX_S_IROTH 00004
493 #define LINUX_S_IWOTH 00002
494 #define LINUX_S_IXOTH 00001
496 #define LINUX_S_ISLNK(m) (((m) & LINUX_S_IFMT) == LINUX_S_IFLNK)
497 #define LINUX_S_ISREG(m) (((m) & LINUX_S_IFMT) == LINUX_S_IFREG)
498 #define LINUX_S_ISDIR(m) (((m) & LINUX_S_IFMT) == LINUX_S_IFDIR)
499 #define LINUX_S_ISCHR(m) (((m) & LINUX_S_IFMT) == LINUX_S_IFCHR)
500 #define LINUX_S_ISBLK(m) (((m) & LINUX_S_IFMT) == LINUX_S_IFBLK)
501 #define LINUX_S_ISFIFO(m) (((m) & LINUX_S_IFMT) == LINUX_S_IFIFO)
502 #define LINUX_S_ISSOCK(m) (((m) & LINUX_S_IFMT) == LINUX_S_IFSOCK)
505 * ext2 size of an inode
507 #define EXT2_I_SIZE(i) ((i)->i_size | ((__u64) (i)->i_size_high << 32))
510 * ext2_icount_t abstraction
512 #define EXT2_ICOUNT_OPT_INCREMENT 0x01
514 typedef struct ext2_icount *ext2_icount_t;
517 * Flags for ext2fs_bmap
519 #define BMAP_ALLOC 0x0001
520 #define BMAP_SET 0x0002
523 * Returned flags from ext2fs_bmap
525 #define BMAP_RET_UNINIT 0x0001
528 * Flags for imager.c functions
530 #define IMAGER_FLAG_INODEMAP 1
531 #define IMAGER_FLAG_SPARSEWRITE 2
534 * For checking structure magic numbers...
537 #define EXT2_CHECK_MAGIC(struct, code) \
538 if ((struct)->magic != (code)) return (code)
541 * Flags for returning status of ext2fs_expand_extra_isize()
543 #define EXT2_EXPAND_EISIZE_UNSAFE 0x0001
544 #define EXT2_EXPAND_EISIZE_NEW_BLOCK 0x0002
545 #define EXT2_EXPAND_EISIZE_NOSPC 0x0004
548 * For ext2 compression support
550 #define EXT2FS_COMPRESSED_BLKADDR ((blk_t) -1)
551 #define HOLE_BLKADDR(_b) ((_b) == 0 || (_b) == EXT2FS_COMPRESSED_BLKADDR)
554 * Features supported by this version of the library
556 #define EXT2_LIB_FEATURE_COMPAT_SUPP (EXT2_FEATURE_COMPAT_DIR_PREALLOC|\
557 EXT2_FEATURE_COMPAT_IMAGIC_INODES|\
558 EXT3_FEATURE_COMPAT_HAS_JOURNAL|\
559 EXT2_FEATURE_COMPAT_RESIZE_INODE|\
560 EXT2_FEATURE_COMPAT_DIR_INDEX|\
561 EXT2_FEATURE_COMPAT_EXT_ATTR|\
562 EXT4_FEATURE_COMPAT_SPARSE_SUPER2)
564 /* This #ifdef is temporary until compression is fully supported */
565 #ifdef ENABLE_COMPRESSION
566 #ifndef I_KNOW_THAT_COMPRESSION_IS_EXPERIMENTAL
567 /* If the below warning bugs you, then have
568 `CPPFLAGS=-DI_KNOW_THAT_COMPRESSION_IS_EXPERIMENTAL' in your
569 environment at configure time. */
570 #warning "Compression support is experimental"
572 #define EXT2_LIB_FEATURE_INCOMPAT_SUPP (EXT2_FEATURE_INCOMPAT_FILETYPE|\
573 EXT2_FEATURE_INCOMPAT_COMPRESSION|\
574 EXT3_FEATURE_INCOMPAT_JOURNAL_DEV|\
575 EXT2_FEATURE_INCOMPAT_META_BG|\
576 EXT3_FEATURE_INCOMPAT_RECOVER|\
577 EXT3_FEATURE_INCOMPAT_EXTENTS|\
578 EXT4_FEATURE_INCOMPAT_FLEX_BG|\
579 EXT4_FEATURE_INCOMPAT_MMP|\
580 EXT4_FEATURE_INCOMPAT_64BIT)
582 #define EXT2_LIB_FEATURE_INCOMPAT_SUPP (EXT2_FEATURE_INCOMPAT_FILETYPE|\
583 EXT3_FEATURE_INCOMPAT_JOURNAL_DEV|\
584 EXT2_FEATURE_INCOMPAT_META_BG|\
585 EXT3_FEATURE_INCOMPAT_RECOVER|\
586 EXT3_FEATURE_INCOMPAT_EXTENTS|\
587 EXT4_FEATURE_INCOMPAT_FLEX_BG|\
588 EXT4_FEATURE_INCOMPAT_MMP|\
589 EXT4_FEATURE_INCOMPAT_64BIT)
592 #define EXT2_LIB_FEATURE_RO_COMPAT_SUPP (EXT2_FEATURE_RO_COMPAT_SPARSE_SUPER|\
593 EXT4_FEATURE_RO_COMPAT_HUGE_FILE|\
594 EXT2_FEATURE_RO_COMPAT_LARGE_FILE|\
595 EXT4_FEATURE_RO_COMPAT_DIR_NLINK|\
596 EXT4_FEATURE_RO_COMPAT_EXTRA_ISIZE|\
597 EXT4_FEATURE_RO_COMPAT_GDT_CSUM|\
598 EXT4_FEATURE_RO_COMPAT_BIGALLOC|\
599 EXT4_FEATURE_RO_COMPAT_QUOTA)
601 #define EXT2_LIB_FEATURE_RO_COMPAT_SUPP (EXT2_FEATURE_RO_COMPAT_SPARSE_SUPER|\
602 EXT4_FEATURE_RO_COMPAT_HUGE_FILE|\
603 EXT2_FEATURE_RO_COMPAT_LARGE_FILE|\
604 EXT4_FEATURE_RO_COMPAT_DIR_NLINK|\
605 EXT4_FEATURE_RO_COMPAT_EXTRA_ISIZE|\
606 EXT4_FEATURE_RO_COMPAT_GDT_CSUM|\
607 EXT4_FEATURE_RO_COMPAT_BIGALLOC)
611 * These features are only allowed if EXT2_FLAG_SOFTSUPP_FEATURES is passed
614 #define EXT2_LIB_SOFTSUPP_INCOMPAT (0)
615 #define EXT2_LIB_SOFTSUPP_RO_COMPAT (EXT4_FEATURE_RO_COMPAT_REPLICA)
618 /* Translate a block number to a cluster number */
619 #define EXT2FS_CLUSTER_RATIO(fs) (1 << (fs)->cluster_ratio_bits)
620 #define EXT2FS_CLUSTER_MASK(fs) (EXT2FS_CLUSTER_RATIO(fs) - 1)
621 #define EXT2FS_B2C(fs, blk) ((blk) >> (fs)->cluster_ratio_bits)
622 /* Translate a cluster number to a block number */
623 #define EXT2FS_C2B(fs, cluster) ((cluster) << (fs)->cluster_ratio_bits)
624 /* Translate # of blks to # of clusters */
625 #define EXT2FS_NUM_B2C(fs, blks) (((blks) + EXT2FS_CLUSTER_MASK(fs)) >> \
626 (fs)->cluster_ratio_bits)
628 #if defined(HAVE_FSTAT64) && !defined(__OSX_AVAILABLE_BUT_DEPRECATED)
629 typedef struct stat64 ext2fs_struct_stat;
631 typedef struct stat ext2fs_struct_stat;
635 * For ext2fs_close2() and ext2fs_flush2(), this flag allows you to
636 * avoid the fsync call.
638 #define EXT2_FLAG_FLUSH_NO_SYNC 1
641 * function prototypes
644 /* The LARGE_FILE feature should be set if we have stored files 2GB+ in size */
645 static inline int ext2fs_needs_large_file_feature(unsigned long long file_size)
647 return file_size >= 0x80000000ULL;
651 extern errcode_t ext2fs_new_inode(ext2_filsys fs, ext2_ino_t dir, int mode,
652 ext2fs_inode_bitmap map, ext2_ino_t *ret);
653 extern errcode_t ext2fs_new_block(ext2_filsys fs, blk_t goal,
654 ext2fs_block_bitmap map, blk_t *ret);
655 extern errcode_t ext2fs_new_block2(ext2_filsys fs, blk64_t goal,
656 ext2fs_block_bitmap map, blk64_t *ret);
657 extern errcode_t ext2fs_get_free_blocks(ext2_filsys fs, blk_t start,
658 blk_t finish, int num,
659 ext2fs_block_bitmap map,
661 extern errcode_t ext2fs_get_free_blocks2(ext2_filsys fs, blk64_t start,
662 blk64_t finish, int num,
663 ext2fs_block_bitmap map,
665 extern errcode_t ext2fs_alloc_block(ext2_filsys fs, blk_t goal,
666 char *block_buf, blk_t *ret);
667 extern errcode_t ext2fs_alloc_block2(ext2_filsys fs, blk64_t goal,
668 char *block_buf, blk64_t *ret);
669 extern void ext2fs_set_alloc_block_callback(ext2_filsys fs,
670 errcode_t (*func)(ext2_filsys fs,
673 errcode_t (**old)(ext2_filsys fs,
678 extern int ext2fs_reserve_super_and_bgd(ext2_filsys fs,
680 ext2fs_block_bitmap bmap);
681 extern void ext2fs_set_block_alloc_stats_callback(ext2_filsys fs,
682 void (*func)(ext2_filsys fs,
685 void (**old)(ext2_filsys fs,
690 void ext2fs_inode_alloc_stats(ext2_filsys fs, ext2_ino_t ino, int inuse);
691 void ext2fs_inode_alloc_stats2(ext2_filsys fs, ext2_ino_t ino,
692 int inuse, int isdir);
693 void ext2fs_block_alloc_stats(ext2_filsys fs, blk_t blk, int inuse);
694 void ext2fs_block_alloc_stats2(ext2_filsys fs, blk64_t blk, int inuse);
695 void ext2fs_block_alloc_stats_range(ext2_filsys fs, blk64_t blk,
696 blk_t num, int inuse);
699 extern errcode_t ext2fs_allocate_tables(ext2_filsys fs);
700 extern errcode_t ext2fs_allocate_group_table(ext2_filsys fs, dgrp_t group,
701 ext2fs_block_bitmap bmap);
704 extern errcode_t ext2fs_u32_list_create(ext2_u32_list *ret, int size);
705 extern errcode_t ext2fs_u32_list_add(ext2_u32_list bb, __u32 blk);
706 extern int ext2fs_u32_list_find(ext2_u32_list bb, __u32 blk);
707 extern int ext2fs_u32_list_test(ext2_u32_list bb, blk_t blk);
708 extern errcode_t ext2fs_u32_list_iterate_begin(ext2_u32_list bb,
709 ext2_u32_iterate *ret);
710 extern int ext2fs_u32_list_iterate(ext2_u32_iterate iter, blk_t *blk);
711 extern void ext2fs_u32_list_iterate_end(ext2_u32_iterate iter);
712 extern errcode_t ext2fs_u32_copy(ext2_u32_list src, ext2_u32_list *dest);
713 extern int ext2fs_u32_list_equal(ext2_u32_list bb1, ext2_u32_list bb2);
715 extern errcode_t ext2fs_badblocks_list_create(ext2_badblocks_list *ret,
717 extern errcode_t ext2fs_badblocks_list_add(ext2_badblocks_list bb,
719 extern int ext2fs_badblocks_list_test(ext2_badblocks_list bb,
721 extern int ext2fs_u32_list_del(ext2_u32_list bb, __u32 blk);
722 extern void ext2fs_badblocks_list_del(ext2_u32_list bb, __u32 blk);
724 ext2fs_badblocks_list_iterate_begin(ext2_badblocks_list bb,
725 ext2_badblocks_iterate *ret);
726 extern int ext2fs_badblocks_list_iterate(ext2_badblocks_iterate iter,
728 extern void ext2fs_badblocks_list_iterate_end(ext2_badblocks_iterate iter);
729 extern errcode_t ext2fs_badblocks_copy(ext2_badblocks_list src,
730 ext2_badblocks_list *dest);
731 extern int ext2fs_badblocks_equal(ext2_badblocks_list bb1,
732 ext2_badblocks_list bb2);
733 extern int ext2fs_u32_list_count(ext2_u32_list bb);
736 extern errcode_t badblocks_list_create(badblocks_list *ret, int size);
737 extern errcode_t badblocks_list_add(badblocks_list bb, blk_t blk);
738 extern int badblocks_list_test(badblocks_list bb, blk_t blk);
739 extern errcode_t badblocks_list_iterate_begin(badblocks_list bb,
740 badblocks_iterate *ret);
741 extern int badblocks_list_iterate(badblocks_iterate iter, blk_t *blk);
742 extern void badblocks_list_iterate_end(badblocks_iterate iter);
743 extern void badblocks_list_free(badblocks_list bb);
746 extern errcode_t ext2fs_update_bb_inode(ext2_filsys fs,
747 ext2_badblocks_list bb_list);
750 extern void ext2fs_free_block_bitmap(ext2fs_block_bitmap bitmap);
751 extern void ext2fs_free_inode_bitmap(ext2fs_inode_bitmap bitmap);
752 extern errcode_t ext2fs_copy_bitmap(ext2fs_generic_bitmap src,
753 ext2fs_generic_bitmap *dest);
754 extern errcode_t ext2fs_write_inode_bitmap(ext2_filsys fs);
755 extern errcode_t ext2fs_write_block_bitmap (ext2_filsys fs);
756 extern errcode_t ext2fs_read_inode_bitmap (ext2_filsys fs);
757 extern errcode_t ext2fs_read_block_bitmap(ext2_filsys fs);
758 extern errcode_t ext2fs_allocate_block_bitmap(ext2_filsys fs,
760 ext2fs_block_bitmap *ret);
761 extern errcode_t ext2fs_allocate_subcluster_bitmap(ext2_filsys fs,
763 ext2fs_block_bitmap *ret);
764 extern int ext2fs_get_bitmap_granularity(ext2fs_block_bitmap bitmap);
765 extern errcode_t ext2fs_allocate_inode_bitmap(ext2_filsys fs,
767 ext2fs_inode_bitmap *ret);
768 extern errcode_t ext2fs_fudge_inode_bitmap_end(ext2fs_inode_bitmap bitmap,
769 ext2_ino_t end, ext2_ino_t *oend);
770 extern errcode_t ext2fs_fudge_block_bitmap_end(ext2fs_block_bitmap bitmap,
771 blk_t end, blk_t *oend);
772 extern errcode_t ext2fs_fudge_block_bitmap_end2(ext2fs_block_bitmap bitmap,
773 blk64_t end, blk64_t *oend);
774 extern void ext2fs_clear_inode_bitmap(ext2fs_inode_bitmap bitmap);
775 extern void ext2fs_clear_block_bitmap(ext2fs_block_bitmap bitmap);
776 extern errcode_t ext2fs_read_bitmaps(ext2_filsys fs);
777 extern errcode_t ext2fs_write_bitmaps(ext2_filsys fs);
778 extern errcode_t ext2fs_resize_inode_bitmap(__u32 new_end, __u32 new_real_end,
779 ext2fs_inode_bitmap bmap);
780 extern errcode_t ext2fs_resize_inode_bitmap2(__u64 new_end,
782 ext2fs_inode_bitmap bmap);
783 extern errcode_t ext2fs_resize_block_bitmap(__u32 new_end, __u32 new_real_end,
784 ext2fs_block_bitmap bmap);
785 extern errcode_t ext2fs_resize_block_bitmap2(__u64 new_end,
787 ext2fs_block_bitmap bmap);
788 extern errcode_t ext2fs_compare_block_bitmap(ext2fs_block_bitmap bm1,
789 ext2fs_block_bitmap bm2);
790 extern errcode_t ext2fs_compare_inode_bitmap(ext2fs_inode_bitmap bm1,
791 ext2fs_inode_bitmap bm2);
792 extern errcode_t ext2fs_set_inode_bitmap_range(ext2fs_inode_bitmap bmap,
793 ext2_ino_t start, unsigned int num,
795 extern errcode_t ext2fs_set_inode_bitmap_range2(ext2fs_inode_bitmap bmap,
796 __u64 start, size_t num,
798 extern errcode_t ext2fs_get_inode_bitmap_range(ext2fs_inode_bitmap bmap,
799 ext2_ino_t start, unsigned int num,
801 extern errcode_t ext2fs_get_inode_bitmap_range2(ext2fs_inode_bitmap bmap,
802 __u64 start, size_t num,
804 extern errcode_t ext2fs_set_block_bitmap_range(ext2fs_block_bitmap bmap,
805 blk_t start, unsigned int num,
807 extern errcode_t ext2fs_set_block_bitmap_range2(ext2fs_block_bitmap bmap,
808 blk64_t start, size_t num,
810 extern errcode_t ext2fs_get_block_bitmap_range(ext2fs_block_bitmap bmap,
811 blk_t start, unsigned int num,
813 extern errcode_t ext2fs_get_block_bitmap_range2(ext2fs_block_bitmap bmap,
814 blk64_t start, size_t num,
818 extern dgrp_t ext2fs_group_of_blk2(ext2_filsys fs, blk64_t);
819 extern blk64_t ext2fs_group_first_block2(ext2_filsys fs, dgrp_t group);
820 extern blk64_t ext2fs_group_last_block2(ext2_filsys fs, dgrp_t group);
821 extern int ext2fs_group_blocks_count(ext2_filsys fs, dgrp_t group);
822 extern blk64_t ext2fs_inode_data_blocks2(ext2_filsys fs,
823 struct ext2_inode *inode);
824 extern blk64_t ext2fs_inode_i_blocks(ext2_filsys fs,
825 struct ext2_inode *inode);
826 extern blk64_t ext2fs_blocks_count(struct ext2_super_block *super);
827 extern void ext2fs_blocks_count_set(struct ext2_super_block *super,
829 extern void ext2fs_blocks_count_add(struct ext2_super_block *super,
831 extern blk64_t ext2fs_r_blocks_count(struct ext2_super_block *super);
832 extern void ext2fs_r_blocks_count_set(struct ext2_super_block *super,
834 extern void ext2fs_r_blocks_count_add(struct ext2_super_block *super,
836 extern blk64_t ext2fs_free_blocks_count(struct ext2_super_block *super);
837 extern void ext2fs_free_blocks_count_set(struct ext2_super_block *super,
839 extern void ext2fs_free_blocks_count_add(struct ext2_super_block *super,
841 /* Block group descriptor accessor functions */
842 extern struct ext2_group_desc *ext2fs_group_desc(ext2_filsys fs,
843 struct opaque_ext2_group_desc *gdp,
845 extern blk64_t ext2fs_block_bitmap_loc(ext2_filsys fs, dgrp_t group);
846 extern void ext2fs_block_bitmap_loc_set(ext2_filsys fs, dgrp_t group,
848 extern blk64_t ext2fs_inode_bitmap_loc(ext2_filsys fs, dgrp_t group);
849 extern void ext2fs_inode_bitmap_loc_set(ext2_filsys fs, dgrp_t group,
851 extern blk64_t ext2fs_inode_table_loc(ext2_filsys fs, dgrp_t group);
852 extern void ext2fs_inode_table_loc_set(ext2_filsys fs, dgrp_t group,
854 extern __u32 ext2fs_bg_free_blocks_count(ext2_filsys fs, dgrp_t group);
855 extern void ext2fs_bg_free_blocks_count_set(ext2_filsys fs, dgrp_t group,
857 extern __u32 ext2fs_bg_free_inodes_count(ext2_filsys fs, dgrp_t group);
858 extern void ext2fs_bg_free_inodes_count_set(ext2_filsys fs, dgrp_t group,
860 extern __u32 ext2fs_bg_used_dirs_count(ext2_filsys fs, dgrp_t group);
861 extern void ext2fs_bg_used_dirs_count_set(ext2_filsys fs, dgrp_t group,
863 extern __u32 ext2fs_bg_itable_unused(ext2_filsys fs, dgrp_t group);
864 extern void ext2fs_bg_itable_unused_set(ext2_filsys fs, dgrp_t group,
866 extern __u16 ext2fs_bg_flags(ext2_filsys fs, dgrp_t group);
867 extern void ext2fs_bg_flags_zap(ext2_filsys fs, dgrp_t group);
868 extern int ext2fs_bg_flags_test(ext2_filsys fs, dgrp_t group, __u16 bg_flag);
869 extern void ext2fs_bg_flags_set(ext2_filsys fs, dgrp_t group, __u16 bg_flags);
870 extern void ext2fs_bg_flags_clear(ext2_filsys fs, dgrp_t group, __u16 bg_flags);
871 extern __u16 ext2fs_bg_checksum(ext2_filsys fs, dgrp_t group);
872 extern void ext2fs_bg_checksum_set(ext2_filsys fs, dgrp_t group, __u16 checksum);
873 extern blk64_t ext2fs_file_acl_block(ext2_filsys fs,
874 const struct ext2_inode *inode);
875 extern void ext2fs_file_acl_block_set(ext2_filsys fs,
876 struct ext2_inode *inode, blk64_t blk);
877 extern errcode_t ext2fs_inode_size_set(ext2_filsys fs, struct ext2_inode *inode,
881 extern errcode_t ext2fs_block_iterate(ext2_filsys fs,
885 int (*func)(ext2_filsys fs,
890 errcode_t ext2fs_block_iterate2(ext2_filsys fs,
894 int (*func)(ext2_filsys fs,
896 e2_blkcnt_t blockcnt,
901 errcode_t ext2fs_block_iterate3(ext2_filsys fs,
905 int (*func)(ext2_filsys fs,
907 e2_blkcnt_t blockcnt,
914 extern errcode_t ext2fs_bmap(ext2_filsys fs, ext2_ino_t ino,
915 struct ext2_inode *inode,
916 char *block_buf, int bmap_flags,
917 blk_t block, blk_t *phys_blk);
918 extern errcode_t ext2fs_bmap2(ext2_filsys fs, ext2_ino_t ino,
919 struct ext2_inode *inode,
920 char *block_buf, int bmap_flags, blk64_t block,
921 int *ret_flags, blk64_t *phys_blk);
922 errcode_t ext2fs_map_cluster_block(ext2_filsys fs, ext2_ino_t ino,
923 struct ext2_inode *inode, blk64_t lblk,
928 extern errcode_t ext2fs_move_blocks(ext2_filsys fs,
929 ext2fs_block_bitmap reserve,
930 ext2fs_block_bitmap alloc_map,
935 extern errcode_t ext2fs_check_desc(ext2_filsys fs);
938 extern errcode_t ext2fs_close(ext2_filsys fs);
939 extern errcode_t ext2fs_close2(ext2_filsys fs, int flags);
940 extern errcode_t ext2fs_close_free(ext2_filsys *fs);
941 extern errcode_t ext2fs_flush(ext2_filsys fs);
942 extern errcode_t ext2fs_flush2(ext2_filsys fs, int flags);
943 extern int ext2fs_bg_has_super(ext2_filsys fs, dgrp_t group_block);
944 extern errcode_t ext2fs_super_and_bgd_loc2(ext2_filsys fs,
946 blk64_t *ret_super_blk,
947 blk64_t *ret_old_desc_blk,
948 blk64_t *ret_new_desc_blk,
949 blk_t *ret_used_blks);
950 extern int ext2fs_super_and_bgd_loc(ext2_filsys fs,
952 blk_t *ret_super_blk,
953 blk_t *ret_old_desc_blk,
954 blk_t *ret_new_desc_blk,
956 extern void ext2fs_update_dynamic_rev(ext2_filsys fs);
959 extern __u32 ext2fs_crc32c_be(__u32 crc, unsigned char const *p, size_t len);
960 extern __u32 ext2fs_crc32c_le(__u32 crc, unsigned char const *p, size_t len);
963 extern void ext2fs_group_desc_csum_set(ext2_filsys fs, dgrp_t group);
964 extern int ext2fs_group_desc_csum_verify(ext2_filsys fs, dgrp_t group);
965 extern errcode_t ext2fs_set_gdt_csum(ext2_filsys fs);
966 extern __u16 ext2fs_group_desc_csum(ext2_filsys fs, dgrp_t group);
970 extern errcode_t ext2fs_get_num_dirs(ext2_filsys fs, ext2_ino_t *ret_num_dirs);
971 extern errcode_t ext2fs_init_dblist(ext2_filsys fs, ext2_dblist *ret_dblist);
972 extern errcode_t ext2fs_add_dir_block(ext2_dblist dblist, ext2_ino_t ino,
973 blk_t blk, int blockcnt);
974 extern errcode_t ext2fs_add_dir_block2(ext2_dblist dblist, ext2_ino_t ino,
975 blk64_t blk, e2_blkcnt_t blockcnt);
976 extern void ext2fs_dblist_sort(ext2_dblist dblist,
977 EXT2_QSORT_TYPE (*sortfunc)(const void *,
979 extern void ext2fs_dblist_sort2(ext2_dblist dblist,
980 EXT2_QSORT_TYPE (*sortfunc)(const void *,
982 extern errcode_t ext2fs_dblist_iterate(ext2_dblist dblist,
983 int (*func)(ext2_filsys fs, struct ext2_db_entry *db_info,
986 extern errcode_t ext2fs_dblist_iterate2(ext2_dblist dblist,
987 int (*func)(ext2_filsys fs, struct ext2_db_entry2 *db_info,
990 extern errcode_t ext2fs_set_dir_block(ext2_dblist dblist, ext2_ino_t ino,
991 blk_t blk, int blockcnt);
992 extern errcode_t ext2fs_set_dir_block2(ext2_dblist dblist, ext2_ino_t ino,
993 blk64_t blk, e2_blkcnt_t blockcnt);
994 extern errcode_t ext2fs_copy_dblist(ext2_dblist src,
996 extern int ext2fs_dblist_count(ext2_dblist dblist);
997 extern blk64_t ext2fs_dblist_count2(ext2_dblist dblist);
998 extern errcode_t ext2fs_dblist_get_last(ext2_dblist dblist,
999 struct ext2_db_entry **entry);
1000 extern errcode_t ext2fs_dblist_get_last2(ext2_dblist dblist,
1001 struct ext2_db_entry2 **entry);
1002 extern errcode_t ext2fs_dblist_drop_last(ext2_dblist dblist);
1006 ext2fs_dblist_dir_iterate(ext2_dblist dblist,
1009 int (*func)(ext2_ino_t dir,
1011 struct ext2_dir_entry *dirent,
1019 extern errcode_t ext2fs_read_dir_block(ext2_filsys fs, blk_t block,
1021 extern errcode_t ext2fs_read_dir_block2(ext2_filsys fs, blk_t block,
1022 void *buf, int flags);
1023 extern errcode_t ext2fs_read_dir_block3(ext2_filsys fs, blk64_t block,
1024 void *buf, int flags);
1025 extern errcode_t ext2fs_write_dir_block(ext2_filsys fs, blk_t block,
1027 extern errcode_t ext2fs_write_dir_block2(ext2_filsys fs, blk_t block,
1028 void *buf, int flags);
1029 extern errcode_t ext2fs_write_dir_block3(ext2_filsys fs, blk64_t block,
1030 void *buf, int flags);
1033 extern errcode_t ext2fs_dirhash(int version, const char *name, int len,
1035 ext2_dirhash_t *ret_hash,
1036 ext2_dirhash_t *ret_minor_hash);
1040 extern errcode_t ext2fs_get_rec_len(ext2_filsys fs,
1041 struct ext2_dir_entry *dirent,
1042 unsigned int *rec_len);
1043 extern errcode_t ext2fs_set_rec_len(ext2_filsys fs,
1045 struct ext2_dir_entry *dirent);
1046 extern errcode_t ext2fs_dir_iterate(ext2_filsys fs,
1050 int (*func)(struct ext2_dir_entry *dirent,
1056 extern errcode_t ext2fs_dir_iterate2(ext2_filsys fs,
1060 int (*func)(ext2_ino_t dir,
1062 struct ext2_dir_entry *dirent,
1070 extern errcode_t ext2fs_dup_handle(ext2_filsys src, ext2_filsys *dest);
1073 extern errcode_t ext2fs_expand_dir(ext2_filsys fs, ext2_ino_t dir);
1076 extern errcode_t ext2fs_attr_get(ext2_filsys fs, struct ext2_inode *inode,
1077 int name_index, const char *name, char *buffer,
1078 size_t buffer_size, int *easize);
1080 extern __u32 ext2fs_ext_attr_hash_entry(struct ext2_ext_attr_entry *entry,
1082 int ext2fs_attr_get_next_attr(struct ext2_ext_attr_entry *entry, int name_index,
1083 char *buffer, int buffer_size, int start);
1084 errcode_t ext2fs_attr_set(ext2_filsys fs, ext2_ino_t ino,
1085 struct ext2_inode *inode,
1086 int name_index, const char *name, const char *value,
1087 int value_len, int flags);
1088 extern errcode_t ext2fs_expand_extra_isize(ext2_filsys fs, ext2_ino_t ino,
1089 struct ext2_inode_large *inode,
1090 int new_extra_isize, int *ret,
1092 extern errcode_t ext2fs_read_ext_attr(ext2_filsys fs, blk_t block, void *buf);
1093 extern errcode_t ext2fs_read_ext_attr2(ext2_filsys fs, blk64_t block,
1095 extern errcode_t ext2fs_write_ext_attr(ext2_filsys fs, blk_t block,
1097 extern errcode_t ext2fs_write_ext_attr2(ext2_filsys fs, blk64_t block,
1099 extern errcode_t ext2fs_adjust_ea_refcount(ext2_filsys fs, blk_t blk,
1101 int adjust, __u32 *newcount);
1102 extern errcode_t ext2fs_adjust_ea_refcount2(ext2_filsys fs, blk64_t blk,
1104 int adjust, __u32 *newcount);
1107 extern errcode_t ext2fs_extent_header_verify(void *ptr, int size);
1108 extern errcode_t ext2fs_extent_open(ext2_filsys fs, ext2_ino_t ino,
1109 ext2_extent_handle_t *handle);
1110 extern errcode_t ext2fs_extent_open2(ext2_filsys fs, ext2_ino_t ino,
1111 struct ext2_inode *inode,
1112 ext2_extent_handle_t *ret_handle);
1113 extern void ext2fs_extent_free(ext2_extent_handle_t handle);
1114 extern errcode_t ext2fs_extent_get(ext2_extent_handle_t handle,
1115 int flags, struct ext2fs_extent *extent);
1116 extern errcode_t ext2fs_extent_node_split(ext2_extent_handle_t handle);
1117 extern errcode_t ext2fs_extent_replace(ext2_extent_handle_t handle, int flags,
1118 struct ext2fs_extent *extent);
1119 extern errcode_t ext2fs_extent_insert(ext2_extent_handle_t handle, int flags,
1120 struct ext2fs_extent *extent);
1121 extern errcode_t ext2fs_extent_set_bmap(ext2_extent_handle_t handle,
1122 blk64_t logical, blk64_t physical,
1124 extern errcode_t ext2fs_extent_delete(ext2_extent_handle_t handle, int flags);
1125 extern errcode_t ext2fs_extent_get_info(ext2_extent_handle_t handle,
1126 struct ext2_extent_info *info);
1127 extern errcode_t ext2fs_extent_goto(ext2_extent_handle_t handle,
1129 extern errcode_t ext2fs_extent_goto2(ext2_extent_handle_t handle,
1130 int leaf_level, blk64_t blk);
1131 extern errcode_t ext2fs_extent_fix_parents(ext2_extent_handle_t handle);
1134 extern errcode_t ext2fs_file_open2(ext2_filsys fs, ext2_ino_t ino,
1135 struct ext2_inode *inode,
1136 int flags, ext2_file_t *ret);
1137 extern errcode_t ext2fs_file_open(ext2_filsys fs, ext2_ino_t ino,
1138 int flags, ext2_file_t *ret);
1139 extern ext2_filsys ext2fs_file_get_fs(ext2_file_t file);
1140 struct ext2_inode *ext2fs_file_get_inode(ext2_file_t file);
1141 extern ext2_ino_t ext2fs_file_get_inode_num(ext2_file_t file);
1142 extern errcode_t ext2fs_file_close(ext2_file_t file);
1143 extern errcode_t ext2fs_file_flush(ext2_file_t file);
1144 extern errcode_t ext2fs_file_read(ext2_file_t file, void *buf,
1145 unsigned int wanted, unsigned int *got);
1146 extern errcode_t ext2fs_file_write(ext2_file_t file, const void *buf,
1147 unsigned int nbytes, unsigned int *written);
1148 extern errcode_t ext2fs_file_llseek(ext2_file_t file, __u64 offset,
1149 int whence, __u64 *ret_pos);
1150 extern errcode_t ext2fs_file_lseek(ext2_file_t file, ext2_off_t offset,
1151 int whence, ext2_off_t *ret_pos);
1152 errcode_t ext2fs_file_get_lsize(ext2_file_t file, __u64 *ret_size);
1153 extern ext2_off_t ext2fs_file_get_size(ext2_file_t file);
1154 extern errcode_t ext2fs_file_set_size(ext2_file_t file, ext2_off_t size);
1155 extern errcode_t ext2fs_file_set_size2(ext2_file_t file, ext2_off64_t size);
1158 extern char *ext2fs_find_block_device(dev_t device);
1161 extern errcode_t ext2fs_sync_device(int fd, int flushb);
1164 extern void ext2fs_free(ext2_filsys fs);
1165 extern void ext2fs_free_dblist(ext2_dblist dblist);
1166 extern void ext2fs_badblocks_list_free(ext2_badblocks_list bb);
1167 extern void ext2fs_u32_list_free(ext2_u32_list bb);
1170 extern void ext2fs_free_generic_bitmap(ext2fs_inode_bitmap bitmap);
1171 extern errcode_t ext2fs_make_generic_bitmap(errcode_t magic, ext2_filsys fs,
1172 __u32 start, __u32 end,
1174 const char *descr, char *init_map,
1175 ext2fs_generic_bitmap *ret);
1176 extern errcode_t ext2fs_allocate_generic_bitmap(__u32 start,
1180 ext2fs_generic_bitmap *ret);
1181 extern errcode_t ext2fs_copy_generic_bitmap(ext2fs_generic_bitmap src,
1182 ext2fs_generic_bitmap *dest);
1183 extern void ext2fs_clear_generic_bitmap(ext2fs_generic_bitmap bitmap);
1184 extern errcode_t ext2fs_fudge_generic_bitmap_end(ext2fs_inode_bitmap bitmap,
1189 extern void ext2fs_set_generic_bitmap_padding(ext2fs_generic_bitmap map);
1190 extern errcode_t ext2fs_resize_generic_bitmap(errcode_t magic,
1193 ext2fs_generic_bitmap bmap);
1194 extern errcode_t ext2fs_compare_generic_bitmap(errcode_t magic, errcode_t neq,
1195 ext2fs_generic_bitmap bm1,
1196 ext2fs_generic_bitmap bm2);
1197 extern errcode_t ext2fs_get_generic_bitmap_range(ext2fs_generic_bitmap bmap,
1199 __u32 start, __u32 num,
1201 extern errcode_t ext2fs_set_generic_bitmap_range(ext2fs_generic_bitmap bmap,
1203 __u32 start, __u32 num,
1205 extern errcode_t ext2fs_find_first_zero_generic_bitmap(ext2fs_generic_bitmap bitmap,
1206 __u32 start, __u32 end,
1208 extern errcode_t ext2fs_find_first_set_generic_bitmap(ext2fs_generic_bitmap bitmap,
1209 __u32 start, __u32 end,
1212 /* gen_bitmap64.c */
1214 /* Generate and print bitmap usage statistics */
1217 void ext2fs_free_generic_bmap(ext2fs_generic_bitmap bmap);
1218 errcode_t ext2fs_alloc_generic_bmap(ext2_filsys fs, errcode_t magic,
1219 int type, __u64 start, __u64 end,
1222 ext2fs_generic_bitmap *ret);
1223 errcode_t ext2fs_copy_generic_bmap(ext2fs_generic_bitmap src,
1224 ext2fs_generic_bitmap *dest);
1225 void ext2fs_clear_generic_bmap(ext2fs_generic_bitmap bitmap);
1226 errcode_t ext2fs_fudge_generic_bmap_end(ext2fs_generic_bitmap bitmap,
1228 __u64 end, __u64 *oend);
1229 void ext2fs_set_generic_bmap_padding(ext2fs_generic_bitmap bmap);
1230 errcode_t ext2fs_resize_generic_bmap(ext2fs_generic_bitmap bmap,
1232 __u64 new_real_end);
1233 errcode_t ext2fs_compare_generic_bmap(errcode_t neq,
1234 ext2fs_generic_bitmap bm1,
1235 ext2fs_generic_bitmap bm2);
1236 errcode_t ext2fs_get_generic_bmap_range(ext2fs_generic_bitmap bmap,
1237 __u64 start, unsigned int num,
1239 errcode_t ext2fs_set_generic_bmap_range(ext2fs_generic_bitmap bmap,
1240 __u64 start, unsigned int num,
1242 errcode_t ext2fs_convert_subcluster_bitmap(ext2_filsys fs,
1243 ext2fs_block_bitmap *bitmap);
1246 extern errcode_t ext2fs_get_device_size(const char *file, int blocksize,
1248 extern errcode_t ext2fs_get_device_size2(const char *file, int blocksize,
1249 blk64_t *retblocks);
1252 extern int ext2fs_get_dio_alignment(int fd);
1253 errcode_t ext2fs_get_device_sectsize(const char *file, int *sectsize);
1254 errcode_t ext2fs_get_device_phys_sectsize(const char *file, int *sectsize);
1257 errcode_t ext2fs_iblk_add_blocks(ext2_filsys fs, struct ext2_inode *inode,
1258 blk64_t num_blocks);
1259 errcode_t ext2fs_iblk_sub_blocks(ext2_filsys fs, struct ext2_inode *inode,
1260 blk64_t num_blocks);
1261 errcode_t ext2fs_iblk_set(ext2_filsys fs, struct ext2_inode *inode, blk64_t b);
1264 extern errcode_t ext2fs_image_inode_write(ext2_filsys fs, int fd, int flags);
1265 extern errcode_t ext2fs_image_inode_read(ext2_filsys fs, int fd, int flags);
1266 extern errcode_t ext2fs_image_super_write(ext2_filsys fs, int fd, int flags);
1267 extern errcode_t ext2fs_image_super_read(ext2_filsys fs, int fd, int flags);
1268 extern errcode_t ext2fs_image_bitmap_write(ext2_filsys fs, int fd, int flags);
1269 extern errcode_t ext2fs_image_bitmap_read(ext2_filsys fs, int fd, int flags);
1272 errcode_t ext2fs_read_ind_block(ext2_filsys fs, blk_t blk, void *buf);
1273 errcode_t ext2fs_write_ind_block(ext2_filsys fs, blk_t blk, void *buf);
1276 extern errcode_t ext2fs_initialize(const char *name, int flags,
1277 struct ext2_super_block *param,
1278 io_manager manager, ext2_filsys *ret_fs);
1281 extern void ext2fs_free_icount(ext2_icount_t icount);
1282 extern int ext2fs_icount_is_set(ext2_icount_t icount, ext2_ino_t ino);
1283 extern errcode_t ext2fs_create_icount_tdb(ext2_filsys fs, char *tdb_dir,
1284 int flags, ext2_icount_t *ret);
1285 extern errcode_t ext2fs_create_icount2(ext2_filsys fs, int flags,
1287 ext2_icount_t hint, ext2_icount_t *ret);
1288 extern errcode_t ext2fs_create_icount(ext2_filsys fs, int flags,
1290 ext2_icount_t *ret);
1291 extern errcode_t ext2fs_icount_fetch(ext2_icount_t icount, ext2_ino_t ino,
1293 extern errcode_t ext2fs_icount_increment(ext2_icount_t icount, ext2_ino_t ino,
1295 extern errcode_t ext2fs_icount_decrement(ext2_icount_t icount, ext2_ino_t ino,
1297 extern errcode_t ext2fs_icount_store(ext2_icount_t icount, ext2_ino_t ino,
1299 extern ext2_ino_t ext2fs_get_icount_size(ext2_icount_t icount);
1300 errcode_t ext2fs_icount_validate(ext2_icount_t icount, FILE *);
1304 extern errcode_t ext2fs_get_memalign(unsigned long size,
1305 unsigned long align, void *ptr);
1308 extern errcode_t ext2fs_flush_icache(ext2_filsys fs);
1309 extern errcode_t ext2fs_get_next_inode_full(ext2_inode_scan scan,
1311 struct ext2_inode *inode,
1313 extern errcode_t ext2fs_open_inode_scan(ext2_filsys fs, int buffer_blocks,
1314 ext2_inode_scan *ret_scan);
1315 extern void ext2fs_close_inode_scan(ext2_inode_scan scan);
1316 extern errcode_t ext2fs_get_next_inode(ext2_inode_scan scan, ext2_ino_t *ino,
1317 struct ext2_inode *inode);
1318 extern errcode_t ext2fs_inode_scan_goto_blockgroup(ext2_inode_scan scan,
1320 extern void ext2fs_set_inode_callback
1321 (ext2_inode_scan scan,
1322 errcode_t (*done_group)(ext2_filsys fs,
1323 ext2_inode_scan scan,
1326 void *done_group_data);
1327 extern int ext2fs_inode_scan_flags(ext2_inode_scan scan, int set_flags,
1329 extern errcode_t ext2fs_read_inode_full(ext2_filsys fs, ext2_ino_t ino,
1330 struct ext2_inode * inode,
1332 extern errcode_t ext2fs_read_inode (ext2_filsys fs, ext2_ino_t ino,
1333 struct ext2_inode * inode);
1334 extern errcode_t ext2fs_write_inode_full(ext2_filsys fs, ext2_ino_t ino,
1335 struct ext2_inode * inode,
1337 extern errcode_t ext2fs_write_inode(ext2_filsys fs, ext2_ino_t ino,
1338 struct ext2_inode * inode);
1339 extern errcode_t ext2fs_write_new_inode(ext2_filsys fs, ext2_ino_t ino,
1340 struct ext2_inode * inode);
1341 extern errcode_t ext2fs_get_blocks(ext2_filsys fs, ext2_ino_t ino, blk_t *blocks);
1342 extern errcode_t ext2fs_check_directory(ext2_filsys fs, ext2_ino_t ino);
1345 extern io_manager inode_io_manager;
1346 extern errcode_t ext2fs_inode_io_intern(ext2_filsys fs, ext2_ino_t ino,
1348 extern errcode_t ext2fs_inode_io_intern2(ext2_filsys fs, ext2_ino_t ino,
1349 struct ext2_inode *inode,
1353 extern errcode_t ext2fs_check_if_mounted(const char *file, int *mount_flags);
1354 extern errcode_t ext2fs_check_mount_point(const char *device, int *mount_flags,
1355 char *mtpt, int mtlen);
1359 * NOTE: This function removes from an inode the blocks "start", "end", and
1360 * every block in between.
1362 extern errcode_t ext2fs_punch(ext2_filsys fs, ext2_ino_t ino,
1363 struct ext2_inode *inode,
1364 char *block_buf, blk64_t start,
1368 extern errcode_t ext2fs_lookup(ext2_filsys fs, ext2_ino_t dir, const char *name,
1369 int namelen, char *buf, ext2_ino_t *inode);
1370 extern errcode_t ext2fs_namei(ext2_filsys fs, ext2_ino_t root, ext2_ino_t cwd,
1371 const char *name, ext2_ino_t *inode);
1372 errcode_t ext2fs_namei_follow(ext2_filsys fs, ext2_ino_t root, ext2_ino_t cwd,
1373 const char *name, ext2_ino_t *inode);
1374 extern errcode_t ext2fs_follow_link(ext2_filsys fs, ext2_ino_t root, ext2_ino_t cwd,
1375 ext2_ino_t inode, ext2_ino_t *res_inode);
1378 int ext2fs_native_flag(void);
1381 extern errcode_t ext2fs_new_dir_block(ext2_filsys fs, ext2_ino_t dir_ino,
1382 ext2_ino_t parent_ino, char **block);
1385 extern errcode_t ext2fs_mkdir(ext2_filsys fs, ext2_ino_t parent, ext2_ino_t inum,
1389 extern errcode_t ext2fs_zero_blocks(ext2_filsys fs, blk_t blk, int num,
1390 blk_t *ret_blk, int *ret_count);
1391 extern errcode_t ext2fs_zero_blocks2(ext2_filsys fs, blk64_t blk, int num,
1392 blk64_t *ret_blk, int *ret_count);
1393 extern errcode_t ext2fs_create_journal_superblock(ext2_filsys fs,
1394 __u32 num_blocks, int flags,
1396 extern errcode_t ext2fs_add_journal_device(ext2_filsys fs,
1397 ext2_filsys journal_dev);
1398 extern errcode_t ext2fs_add_journal_inode(ext2_filsys fs, blk_t num_blocks,
1400 extern errcode_t ext2fs_add_journal_inode2(ext2_filsys fs, blk_t num_blocks,
1401 blk64_t goal, int flags);
1402 extern int ext2fs_default_journal_size(__u64 num_blocks);
1403 extern int ext2fs_journal_sb_start(int blocksize);
1406 extern errcode_t ext2fs_open(const char *name, int flags, int superblock,
1407 unsigned int block_size, io_manager manager,
1408 ext2_filsys *ret_fs);
1409 extern errcode_t ext2fs_open2(const char *name, const char *io_options,
1410 int flags, int superblock,
1411 unsigned int block_size, io_manager manager,
1412 ext2_filsys *ret_fs);
1414 * The dgrp_t argument to these two functions is not actually a group number
1415 * but a block number offset within a group table! Convert with the formula
1416 * (group_number / groups_per_block).
1418 extern blk64_t ext2fs_descriptor_block_loc2(ext2_filsys fs,
1419 blk64_t group_block, dgrp_t i);
1420 extern blk_t ext2fs_descriptor_block_loc(ext2_filsys fs, blk_t group_block,
1422 errcode_t ext2fs_get_data_io(ext2_filsys fs, io_channel *old_io);
1423 errcode_t ext2fs_set_data_io(ext2_filsys fs, io_channel new_io);
1424 errcode_t ext2fs_rewrite_to_io(ext2_filsys fs, io_channel new_io);
1426 /* get_pathname.c */
1427 extern errcode_t ext2fs_get_pathname(ext2_filsys fs, ext2_ino_t dir, ext2_ino_t ino,
1431 errcode_t ext2fs_link(ext2_filsys fs, ext2_ino_t dir, const char *name,
1432 ext2_ino_t ino, int flags);
1433 errcode_t ext2fs_unlink(ext2_filsys fs, ext2_ino_t dir, const char *name,
1434 ext2_ino_t ino, int flags);
1437 errcode_t ext2fs_symlink(ext2_filsys fs, ext2_ino_t parent, ext2_ino_t ino,
1438 const char *name, char *target);
1441 errcode_t ext2fs_mmp_read(ext2_filsys fs, blk64_t mmp_blk, void *buf);
1442 errcode_t ext2fs_mmp_write(ext2_filsys fs, blk64_t mmp_blk, void *buf);
1443 errcode_t ext2fs_mmp_clear(ext2_filsys fs);
1444 errcode_t ext2fs_mmp_init(ext2_filsys fs);
1445 errcode_t ext2fs_mmp_start(ext2_filsys fs);
1446 errcode_t ext2fs_mmp_update(ext2_filsys fs);
1447 errcode_t ext2fs_mmp_stop(ext2_filsys fs);
1448 unsigned ext2fs_mmp_new_seq(void);
1451 extern errcode_t ext2fs_read_bb_inode(ext2_filsys fs,
1452 ext2_badblocks_list *bb_list);
1454 /* read_bb_file.c */
1455 extern errcode_t ext2fs_read_bb_FILE2(ext2_filsys fs, FILE *f,
1456 ext2_badblocks_list *bb_list,
1458 void (*invalid)(ext2_filsys fs,
1462 extern errcode_t ext2fs_read_bb_FILE(ext2_filsys fs, FILE *f,
1463 ext2_badblocks_list *bb_list,
1464 void (*invalid)(ext2_filsys fs,
1468 extern errcode_t ext2fs_create_resize_inode(ext2_filsys fs);
1471 extern void ext2fs_swap_ext_attr(char *to, char *from, int bufsize,
1473 extern void ext2fs_swap_ext_attr_header(struct ext2_ext_attr_header *to_header,
1474 struct ext2_ext_attr_header *from_hdr);
1475 extern void ext2fs_swap_ext_attr_entry(struct ext2_ext_attr_entry *to_entry,
1476 struct ext2_ext_attr_entry *from_entry);
1477 extern void ext2fs_swap_super(struct ext2_super_block * super);
1478 extern void ext2fs_swap_group_desc(struct ext2_group_desc *gdp);
1479 extern void ext2fs_swap_group_desc2(ext2_filsys, struct ext2_group_desc *gdp);
1480 extern void ext2fs_swap_inode_full(ext2_filsys fs, struct ext2_inode_large *t,
1481 struct ext2_inode_large *f, int hostorder,
1483 extern void ext2fs_swap_inode(ext2_filsys fs,struct ext2_inode *t,
1484 struct ext2_inode *f, int hostorder);
1485 extern void ext2fs_swap_mmp(struct mmp_struct *mmp);
1488 extern int ext2fs_open_file(const char *pathname, int flags, mode_t mode);
1489 extern int ext2fs_stat(const char *path, ext2fs_struct_stat *buf);
1490 extern int ext2fs_fstat(int fd, ext2fs_struct_stat *buf);
1493 extern int ext2fs_inode_has_valid_blocks(struct ext2_inode *inode);
1494 extern int ext2fs_inode_has_valid_blocks2(ext2_filsys fs,
1495 struct ext2_inode *inode);
1498 extern int ext2fs_parse_version_string(const char *ver_string);
1499 extern int ext2fs_get_library_version(const char **ver_string,
1500 const char **date_string);
1502 /* write_bb_file.c */
1503 extern errcode_t ext2fs_write_bb_FILE(ext2_badblocks_list bb_list,
1508 /* inline functions */
1509 #ifdef NO_INLINE_FUNCS
1510 extern errcode_t ext2fs_get_mem(unsigned long size, void *ptr);
1511 extern errcode_t ext2fs_get_memzero(unsigned long size, void *ptr);
1512 extern errcode_t ext2fs_get_array(unsigned long count,
1513 unsigned long size, void *ptr);
1514 extern errcode_t ext2fs_get_arrayzero(unsigned long count,
1515 unsigned long size, void *ptr);
1516 extern errcode_t ext2fs_free_mem(void *ptr);
1517 extern errcode_t ext2fs_resize_mem(unsigned long old_size,
1518 unsigned long size, void *ptr);
1519 extern void ext2fs_mark_super_dirty(ext2_filsys fs);
1520 extern void ext2fs_mark_changed(ext2_filsys fs);
1521 extern int ext2fs_test_changed(ext2_filsys fs);
1522 extern void ext2fs_mark_valid(ext2_filsys fs);
1523 extern void ext2fs_unmark_valid(ext2_filsys fs);
1524 extern int ext2fs_test_valid(ext2_filsys fs);
1525 extern void ext2fs_mark_ib_dirty(ext2_filsys fs);
1526 extern void ext2fs_mark_bb_dirty(ext2_filsys fs);
1527 extern int ext2fs_test_ib_dirty(ext2_filsys fs);
1528 extern int ext2fs_test_bb_dirty(ext2_filsys fs);
1529 extern dgrp_t ext2fs_group_of_blk(ext2_filsys fs, blk_t blk);
1530 extern dgrp_t ext2fs_group_of_ino(ext2_filsys fs, ext2_ino_t ino);
1531 extern blk_t ext2fs_group_first_block(ext2_filsys fs, dgrp_t group);
1532 extern blk_t ext2fs_group_last_block(ext2_filsys fs, dgrp_t group);
1533 extern blk_t ext2fs_inode_data_blocks(ext2_filsys fs,
1534 struct ext2_inode *inode);
1535 extern unsigned int ext2fs_div_ceil(unsigned int a, unsigned int b);
1536 extern __u64 ext2fs_div64_ceil(__u64 a, __u64 b);
1540 * The actual inlined functions definitions themselves...
1542 * If NO_INLINE_FUNCS is defined, then we won't try to do inline
1545 #if (defined(INCLUDE_INLINE_FUNCS) || !defined(NO_INLINE_FUNCS))
1546 #ifdef INCLUDE_INLINE_FUNCS
1547 #define _INLINE_ extern
1549 #if (__STDC_VERSION__ >= 199901L)
1550 #define _INLINE_ inline
1553 #define _INLINE_ extern __inline__
1554 #else /* For Watcom C */
1555 #define _INLINE_ extern inline
1556 #endif /* __GNUC__ */
1557 #endif /* __STDC_VERSION__ >= 199901L */
1560 #ifndef EXT2_CUSTOM_MEMORY_ROUTINES
1563 * Allocate memory. The 'ptr' arg must point to a pointer.
1565 _INLINE_ errcode_t ext2fs_get_mem(unsigned long size, void *ptr)
1571 return EXT2_ET_NO_MEMORY;
1572 memcpy(ptr, &pp, sizeof (pp));
1576 _INLINE_ errcode_t ext2fs_get_memzero(unsigned long size, void *ptr)
1582 return EXT2_ET_NO_MEMORY;
1583 memset(pp, 0, size);
1584 memcpy(ptr, &pp, sizeof(pp));
1588 _INLINE_ errcode_t ext2fs_get_array(unsigned long count, unsigned long size, void *ptr)
1590 if (count && (-1UL)/count<size)
1591 return EXT2_ET_NO_MEMORY;
1592 return ext2fs_get_mem(count*size, ptr);
1595 _INLINE_ errcode_t ext2fs_get_arrayzero(unsigned long count,
1596 unsigned long size, void *ptr)
1600 if (count && (-1UL)/count<size)
1601 return EXT2_ET_NO_MEMORY;
1602 pp = calloc(count, size);
1604 return EXT2_ET_NO_MEMORY;
1605 memcpy(ptr, &pp, sizeof(pp));
1610 * Free memory. The 'ptr' arg must point to a pointer.
1612 _INLINE_ errcode_t ext2fs_free_mem(void *ptr)
1616 memcpy(&p, ptr, sizeof(p));
1619 memcpy(ptr, &p, sizeof(p));
1624 * Resize memory. The 'ptr' arg must point to a pointer.
1626 _INLINE_ errcode_t ext2fs_resize_mem(unsigned long EXT2FS_ATTR((unused)) old_size,
1627 unsigned long size, void *ptr)
1631 /* Use "memcpy" for pointer assignments here to avoid problems
1632 * with C99 strict type aliasing rules. */
1633 memcpy(&p, ptr, sizeof(p));
1634 p = realloc(p, size);
1636 return EXT2_ET_NO_MEMORY;
1637 memcpy(ptr, &p, sizeof(p));
1640 #endif /* Custom memory routines */
1643 * Mark a filesystem superblock as dirty
1645 _INLINE_ void ext2fs_mark_super_dirty(ext2_filsys fs)
1647 fs->flags |= EXT2_FLAG_DIRTY | EXT2_FLAG_CHANGED;
1651 * Mark a filesystem as changed
1653 _INLINE_ void ext2fs_mark_changed(ext2_filsys fs)
1655 fs->flags |= EXT2_FLAG_CHANGED;
1659 * Check to see if a filesystem has changed
1661 _INLINE_ int ext2fs_test_changed(ext2_filsys fs)
1663 return (fs->flags & EXT2_FLAG_CHANGED);
1667 * Mark a filesystem as valid
1669 _INLINE_ void ext2fs_mark_valid(ext2_filsys fs)
1671 fs->flags |= EXT2_FLAG_VALID;
1675 * Mark a filesystem as NOT valid
1677 _INLINE_ void ext2fs_unmark_valid(ext2_filsys fs)
1679 fs->flags &= ~EXT2_FLAG_VALID;
1683 * Check to see if a filesystem is valid
1685 _INLINE_ int ext2fs_test_valid(ext2_filsys fs)
1687 return (fs->flags & EXT2_FLAG_VALID);
1691 * Mark the inode bitmap as dirty
1693 _INLINE_ void ext2fs_mark_ib_dirty(ext2_filsys fs)
1695 fs->flags |= EXT2_FLAG_IB_DIRTY | EXT2_FLAG_CHANGED;
1699 * Mark the block bitmap as dirty
1701 _INLINE_ void ext2fs_mark_bb_dirty(ext2_filsys fs)
1703 fs->flags |= EXT2_FLAG_BB_DIRTY | EXT2_FLAG_CHANGED;
1707 * Check to see if a filesystem's inode bitmap is dirty
1709 _INLINE_ int ext2fs_test_ib_dirty(ext2_filsys fs)
1711 return (fs->flags & EXT2_FLAG_IB_DIRTY);
1715 * Check to see if a filesystem's block bitmap is dirty
1717 _INLINE_ int ext2fs_test_bb_dirty(ext2_filsys fs)
1719 return (fs->flags & EXT2_FLAG_BB_DIRTY);
1723 * Return the group # of a block
1725 _INLINE_ dgrp_t ext2fs_group_of_blk(ext2_filsys fs, blk_t blk)
1727 return ext2fs_group_of_blk2(fs, blk);
1730 * Return the group # of an inode number
1732 _INLINE_ dgrp_t ext2fs_group_of_ino(ext2_filsys fs, ext2_ino_t ino)
1734 return (ino - 1) / fs->super->s_inodes_per_group;
1738 * Return the first block (inclusive) in a group
1740 _INLINE_ blk_t ext2fs_group_first_block(ext2_filsys fs, dgrp_t group)
1742 return (blk_t) ext2fs_group_first_block2(fs, group);
1746 * Return the last block (inclusive) in a group
1748 _INLINE_ blk_t ext2fs_group_last_block(ext2_filsys fs, dgrp_t group)
1750 return (blk_t) ext2fs_group_last_block2(fs, group);
1753 _INLINE_ blk_t ext2fs_inode_data_blocks(ext2_filsys fs,
1754 struct ext2_inode *inode)
1756 return (blk_t) ext2fs_inode_data_blocks2(fs, inode);
1760 * This is an efficient, overflow safe way of calculating ceil((1.0 * a) / b)
1762 _INLINE_ unsigned int ext2fs_div_ceil(unsigned int a, unsigned int b)
1766 return ((a - 1) / b) + 1;
1769 _INLINE_ __u64 ext2fs_div64_ceil(__u64 a, __u64 b)
1773 return ((a - 1) / b) + 1;
1783 #endif /* _EXT2FS_EXT2FS_H */