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