Info Node: (libext2fs.info)Iterating over inodes in a filesystem
(libext2fs.info)Iterating over inodes in a filesystem
Iterating over inodes in a filesystem
-------------------------------------
The inode_scan abstraction is useful for iterating over all the
inodes in a filesystem.
- Function: errcode_t ext2fs_open_inode_scan (ext2_filsys FS, int
BUFFER_BLOCKS, ext2_inode_scan *SCAN)
Initialize the iteration variable SCAN. This variable is used by
`ext2fs_get_next_inode'. The BUFFER_BLOCKS parameter controls how
many blocks of the inode table are read in at a time. A large
number of blocks requires more memory, but reduces the overhead in
seeking and reading from the disk. If BUFFER_BLOCKS is zero, a
suitable default value will be used.
- Function: void ext2fs_close_inode_scan (ext2_inode_scan SCAN)
Release the memory associated with SCAN and invalidate it.
- Function: errcode_t ext2fs_get_next_inode (ext2_inode_scan SCAN,
ext2_ino_t *INO, struct ext2_inode *INODE)
This function returns the next inode from the filesystem; the inode
number of the inode is stored in INO, and the inode is stored in
INODE.
If the inode is located in a block that has been marked as bad,
`ext2fs_get_next_inode' will return the error
`EXT2_ET_BAD_BLOCK_IN_INODE_TABLE'.
- Function: errcode_t ext2fs_inode_scan_goto_blockgroup
(ext2_inode_scan SCAN, int GROUP)
Start the inode scan at a particular ext2 blockgroup, GROUP. This
function may be safely called at any time while SCAN is valid.
- Function: void ext2fs_set_inode_callback (ext2_inode_scan SCAN,
errcode_t (*done_group)(ext2_filsys FS, ext2_inode_scan SCAN,
dgrp_t GROUP, void * PRIVATE), void *DONE_GROUP_DATA)
Register a callback function which will be called by
`ext2_get_next_inode' when all of the inodes in a block group have
been processed.
- Function: int ext2fs_inode_scan_flags (ext2_inode_scan SCAN, int
SET_FLAGS, int CLEAR_FLAGS)
Set the scan_flags SET_FLAGS and clear the scan_flags CLEAR_FLAGS.
The following flags can be set using this interface:
`EXT2_SF_SKIP_MISSING_ITABLE'
When a block group is missing an inode table, skip it. If
this flag is not set `ext2fs_get_next_inode' will return the
error EXT2_ET_MISSING_INODE_TABLE.