Denis Vlasenko | c4f623e | 2006-12-26 01:30:59 +0000 | [diff] [blame] | 1 | /* vi: set sw=4 ts=4: */ |
| 2 | /* |
| 3 | * ext2fs.h --- ext2fs |
| 4 | * |
| 5 | * Copyright (C) 1993, 1994, 1995, 1996 Theodore Ts'o. |
| 6 | * |
| 7 | * %Begin-Header% |
| 8 | * This file may be redistributed under the terms of the GNU Public |
| 9 | * License. |
| 10 | * %End-Header% |
| 11 | */ |
| 12 | |
| 13 | #ifndef _EXT2FS_EXT2FS_H |
| 14 | #define _EXT2FS_EXT2FS_H |
| 15 | |
| 16 | |
| 17 | #define EXT2FS_ATTR(x) |
| 18 | |
| 19 | #ifdef __cplusplus |
| 20 | extern "C" { |
| 21 | #endif |
| 22 | |
| 23 | /* |
| 24 | * Where the master copy of the superblock is located, and how big |
| 25 | * superblocks are supposed to be. We define SUPERBLOCK_SIZE because |
| 26 | * the size of the superblock structure is not necessarily trustworthy |
| 27 | * (some versions have the padding set up so that the superblock is |
| 28 | * 1032 bytes long). |
| 29 | */ |
| 30 | #define SUPERBLOCK_OFFSET 1024 |
| 31 | #define SUPERBLOCK_SIZE 1024 |
| 32 | |
| 33 | /* |
| 34 | * The last ext2fs revision level that this version of the library is |
| 35 | * able to support. |
| 36 | */ |
| 37 | #define EXT2_LIB_CURRENT_REV EXT2_DYNAMIC_REV |
| 38 | |
| 39 | #ifdef HAVE_SYS_TYPES_H |
| 40 | #include <sys/types.h> |
| 41 | #endif |
| 42 | |
| 43 | #include <stdio.h> |
| 44 | #include <stdlib.h> |
| 45 | |
| 46 | #include "ext2_types.h" |
| 47 | #include "ext2_fs.h" |
| 48 | |
| 49 | typedef __u32 ext2_ino_t; |
| 50 | typedef __u32 blk_t; |
| 51 | typedef __u32 dgrp_t; |
| 52 | typedef __u32 ext2_off_t; |
| 53 | typedef __s64 e2_blkcnt_t; |
| 54 | typedef __u32 ext2_dirhash_t; |
| 55 | |
| 56 | #include "ext2_io.h" |
| 57 | #include "ext2_err.h" |
| 58 | |
| 59 | typedef struct struct_ext2_filsys *ext2_filsys; |
| 60 | |
| 61 | struct ext2fs_struct_generic_bitmap { |
| 62 | errcode_t magic; |
| 63 | ext2_filsys fs; |
| 64 | __u32 start, end; |
| 65 | __u32 real_end; |
| 66 | char * description; |
| 67 | char * bitmap; |
| 68 | errcode_t base_error_code; |
| 69 | __u32 reserved[7]; |
| 70 | }; |
| 71 | |
| 72 | #define EXT2FS_MARK_ERROR 0 |
| 73 | #define EXT2FS_UNMARK_ERROR 1 |
| 74 | #define EXT2FS_TEST_ERROR 2 |
| 75 | |
| 76 | typedef struct ext2fs_struct_generic_bitmap *ext2fs_generic_bitmap; |
| 77 | typedef struct ext2fs_struct_generic_bitmap *ext2fs_inode_bitmap; |
| 78 | typedef struct ext2fs_struct_generic_bitmap *ext2fs_block_bitmap; |
| 79 | |
| 80 | #define EXT2_FIRST_INODE(s) EXT2_FIRST_INO(s) |
| 81 | |
| 82 | /* |
| 83 | * badblocks list definitions |
| 84 | */ |
| 85 | |
| 86 | typedef struct ext2_struct_u32_list *ext2_badblocks_list; |
| 87 | typedef struct ext2_struct_u32_iterate *ext2_badblocks_iterate; |
| 88 | |
| 89 | typedef struct ext2_struct_u32_list *ext2_u32_list; |
| 90 | typedef struct ext2_struct_u32_iterate *ext2_u32_iterate; |
| 91 | |
| 92 | /* old */ |
| 93 | typedef struct ext2_struct_u32_list *badblocks_list; |
| 94 | typedef struct ext2_struct_u32_iterate *badblocks_iterate; |
| 95 | |
| 96 | #define BADBLOCKS_FLAG_DIRTY 1 |
| 97 | |
| 98 | /* |
| 99 | * ext2_dblist structure and abstractions (see dblist.c) |
| 100 | */ |
| 101 | struct ext2_db_entry { |
| 102 | ext2_ino_t ino; |
| 103 | blk_t blk; |
| 104 | int blockcnt; |
| 105 | }; |
| 106 | |
| 107 | typedef struct ext2_struct_dblist *ext2_dblist; |
| 108 | |
| 109 | #define DBLIST_ABORT 1 |
| 110 | |
| 111 | /* |
| 112 | * ext2_fileio definitions |
| 113 | */ |
| 114 | |
| 115 | #define EXT2_FILE_WRITE 0x0001 |
| 116 | #define EXT2_FILE_CREATE 0x0002 |
| 117 | |
| 118 | #define EXT2_FILE_MASK 0x00FF |
| 119 | |
| 120 | #define EXT2_FILE_BUF_DIRTY 0x4000 |
| 121 | #define EXT2_FILE_BUF_VALID 0x2000 |
| 122 | |
| 123 | typedef struct ext2_file *ext2_file_t; |
| 124 | |
| 125 | #define EXT2_SEEK_SET 0 |
| 126 | #define EXT2_SEEK_CUR 1 |
| 127 | #define EXT2_SEEK_END 2 |
| 128 | |
| 129 | /* |
| 130 | * Flags for the ext2_filsys structure and for ext2fs_open() |
| 131 | */ |
| 132 | #define EXT2_FLAG_RW 0x01 |
| 133 | #define EXT2_FLAG_CHANGED 0x02 |
| 134 | #define EXT2_FLAG_DIRTY 0x04 |
| 135 | #define EXT2_FLAG_VALID 0x08 |
| 136 | #define EXT2_FLAG_IB_DIRTY 0x10 |
| 137 | #define EXT2_FLAG_BB_DIRTY 0x20 |
| 138 | #define EXT2_FLAG_SWAP_BYTES 0x40 |
| 139 | #define EXT2_FLAG_SWAP_BYTES_READ 0x80 |
| 140 | #define EXT2_FLAG_SWAP_BYTES_WRITE 0x100 |
| 141 | #define EXT2_FLAG_MASTER_SB_ONLY 0x200 |
| 142 | #define EXT2_FLAG_FORCE 0x400 |
| 143 | #define EXT2_FLAG_SUPER_ONLY 0x800 |
| 144 | #define EXT2_FLAG_JOURNAL_DEV_OK 0x1000 |
| 145 | #define EXT2_FLAG_IMAGE_FILE 0x2000 |
| 146 | |
| 147 | /* |
| 148 | * Special flag in the ext2 inode i_flag field that means that this is |
| 149 | * a new inode. (So that ext2_write_inode() can clear extra fields.) |
| 150 | */ |
| 151 | #define EXT2_NEW_INODE_FL 0x80000000 |
| 152 | |
| 153 | /* |
| 154 | * Flags for mkjournal |
| 155 | * |
| 156 | * EXT2_MKJOURNAL_V1_SUPER Make a (deprecated) V1 journal superblock |
| 157 | */ |
| 158 | #define EXT2_MKJOURNAL_V1_SUPER 0x0000001 |
| 159 | |
| 160 | struct struct_ext2_filsys { |
| 161 | errcode_t magic; |
| 162 | io_channel io; |
| 163 | int flags; |
| 164 | char * device_name; |
| 165 | struct ext2_super_block * super; |
| 166 | unsigned int blocksize; |
| 167 | int fragsize; |
| 168 | dgrp_t group_desc_count; |
| 169 | unsigned long desc_blocks; |
| 170 | struct ext2_group_desc * group_desc; |
| 171 | int inode_blocks_per_group; |
| 172 | ext2fs_inode_bitmap inode_map; |
| 173 | ext2fs_block_bitmap block_map; |
| 174 | errcode_t (*get_blocks)(ext2_filsys fs, ext2_ino_t ino, blk_t *blocks); |
| 175 | errcode_t (*check_directory)(ext2_filsys fs, ext2_ino_t ino); |
| 176 | errcode_t (*write_bitmaps)(ext2_filsys fs); |
| 177 | errcode_t (*read_inode)(ext2_filsys fs, ext2_ino_t ino, |
| 178 | struct ext2_inode *inode); |
| 179 | errcode_t (*write_inode)(ext2_filsys fs, ext2_ino_t ino, |
| 180 | struct ext2_inode *inode); |
| 181 | ext2_badblocks_list badblocks; |
| 182 | ext2_dblist dblist; |
| 183 | __u32 stride; /* for mke2fs */ |
| 184 | struct ext2_super_block * orig_super; |
| 185 | struct ext2_image_hdr * image_header; |
| 186 | __u32 umask; |
| 187 | /* |
| 188 | * Reserved for future expansion |
| 189 | */ |
| 190 | __u32 reserved[8]; |
| 191 | |
| 192 | /* |
| 193 | * Reserved for the use of the calling application. |
| 194 | */ |
| 195 | void * priv_data; |
| 196 | |
| 197 | /* |
| 198 | * Inode cache |
| 199 | */ |
| 200 | struct ext2_inode_cache *icache; |
| 201 | io_channel image_io; |
| 202 | }; |
| 203 | |
| 204 | #include "bitops.h" |
| 205 | |
| 206 | /* |
| 207 | * Return flags for the block iterator functions |
| 208 | */ |
| 209 | #define BLOCK_CHANGED 1 |
| 210 | #define BLOCK_ABORT 2 |
| 211 | #define BLOCK_ERROR 4 |
| 212 | |
| 213 | /* |
| 214 | * Block interate flags |
| 215 | * |
| 216 | * BLOCK_FLAG_APPEND, or BLOCK_FLAG_HOLE, indicates that the interator |
| 217 | * function should be called on blocks where the block number is zero. |
| 218 | * This is used by ext2fs_expand_dir() to be able to add a new block |
| 219 | * to an inode. It can also be used for programs that want to be able |
| 220 | * to deal with files that contain "holes". |
| 221 | * |
| 222 | * BLOCK_FLAG_TRAVERSE indicates that the iterator function for the |
| 223 | * indirect, doubly indirect, etc. blocks should be called after all |
| 224 | * of the blocks containined in the indirect blocks are processed. |
| 225 | * This is useful if you are going to be deallocating blocks from an |
| 226 | * inode. |
| 227 | * |
| 228 | * BLOCK_FLAG_DATA_ONLY indicates that the iterator function should be |
| 229 | * called for data blocks only. |
| 230 | * |
| 231 | * BLOCK_FLAG_NO_LARGE is for internal use only. It informs |
| 232 | * ext2fs_block_iterate2 that large files won't be accepted. |
| 233 | */ |
| 234 | #define BLOCK_FLAG_APPEND 1 |
| 235 | #define BLOCK_FLAG_HOLE 1 |
| 236 | #define BLOCK_FLAG_DEPTH_TRAVERSE 2 |
| 237 | #define BLOCK_FLAG_DATA_ONLY 4 |
| 238 | |
| 239 | #define BLOCK_FLAG_NO_LARGE 0x1000 |
| 240 | |
| 241 | /* |
| 242 | * Magic "block count" return values for the block iterator function. |
| 243 | */ |
| 244 | #define BLOCK_COUNT_IND (-1) |
| 245 | #define BLOCK_COUNT_DIND (-2) |
| 246 | #define BLOCK_COUNT_TIND (-3) |
| 247 | #define BLOCK_COUNT_TRANSLATOR (-4) |
| 248 | |
| 249 | #if 0 |
| 250 | /* |
| 251 | * Flags for ext2fs_move_blocks |
| 252 | */ |
| 253 | #define EXT2_BMOVE_GET_DBLIST 0x0001 |
| 254 | #define EXT2_BMOVE_DEBUG 0x0002 |
| 255 | #endif |
| 256 | |
| 257 | /* |
| 258 | * Flags for directory block reading and writing functions |
| 259 | */ |
| 260 | #define EXT2_DIRBLOCK_V2_STRUCT 0x0001 |
| 261 | |
| 262 | /* |
| 263 | * Return flags for the directory iterator functions |
| 264 | */ |
| 265 | #define DIRENT_CHANGED 1 |
| 266 | #define DIRENT_ABORT 2 |
| 267 | #define DIRENT_ERROR 3 |
| 268 | |
| 269 | /* |
| 270 | * Directory iterator flags |
| 271 | */ |
| 272 | |
| 273 | #define DIRENT_FLAG_INCLUDE_EMPTY 1 |
| 274 | #define DIRENT_FLAG_INCLUDE_REMOVED 2 |
| 275 | |
| 276 | #define DIRENT_DOT_FILE 1 |
| 277 | #define DIRENT_DOT_DOT_FILE 2 |
| 278 | #define DIRENT_OTHER_FILE 3 |
| 279 | #define DIRENT_DELETED_FILE 4 |
| 280 | |
| 281 | /* |
| 282 | * Inode scan definitions |
| 283 | */ |
| 284 | typedef struct ext2_struct_inode_scan *ext2_inode_scan; |
| 285 | |
| 286 | /* |
| 287 | * ext2fs_scan flags |
| 288 | */ |
| 289 | #define EXT2_SF_CHK_BADBLOCKS 0x0001 |
| 290 | #define EXT2_SF_BAD_INODE_BLK 0x0002 |
| 291 | #define EXT2_SF_BAD_EXTRA_BYTES 0x0004 |
| 292 | #define EXT2_SF_SKIP_MISSING_ITABLE 0x0008 |
| 293 | |
| 294 | /* |
| 295 | * ext2fs_check_if_mounted flags |
| 296 | */ |
| 297 | #define EXT2_MF_MOUNTED 1 |
| 298 | #define EXT2_MF_ISROOT 2 |
| 299 | #define EXT2_MF_READONLY 4 |
| 300 | #define EXT2_MF_SWAP 8 |
| 301 | #define EXT2_MF_BUSY 16 |
| 302 | |
| 303 | /* |
| 304 | * Ext2/linux mode flags. We define them here so that we don't need |
| 305 | * to depend on the OS's sys/stat.h, since we may be compiling on a |
| 306 | * non-Linux system. |
| 307 | */ |
| 308 | #define LINUX_S_IFMT 00170000 |
| 309 | #define LINUX_S_IFSOCK 0140000 |
| 310 | #define LINUX_S_IFLNK 0120000 |
| 311 | #define LINUX_S_IFREG 0100000 |
| 312 | #define LINUX_S_IFBLK 0060000 |
| 313 | #define LINUX_S_IFDIR 0040000 |
| 314 | #define LINUX_S_IFCHR 0020000 |
| 315 | #define LINUX_S_IFIFO 0010000 |
| 316 | #define LINUX_S_ISUID 0004000 |
| 317 | #define LINUX_S_ISGID 0002000 |
| 318 | #define LINUX_S_ISVTX 0001000 |
| 319 | |
| 320 | #define LINUX_S_IRWXU 00700 |
| 321 | #define LINUX_S_IRUSR 00400 |
| 322 | #define LINUX_S_IWUSR 00200 |
| 323 | #define LINUX_S_IXUSR 00100 |
| 324 | |
| 325 | #define LINUX_S_IRWXG 00070 |
| 326 | #define LINUX_S_IRGRP 00040 |
| 327 | #define LINUX_S_IWGRP 00020 |
| 328 | #define LINUX_S_IXGRP 00010 |
| 329 | |
| 330 | #define LINUX_S_IRWXO 00007 |
| 331 | #define LINUX_S_IROTH 00004 |
| 332 | #define LINUX_S_IWOTH 00002 |
| 333 | #define LINUX_S_IXOTH 00001 |
| 334 | |
| 335 | #define LINUX_S_ISLNK(m) (((m) & LINUX_S_IFMT) == LINUX_S_IFLNK) |
| 336 | #define LINUX_S_ISREG(m) (((m) & LINUX_S_IFMT) == LINUX_S_IFREG) |
| 337 | #define LINUX_S_ISDIR(m) (((m) & LINUX_S_IFMT) == LINUX_S_IFDIR) |
| 338 | #define LINUX_S_ISCHR(m) (((m) & LINUX_S_IFMT) == LINUX_S_IFCHR) |
| 339 | #define LINUX_S_ISBLK(m) (((m) & LINUX_S_IFMT) == LINUX_S_IFBLK) |
| 340 | #define LINUX_S_ISFIFO(m) (((m) & LINUX_S_IFMT) == LINUX_S_IFIFO) |
| 341 | #define LINUX_S_ISSOCK(m) (((m) & LINUX_S_IFMT) == LINUX_S_IFSOCK) |
| 342 | |
| 343 | /* |
| 344 | * ext2 size of an inode |
| 345 | */ |
| 346 | #define EXT2_I_SIZE(i) ((i)->i_size | ((__u64) (i)->i_size_high << 32)) |
| 347 | |
| 348 | /* |
| 349 | * ext2_icount_t abstraction |
| 350 | */ |
| 351 | #define EXT2_ICOUNT_OPT_INCREMENT 0x01 |
| 352 | |
| 353 | typedef struct ext2_icount *ext2_icount_t; |
| 354 | |
| 355 | /* |
| 356 | * Flags for ext2fs_bmap |
| 357 | */ |
| 358 | #define BMAP_ALLOC 0x0001 |
| 359 | #define BMAP_SET 0x0002 |
| 360 | |
| 361 | /* |
| 362 | * Flags for imager.c functions |
| 363 | */ |
| 364 | #define IMAGER_FLAG_INODEMAP 1 |
| 365 | #define IMAGER_FLAG_SPARSEWRITE 2 |
| 366 | |
| 367 | /* |
| 368 | * For checking structure magic numbers... |
| 369 | */ |
| 370 | |
| 371 | #define EXT2_CHECK_MAGIC(struct, code) \ |
| 372 | if ((struct)->magic != (code)) return (code) |
| 373 | |
| 374 | |
| 375 | /* |
| 376 | * For ext2 compression support |
| 377 | */ |
| 378 | #define EXT2FS_COMPRESSED_BLKADDR ((blk_t) 0xffffffff) |
| 379 | #define HOLE_BLKADDR(_b) ((_b) == 0 || (_b) == EXT2FS_COMPRESSED_BLKADDR) |
| 380 | |
| 381 | /* |
| 382 | * Features supported by this version of the library |
| 383 | */ |
| 384 | #define EXT2_LIB_FEATURE_COMPAT_SUPP (EXT2_FEATURE_COMPAT_DIR_PREALLOC|\ |
| 385 | EXT2_FEATURE_COMPAT_IMAGIC_INODES|\ |
| 386 | EXT3_FEATURE_COMPAT_HAS_JOURNAL|\ |
| 387 | EXT2_FEATURE_COMPAT_RESIZE_INODE|\ |
| 388 | EXT2_FEATURE_COMPAT_DIR_INDEX|\ |
| 389 | EXT2_FEATURE_COMPAT_EXT_ATTR) |
| 390 | |
| 391 | /* This #ifdef is temporary until compression is fully supported */ |
| 392 | #ifdef ENABLE_COMPRESSION |
| 393 | #ifndef I_KNOW_THAT_COMPRESSION_IS_EXPERIMENTAL |
| 394 | /* If the below warning bugs you, then have |
| 395 | `CPPFLAGS=-DI_KNOW_THAT_COMPRESSION_IS_EXPERIMENTAL' in your |
| 396 | environment at configure time. */ |
| 397 | #warning "Compression support is experimental" |
| 398 | #endif |
| 399 | #define EXT2_LIB_FEATURE_INCOMPAT_SUPP (EXT2_FEATURE_INCOMPAT_FILETYPE|\ |
| 400 | EXT2_FEATURE_INCOMPAT_COMPRESSION|\ |
| 401 | EXT3_FEATURE_INCOMPAT_JOURNAL_DEV|\ |
| 402 | EXT2_FEATURE_INCOMPAT_META_BG|\ |
| 403 | EXT3_FEATURE_INCOMPAT_RECOVER) |
| 404 | #else |
| 405 | #define EXT2_LIB_FEATURE_INCOMPAT_SUPP (EXT2_FEATURE_INCOMPAT_FILETYPE|\ |
| 406 | EXT3_FEATURE_INCOMPAT_JOURNAL_DEV|\ |
| 407 | EXT2_FEATURE_INCOMPAT_META_BG|\ |
| 408 | EXT3_FEATURE_INCOMPAT_RECOVER) |
| 409 | #endif |
| 410 | #define EXT2_LIB_FEATURE_RO_COMPAT_SUPP (EXT2_FEATURE_RO_COMPAT_SPARSE_SUPER|\ |
| 411 | EXT2_FEATURE_RO_COMPAT_LARGE_FILE) |
| 412 | /* |
| 413 | * function prototypes |
| 414 | */ |
| 415 | |
| 416 | /* alloc.c */ |
| 417 | extern errcode_t ext2fs_new_inode(ext2_filsys fs, ext2_ino_t dir, int mode, |
| 418 | ext2fs_inode_bitmap map, ext2_ino_t *ret); |
| 419 | extern errcode_t ext2fs_new_block(ext2_filsys fs, blk_t goal, |
| 420 | ext2fs_block_bitmap map, blk_t *ret); |
| 421 | extern errcode_t ext2fs_get_free_blocks(ext2_filsys fs, blk_t start, |
| 422 | blk_t finish, int num, |
| 423 | ext2fs_block_bitmap map, |
| 424 | blk_t *ret); |
| 425 | extern errcode_t ext2fs_alloc_block(ext2_filsys fs, blk_t goal, |
| 426 | char *block_buf, blk_t *ret); |
| 427 | |
| 428 | /* alloc_sb.c */ |
| 429 | extern int ext2fs_reserve_super_and_bgd(ext2_filsys fs, |
| 430 | dgrp_t group, |
| 431 | ext2fs_block_bitmap bmap); |
| 432 | |
| 433 | /* alloc_stats.c */ |
| 434 | void ext2fs_inode_alloc_stats(ext2_filsys fs, ext2_ino_t ino, int inuse); |
| 435 | void ext2fs_inode_alloc_stats2(ext2_filsys fs, ext2_ino_t ino, |
| 436 | int inuse, int isdir); |
| 437 | void ext2fs_block_alloc_stats(ext2_filsys fs, blk_t blk, int inuse); |
| 438 | |
| 439 | /* alloc_tables.c */ |
| 440 | extern errcode_t ext2fs_allocate_tables(ext2_filsys fs); |
| 441 | extern errcode_t ext2fs_allocate_group_table(ext2_filsys fs, dgrp_t group, |
| 442 | ext2fs_block_bitmap bmap); |
| 443 | |
| 444 | /* badblocks.c */ |
| 445 | extern errcode_t ext2fs_u32_list_create(ext2_u32_list *ret, int size); |
| 446 | extern errcode_t ext2fs_u32_list_add(ext2_u32_list bb, __u32 blk); |
| 447 | extern int ext2fs_u32_list_find(ext2_u32_list bb, __u32 blk); |
| 448 | extern int ext2fs_u32_list_test(ext2_u32_list bb, blk_t blk); |
| 449 | extern errcode_t ext2fs_u32_list_iterate_begin(ext2_u32_list bb, |
| 450 | ext2_u32_iterate *ret); |
| 451 | extern int ext2fs_u32_list_iterate(ext2_u32_iterate iter, blk_t *blk); |
| 452 | extern void ext2fs_u32_list_iterate_end(ext2_u32_iterate iter); |
| 453 | extern errcode_t ext2fs_u32_copy(ext2_u32_list src, ext2_u32_list *dest); |
| 454 | extern int ext2fs_u32_list_equal(ext2_u32_list bb1, ext2_u32_list bb2); |
| 455 | |
| 456 | extern errcode_t ext2fs_badblocks_list_create(ext2_badblocks_list *ret, |
| 457 | int size); |
| 458 | extern errcode_t ext2fs_badblocks_list_add(ext2_badblocks_list bb, |
| 459 | blk_t blk); |
| 460 | extern int ext2fs_badblocks_list_test(ext2_badblocks_list bb, |
| 461 | blk_t blk); |
| 462 | extern int ext2fs_u32_list_del(ext2_u32_list bb, __u32 blk); |
| 463 | extern void ext2fs_badblocks_list_del(ext2_u32_list bb, __u32 blk); |
| 464 | extern errcode_t |
| 465 | ext2fs_badblocks_list_iterate_begin(ext2_badblocks_list bb, |
| 466 | ext2_badblocks_iterate *ret); |
| 467 | extern int ext2fs_badblocks_list_iterate(ext2_badblocks_iterate iter, |
| 468 | blk_t *blk); |
| 469 | extern void ext2fs_badblocks_list_iterate_end(ext2_badblocks_iterate iter); |
| 470 | extern errcode_t ext2fs_badblocks_copy(ext2_badblocks_list src, |
| 471 | ext2_badblocks_list *dest); |
| 472 | extern int ext2fs_badblocks_equal(ext2_badblocks_list bb1, |
| 473 | ext2_badblocks_list bb2); |
| 474 | extern int ext2fs_u32_list_count(ext2_u32_list bb); |
| 475 | |
| 476 | /* bb_compat */ |
| 477 | extern errcode_t badblocks_list_create(badblocks_list *ret, int size); |
| 478 | extern errcode_t badblocks_list_add(badblocks_list bb, blk_t blk); |
| 479 | extern int badblocks_list_test(badblocks_list bb, blk_t blk); |
| 480 | extern errcode_t badblocks_list_iterate_begin(badblocks_list bb, |
| 481 | badblocks_iterate *ret); |
| 482 | extern int badblocks_list_iterate(badblocks_iterate iter, blk_t *blk); |
| 483 | extern void badblocks_list_iterate_end(badblocks_iterate iter); |
| 484 | extern void badblocks_list_free(badblocks_list bb); |
| 485 | |
| 486 | /* bb_inode.c */ |
| 487 | extern errcode_t ext2fs_update_bb_inode(ext2_filsys fs, |
| 488 | ext2_badblocks_list bb_list); |
| 489 | |
| 490 | /* bitmaps.c */ |
| 491 | extern errcode_t ext2fs_write_inode_bitmap(ext2_filsys fs); |
| 492 | extern errcode_t ext2fs_write_block_bitmap (ext2_filsys fs); |
| 493 | extern errcode_t ext2fs_read_inode_bitmap (ext2_filsys fs); |
| 494 | extern errcode_t ext2fs_read_block_bitmap(ext2_filsys fs); |
| 495 | extern errcode_t ext2fs_allocate_generic_bitmap(__u32 start, |
| 496 | __u32 end, |
| 497 | __u32 real_end, |
| 498 | const char *descr, |
| 499 | ext2fs_generic_bitmap *ret); |
| 500 | extern errcode_t ext2fs_allocate_block_bitmap(ext2_filsys fs, |
| 501 | const char *descr, |
| 502 | ext2fs_block_bitmap *ret); |
| 503 | extern errcode_t ext2fs_allocate_inode_bitmap(ext2_filsys fs, |
| 504 | const char *descr, |
| 505 | ext2fs_inode_bitmap *ret); |
| 506 | extern errcode_t ext2fs_fudge_inode_bitmap_end(ext2fs_inode_bitmap bitmap, |
| 507 | ext2_ino_t end, ext2_ino_t *oend); |
| 508 | extern errcode_t ext2fs_fudge_block_bitmap_end(ext2fs_block_bitmap bitmap, |
| 509 | blk_t end, blk_t *oend); |
| 510 | extern void ext2fs_clear_inode_bitmap(ext2fs_inode_bitmap bitmap); |
| 511 | extern void ext2fs_clear_block_bitmap(ext2fs_block_bitmap bitmap); |
| 512 | extern errcode_t ext2fs_read_bitmaps(ext2_filsys fs); |
| 513 | extern errcode_t ext2fs_write_bitmaps(ext2_filsys fs); |
| 514 | |
| 515 | /* block.c */ |
| 516 | extern errcode_t ext2fs_block_iterate(ext2_filsys fs, |
| 517 | ext2_ino_t ino, |
| 518 | int flags, |
| 519 | char *block_buf, |
| 520 | int (*func)(ext2_filsys fs, |
| 521 | blk_t *blocknr, |
| 522 | int blockcnt, |
| 523 | void *priv_data), |
| 524 | void *priv_data); |
| 525 | errcode_t ext2fs_block_iterate2(ext2_filsys fs, |
| 526 | ext2_ino_t ino, |
| 527 | int flags, |
| 528 | char *block_buf, |
| 529 | int (*func)(ext2_filsys fs, |
| 530 | blk_t *blocknr, |
| 531 | e2_blkcnt_t blockcnt, |
| 532 | blk_t ref_blk, |
| 533 | int ref_offset, |
| 534 | void *priv_data), |
| 535 | void *priv_data); |
| 536 | |
| 537 | /* bmap.c */ |
| 538 | extern errcode_t ext2fs_bmap(ext2_filsys fs, ext2_ino_t ino, |
| 539 | struct ext2_inode *inode, |
| 540 | char *block_buf, int bmap_flags, |
| 541 | blk_t block, blk_t *phys_blk); |
| 542 | |
| 543 | |
| 544 | #if 0 |
| 545 | /* bmove.c */ |
| 546 | extern errcode_t ext2fs_move_blocks(ext2_filsys fs, |
| 547 | ext2fs_block_bitmap reserve, |
| 548 | ext2fs_block_bitmap alloc_map, |
| 549 | int flags); |
| 550 | #endif |
| 551 | |
| 552 | /* check_desc.c */ |
| 553 | extern errcode_t ext2fs_check_desc(ext2_filsys fs); |
| 554 | |
| 555 | /* closefs.c */ |
| 556 | extern errcode_t ext2fs_close(ext2_filsys fs); |
| 557 | extern errcode_t ext2fs_flush(ext2_filsys fs); |
| 558 | extern int ext2fs_bg_has_super(ext2_filsys fs, int group_block); |
| 559 | extern int ext2fs_super_and_bgd_loc(ext2_filsys fs, |
| 560 | dgrp_t group, |
| 561 | blk_t *ret_super_blk, |
| 562 | blk_t *ret_old_desc_blk, |
| 563 | blk_t *ret_new_desc_blk, |
| 564 | int *ret_meta_bg); |
| 565 | extern void ext2fs_update_dynamic_rev(ext2_filsys fs); |
| 566 | |
| 567 | /* cmp_bitmaps.c */ |
| 568 | extern errcode_t ext2fs_compare_block_bitmap(ext2fs_block_bitmap bm1, |
| 569 | ext2fs_block_bitmap bm2); |
| 570 | extern errcode_t ext2fs_compare_inode_bitmap(ext2fs_inode_bitmap bm1, |
| 571 | ext2fs_inode_bitmap bm2); |
| 572 | |
| 573 | /* dblist.c */ |
| 574 | |
| 575 | extern errcode_t ext2fs_get_num_dirs(ext2_filsys fs, ext2_ino_t *ret_num_dirs); |
| 576 | extern errcode_t ext2fs_init_dblist(ext2_filsys fs, ext2_dblist *ret_dblist); |
| 577 | extern errcode_t ext2fs_add_dir_block(ext2_dblist dblist, ext2_ino_t ino, |
| 578 | blk_t blk, int blockcnt); |
| 579 | extern void ext2fs_dblist_sort(ext2_dblist dblist, |
| 580 | int (*sortfunc)(const void *, |
| 581 | const void *)); |
| 582 | extern errcode_t ext2fs_dblist_iterate(ext2_dblist dblist, |
| 583 | int (*func)(ext2_filsys fs, struct ext2_db_entry *db_info, |
| 584 | void *priv_data), |
| 585 | void *priv_data); |
| 586 | extern errcode_t ext2fs_set_dir_block(ext2_dblist dblist, ext2_ino_t ino, |
| 587 | blk_t blk, int blockcnt); |
| 588 | extern errcode_t ext2fs_copy_dblist(ext2_dblist src, |
| 589 | ext2_dblist *dest); |
| 590 | extern int ext2fs_dblist_count(ext2_dblist dblist); |
| 591 | |
| 592 | /* dblist_dir.c */ |
| 593 | extern errcode_t |
| 594 | ext2fs_dblist_dir_iterate(ext2_dblist dblist, |
| 595 | int flags, |
| 596 | char *block_buf, |
| 597 | int (*func)(ext2_ino_t dir, |
| 598 | int entry, |
| 599 | struct ext2_dir_entry *dirent, |
| 600 | int offset, |
| 601 | int blocksize, |
| 602 | char *buf, |
| 603 | void *priv_data), |
| 604 | void *priv_data); |
| 605 | |
| 606 | /* dirblock.c */ |
| 607 | extern errcode_t ext2fs_read_dir_block(ext2_filsys fs, blk_t block, |
| 608 | void *buf); |
| 609 | extern errcode_t ext2fs_read_dir_block2(ext2_filsys fs, blk_t block, |
| 610 | void *buf, int flags); |
| 611 | extern errcode_t ext2fs_write_dir_block(ext2_filsys fs, blk_t block, |
| 612 | void *buf); |
| 613 | extern errcode_t ext2fs_write_dir_block2(ext2_filsys fs, blk_t block, |
| 614 | void *buf, int flags); |
| 615 | |
| 616 | /* dirhash.c */ |
| 617 | extern errcode_t ext2fs_dirhash(int version, const char *name, int len, |
| 618 | const __u32 *seed, |
| 619 | ext2_dirhash_t *ret_hash, |
| 620 | ext2_dirhash_t *ret_minor_hash); |
| 621 | |
| 622 | |
| 623 | /* dir_iterate.c */ |
| 624 | extern errcode_t ext2fs_dir_iterate(ext2_filsys fs, |
| 625 | ext2_ino_t dir, |
| 626 | int flags, |
| 627 | char *block_buf, |
| 628 | int (*func)(struct ext2_dir_entry *dirent, |
| 629 | int offset, |
| 630 | int blocksize, |
| 631 | char *buf, |
| 632 | void *priv_data), |
| 633 | void *priv_data); |
| 634 | extern errcode_t ext2fs_dir_iterate2(ext2_filsys fs, |
| 635 | ext2_ino_t dir, |
| 636 | int flags, |
| 637 | char *block_buf, |
| 638 | int (*func)(ext2_ino_t dir, |
| 639 | int entry, |
| 640 | struct ext2_dir_entry *dirent, |
| 641 | int offset, |
| 642 | int blocksize, |
| 643 | char *buf, |
| 644 | void *priv_data), |
| 645 | void *priv_data); |
| 646 | |
| 647 | /* dupfs.c */ |
| 648 | extern errcode_t ext2fs_dup_handle(ext2_filsys src, ext2_filsys *dest); |
| 649 | |
| 650 | /* expanddir.c */ |
| 651 | extern errcode_t ext2fs_expand_dir(ext2_filsys fs, ext2_ino_t dir); |
| 652 | |
| 653 | /* ext_attr.c */ |
| 654 | extern errcode_t ext2fs_read_ext_attr(ext2_filsys fs, blk_t block, void *buf); |
| 655 | extern errcode_t ext2fs_write_ext_attr(ext2_filsys fs, blk_t block, |
| 656 | void *buf); |
| 657 | extern errcode_t ext2fs_adjust_ea_refcount(ext2_filsys fs, blk_t blk, |
| 658 | char *block_buf, |
| 659 | int adjust, __u32 *newcount); |
| 660 | |
| 661 | /* fileio.c */ |
| 662 | extern errcode_t ext2fs_file_open2(ext2_filsys fs, ext2_ino_t ino, |
| 663 | struct ext2_inode *inode, |
| 664 | int flags, ext2_file_t *ret); |
| 665 | extern errcode_t ext2fs_file_open(ext2_filsys fs, ext2_ino_t ino, |
| 666 | int flags, ext2_file_t *ret); |
| 667 | extern ext2_filsys ext2fs_file_get_fs(ext2_file_t file); |
| 668 | extern errcode_t ext2fs_file_close(ext2_file_t file); |
| 669 | extern errcode_t ext2fs_file_flush(ext2_file_t file); |
| 670 | extern errcode_t ext2fs_file_read(ext2_file_t file, void *buf, |
| 671 | unsigned int wanted, unsigned int *got); |
| 672 | extern errcode_t ext2fs_file_write(ext2_file_t file, const void *buf, |
| 673 | unsigned int nbytes, unsigned int *written); |
| 674 | extern errcode_t ext2fs_file_llseek(ext2_file_t file, __u64 offset, |
| 675 | int whence, __u64 *ret_pos); |
| 676 | extern errcode_t ext2fs_file_lseek(ext2_file_t file, ext2_off_t offset, |
| 677 | int whence, ext2_off_t *ret_pos); |
| 678 | errcode_t ext2fs_file_get_lsize(ext2_file_t file, __u64 *ret_size); |
| 679 | extern ext2_off_t ext2fs_file_get_size(ext2_file_t file); |
| 680 | extern errcode_t ext2fs_file_set_size(ext2_file_t file, ext2_off_t size); |
| 681 | |
| 682 | /* finddev.c */ |
| 683 | extern char *ext2fs_find_block_device(dev_t device); |
| 684 | |
| 685 | /* flushb.c */ |
| 686 | extern errcode_t ext2fs_sync_device(int fd, int flushb); |
| 687 | |
| 688 | /* freefs.c */ |
| 689 | extern void ext2fs_free(ext2_filsys fs); |
| 690 | extern void ext2fs_free_generic_bitmap(ext2fs_inode_bitmap bitmap); |
| 691 | extern void ext2fs_free_block_bitmap(ext2fs_block_bitmap bitmap); |
| 692 | extern void ext2fs_free_inode_bitmap(ext2fs_inode_bitmap bitmap); |
| 693 | extern void ext2fs_free_dblist(ext2_dblist dblist); |
| 694 | extern void ext2fs_badblocks_list_free(ext2_badblocks_list bb); |
| 695 | extern void ext2fs_u32_list_free(ext2_u32_list bb); |
| 696 | |
| 697 | /* getsize.c */ |
| 698 | extern errcode_t ext2fs_get_device_size(const char *file, int blocksize, |
| 699 | blk_t *retblocks); |
| 700 | |
| 701 | /* getsectsize.c */ |
| 702 | errcode_t ext2fs_get_device_sectsize(const char *file, int *sectsize); |
| 703 | |
| 704 | /* imager.c */ |
| 705 | extern errcode_t ext2fs_image_inode_write(ext2_filsys fs, int fd, int flags); |
| 706 | extern errcode_t ext2fs_image_inode_read(ext2_filsys fs, int fd, int flags); |
| 707 | extern errcode_t ext2fs_image_super_write(ext2_filsys fs, int fd, int flags); |
| 708 | extern errcode_t ext2fs_image_super_read(ext2_filsys fs, int fd, int flags); |
| 709 | extern errcode_t ext2fs_image_bitmap_write(ext2_filsys fs, int fd, int flags); |
| 710 | extern errcode_t ext2fs_image_bitmap_read(ext2_filsys fs, int fd, int flags); |
| 711 | |
| 712 | /* ind_block.c */ |
| 713 | errcode_t ext2fs_read_ind_block(ext2_filsys fs, blk_t blk, void *buf); |
| 714 | errcode_t ext2fs_write_ind_block(ext2_filsys fs, blk_t blk, void *buf); |
| 715 | |
| 716 | /* initialize.c */ |
| 717 | extern errcode_t ext2fs_initialize(const char *name, int flags, |
| 718 | struct ext2_super_block *param, |
| 719 | io_manager manager, ext2_filsys *ret_fs); |
| 720 | |
| 721 | /* icount.c */ |
| 722 | extern void ext2fs_free_icount(ext2_icount_t icount); |
| 723 | extern errcode_t ext2fs_create_icount2(ext2_filsys fs, int flags, |
| 724 | unsigned int size, |
| 725 | ext2_icount_t hint, ext2_icount_t *ret); |
| 726 | extern errcode_t ext2fs_create_icount(ext2_filsys fs, int flags, |
| 727 | unsigned int size, |
| 728 | ext2_icount_t *ret); |
| 729 | extern errcode_t ext2fs_icount_fetch(ext2_icount_t icount, ext2_ino_t ino, |
| 730 | __u16 *ret); |
| 731 | extern errcode_t ext2fs_icount_increment(ext2_icount_t icount, ext2_ino_t ino, |
| 732 | __u16 *ret); |
| 733 | extern errcode_t ext2fs_icount_decrement(ext2_icount_t icount, ext2_ino_t ino, |
| 734 | __u16 *ret); |
| 735 | extern errcode_t ext2fs_icount_store(ext2_icount_t icount, ext2_ino_t ino, |
| 736 | __u16 count); |
| 737 | extern ext2_ino_t ext2fs_get_icount_size(ext2_icount_t icount); |
| 738 | errcode_t ext2fs_icount_validate(ext2_icount_t icount, FILE *); |
| 739 | |
| 740 | /* inode.c */ |
| 741 | extern errcode_t ext2fs_flush_icache(ext2_filsys fs); |
| 742 | extern errcode_t ext2fs_get_next_inode_full(ext2_inode_scan scan, |
| 743 | ext2_ino_t *ino, |
| 744 | struct ext2_inode *inode, |
| 745 | int bufsize); |
| 746 | extern errcode_t ext2fs_open_inode_scan(ext2_filsys fs, int buffer_blocks, |
| 747 | ext2_inode_scan *ret_scan); |
| 748 | extern void ext2fs_close_inode_scan(ext2_inode_scan scan); |
| 749 | extern errcode_t ext2fs_get_next_inode(ext2_inode_scan scan, ext2_ino_t *ino, |
| 750 | struct ext2_inode *inode); |
| 751 | extern errcode_t ext2fs_inode_scan_goto_blockgroup(ext2_inode_scan scan, |
| 752 | int group); |
| 753 | extern void ext2fs_set_inode_callback |
| 754 | (ext2_inode_scan scan, |
| 755 | errcode_t (*done_group)(ext2_filsys fs, |
| 756 | dgrp_t group, |
| 757 | void * priv_data), |
| 758 | void *done_group_data); |
| 759 | extern int ext2fs_inode_scan_flags(ext2_inode_scan scan, int set_flags, |
| 760 | int clear_flags); |
| 761 | extern errcode_t ext2fs_read_inode_full(ext2_filsys fs, ext2_ino_t ino, |
| 762 | struct ext2_inode * inode, |
| 763 | int bufsize); |
| 764 | extern errcode_t ext2fs_read_inode (ext2_filsys fs, ext2_ino_t ino, |
| 765 | struct ext2_inode * inode); |
| 766 | extern errcode_t ext2fs_write_inode_full(ext2_filsys fs, ext2_ino_t ino, |
| 767 | struct ext2_inode * inode, |
| 768 | int bufsize); |
| 769 | extern errcode_t ext2fs_write_inode(ext2_filsys fs, ext2_ino_t ino, |
| 770 | struct ext2_inode * inode); |
| 771 | extern errcode_t ext2fs_write_new_inode(ext2_filsys fs, ext2_ino_t ino, |
| 772 | struct ext2_inode * inode); |
| 773 | extern errcode_t ext2fs_get_blocks(ext2_filsys fs, ext2_ino_t ino, blk_t *blocks); |
| 774 | extern errcode_t ext2fs_check_directory(ext2_filsys fs, ext2_ino_t ino); |
| 775 | |
| 776 | /* inode_io.c */ |
| 777 | extern io_manager inode_io_manager; |
| 778 | extern errcode_t ext2fs_inode_io_intern(ext2_filsys fs, ext2_ino_t ino, |
| 779 | char **name); |
| 780 | extern errcode_t ext2fs_inode_io_intern2(ext2_filsys fs, ext2_ino_t ino, |
| 781 | struct ext2_inode *inode, |
| 782 | char **name); |
| 783 | |
| 784 | /* ismounted.c */ |
| 785 | extern errcode_t ext2fs_check_if_mounted(const char *file, int *mount_flags); |
| 786 | extern errcode_t ext2fs_check_mount_point(const char *device, int *mount_flags, |
| 787 | char *mtpt, int mtlen); |
| 788 | |
| 789 | /* namei.c */ |
| 790 | extern errcode_t ext2fs_lookup(ext2_filsys fs, ext2_ino_t dir, const char *name, |
| 791 | int namelen, char *buf, ext2_ino_t *inode); |
| 792 | extern errcode_t ext2fs_namei(ext2_filsys fs, ext2_ino_t root, ext2_ino_t cwd, |
| 793 | const char *name, ext2_ino_t *inode); |
| 794 | errcode_t ext2fs_namei_follow(ext2_filsys fs, ext2_ino_t root, ext2_ino_t cwd, |
| 795 | const char *name, ext2_ino_t *inode); |
| 796 | extern errcode_t ext2fs_follow_link(ext2_filsys fs, ext2_ino_t root, ext2_ino_t cwd, |
| 797 | ext2_ino_t inode, ext2_ino_t *res_inode); |
| 798 | |
| 799 | /* native.c */ |
| 800 | int ext2fs_native_flag(void); |
| 801 | |
| 802 | /* newdir.c */ |
| 803 | extern errcode_t ext2fs_new_dir_block(ext2_filsys fs, ext2_ino_t dir_ino, |
| 804 | ext2_ino_t parent_ino, char **block); |
| 805 | |
| 806 | /* mkdir.c */ |
| 807 | extern errcode_t ext2fs_mkdir(ext2_filsys fs, ext2_ino_t parent, ext2_ino_t inum, |
| 808 | const char *name); |
| 809 | |
| 810 | /* mkjournal.c */ |
| 811 | extern errcode_t ext2fs_create_journal_superblock(ext2_filsys fs, |
| 812 | __u32 size, int flags, |
| 813 | char **ret_jsb); |
| 814 | extern errcode_t ext2fs_add_journal_device(ext2_filsys fs, |
| 815 | ext2_filsys journal_dev); |
| 816 | extern errcode_t ext2fs_add_journal_inode(ext2_filsys fs, blk_t size, |
| 817 | int flags); |
| 818 | |
| 819 | /* openfs.c */ |
| 820 | extern errcode_t ext2fs_open(const char *name, int flags, int superblock, |
| 821 | unsigned int block_size, io_manager manager, |
| 822 | ext2_filsys *ret_fs); |
| 823 | extern errcode_t ext2fs_open2(const char *name, const char *io_options, |
| 824 | int flags, int superblock, |
| 825 | unsigned int block_size, io_manager manager, |
| 826 | ext2_filsys *ret_fs); |
| 827 | extern blk_t ext2fs_descriptor_block_loc(ext2_filsys fs, blk_t group_block, |
| 828 | dgrp_t i); |
| 829 | errcode_t ext2fs_get_data_io(ext2_filsys fs, io_channel *old_io); |
| 830 | errcode_t ext2fs_set_data_io(ext2_filsys fs, io_channel new_io); |
| 831 | errcode_t ext2fs_rewrite_to_io(ext2_filsys fs, io_channel new_io); |
| 832 | |
| 833 | /* get_pathname.c */ |
| 834 | extern errcode_t ext2fs_get_pathname(ext2_filsys fs, ext2_ino_t dir, ext2_ino_t ino, |
| 835 | char **name); |
| 836 | |
| 837 | /* link.c */ |
| 838 | errcode_t ext2fs_link(ext2_filsys fs, ext2_ino_t dir, const char *name, |
| 839 | ext2_ino_t ino, int flags); |
| 840 | errcode_t ext2fs_unlink(ext2_filsys fs, ext2_ino_t dir, const char *name, |
| 841 | ext2_ino_t ino, int flags); |
| 842 | |
| 843 | /* read_bb.c */ |
| 844 | extern errcode_t ext2fs_read_bb_inode(ext2_filsys fs, |
| 845 | ext2_badblocks_list *bb_list); |
| 846 | |
| 847 | /* read_bb_file.c */ |
| 848 | extern errcode_t ext2fs_read_bb_FILE2(ext2_filsys fs, FILE *f, |
| 849 | ext2_badblocks_list *bb_list, |
| 850 | void *priv_data, |
| 851 | void (*invalid)(ext2_filsys fs, |
| 852 | blk_t blk, |
| 853 | char *badstr, |
| 854 | void *priv_data)); |
| 855 | extern errcode_t ext2fs_read_bb_FILE(ext2_filsys fs, FILE *f, |
| 856 | ext2_badblocks_list *bb_list, |
| 857 | void (*invalid)(ext2_filsys fs, |
| 858 | blk_t blk)); |
| 859 | |
| 860 | /* res_gdt.c */ |
| 861 | extern errcode_t ext2fs_create_resize_inode(ext2_filsys fs); |
| 862 | |
| 863 | /* rs_bitmap.c */ |
| 864 | extern errcode_t ext2fs_resize_generic_bitmap(__u32 new_end, |
| 865 | __u32 new_real_end, |
| 866 | ext2fs_generic_bitmap bmap); |
| 867 | extern errcode_t ext2fs_resize_inode_bitmap(__u32 new_end, __u32 new_real_end, |
| 868 | ext2fs_inode_bitmap bmap); |
| 869 | extern errcode_t ext2fs_resize_block_bitmap(__u32 new_end, __u32 new_real_end, |
| 870 | ext2fs_block_bitmap bmap); |
| 871 | extern errcode_t ext2fs_copy_bitmap(ext2fs_generic_bitmap src, |
| 872 | ext2fs_generic_bitmap *dest); |
| 873 | |
| 874 | /* swapfs.c */ |
| 875 | extern void ext2fs_swap_ext_attr(char *to, char *from, int bufsize, |
| 876 | int has_header); |
| 877 | extern void ext2fs_swap_super(struct ext2_super_block * super); |
| 878 | extern void ext2fs_swap_group_desc(struct ext2_group_desc *gdp); |
| 879 | extern void ext2fs_swap_inode_full(ext2_filsys fs, struct ext2_inode_large *t, |
| 880 | struct ext2_inode_large *f, int hostorder, |
| 881 | int bufsize); |
| 882 | extern void ext2fs_swap_inode(ext2_filsys fs,struct ext2_inode *t, |
| 883 | struct ext2_inode *f, int hostorder); |
| 884 | |
| 885 | /* valid_blk.c */ |
| 886 | extern int ext2fs_inode_has_valid_blocks(struct ext2_inode *inode); |
| 887 | |
| 888 | /* version.c */ |
| 889 | extern int ext2fs_parse_version_string(const char *ver_string); |
| 890 | extern int ext2fs_get_library_version(const char **ver_string, |
| 891 | const char **date_string); |
| 892 | |
| 893 | /* write_bb_file.c */ |
| 894 | extern errcode_t ext2fs_write_bb_FILE(ext2_badblocks_list bb_list, |
| 895 | unsigned int flags, |
| 896 | FILE *f); |
| 897 | |
| 898 | |
| 899 | /* inline functions */ |
| 900 | extern errcode_t ext2fs_get_mem(unsigned long size, void *ptr); |
| 901 | extern errcode_t ext2fs_free_mem(void *ptr); |
| 902 | extern errcode_t ext2fs_resize_mem(unsigned long old_size, |
| 903 | unsigned long size, void *ptr); |
| 904 | extern void ext2fs_mark_super_dirty(ext2_filsys fs); |
| 905 | extern void ext2fs_mark_changed(ext2_filsys fs); |
| 906 | extern int ext2fs_test_changed(ext2_filsys fs); |
| 907 | extern void ext2fs_mark_valid(ext2_filsys fs); |
| 908 | extern void ext2fs_unmark_valid(ext2_filsys fs); |
| 909 | extern int ext2fs_test_valid(ext2_filsys fs); |
| 910 | extern void ext2fs_mark_ib_dirty(ext2_filsys fs); |
| 911 | extern void ext2fs_mark_bb_dirty(ext2_filsys fs); |
| 912 | extern int ext2fs_test_ib_dirty(ext2_filsys fs); |
| 913 | extern int ext2fs_test_bb_dirty(ext2_filsys fs); |
| 914 | extern int ext2fs_group_of_blk(ext2_filsys fs, blk_t blk); |
| 915 | extern int ext2fs_group_of_ino(ext2_filsys fs, ext2_ino_t ino); |
| 916 | extern blk_t ext2fs_inode_data_blocks(ext2_filsys fs, |
| 917 | struct ext2_inode *inode); |
| 918 | |
| 919 | #ifdef __cplusplus |
| 920 | } |
| 921 | #endif |
| 922 | |
| 923 | #endif /* _EXT2FS_EXT2FS_H */ |