Info Node: (libext2fs.info)Directory-block list management
(libext2fs.info)Directory-block list management
Directory-block list management
-------------------------------
The dblist abstraction stores a list of blocks belonging to
directories. This list can be useful when a program needs to interate
over all directory entries in a filesystem; `e2fsck' does this in pass
2 of its operations, and `debugfs' needs to do this when it is trying
to turn an inode number into a pathname.
- Function: errcode_t ext2fs_init_dblist (ext2_filsys FS, ext2_dblist
*RET_DBLIST)
Creates a dblist data structure and return it in RET_DBLIST.
- Function: void ext2fs_free_dblist (ext2_dblist DBLIST)
Free a dblist data structure.
- Function: errcode_t ext2fs_add_dir_block (ext2_dblist DBLIST,
ext2_ino_t INO, blk_t BLK, int BLOCKCNT)
Add an entry to the dblist data structure. This call records the
fact that block number BLOCKCNT of directory inode INO is stored
in block BLK.
- Function: errcode_t ext2fs_set_dir_block (ext2_dblist DBLIST,
ext2_ino_t INO, blk_t BLK, int BLOCKCNT)
Change an entry in the dblist data structure; this changes the
location of block number BLOCKCNT of directory indoe INO to be
block BLK.
- Function: errcode_t ext2fs_dblist_iterate (ext2_dblist DBLIST, int
(*func)(ext2_filsys FS, struct ext2_db_entry *DB_INFO, void
*PRIVATE), void *PRIVATE)
This iterator calls FUNC for every entry in the dblist data
structure.
- Function: errcode_t ext2fs_dblist_dir_iterate (ext2_dblist DBLIST,
int flags, char *BLOCK_BUF, int (*func)(ext2_ino_t DIR, int
ENTRY, struct ext2_dir_entry *DIRENT, int OFFSET, int
BLOCKSIZE, char *BUF, void *PRIVATE), void *PRIVATE)
This iterator takes reads in the directory block indicated in each
dblist entry, and calls FUNC for each directory entry in each
directory block. If DBLIST contains all the directory blocks in a
filesystem, this function provides a convenient way to iterate
over all directory entries for that filesystem.