Info Node: (libext2fs.info)Opening an ext2 filesystem
(libext2fs.info)Opening an ext2 filesystem
Opening an ext2 filesystem
--------------------------
Most libext2fs functions take a filesystem handle of type
`ext2_filsys'. A filesystem handle is created either by opening an
existing function using `ext2fs_open', or by initializing a new
filesystem using `ext2fs_initialize'.
- Function: errcode_t ext2fs_open (const char *NAME, int FLAGS, int
SUPERBLOCK, int BLOCK_SIZE, io_manager MANAGER, ext2_filsys
*RET_FS)
Opens a filesystem named NAME, using the the io_manager MANAGER to
define the input/output routines needed to read and write the
filesystem. In the case of the `unix_io' io_manager, NAME is
interpreted as the Unix filename of the filesystem image. This is
often a device file, such as `/dev/hda1'.
The SUPERBLOCK parameter specifies the block number of the
superblock which should be used when opening the filesystem. If
SUPERBLOCK is zero, `ext2fs_open' will use the primary superblock
located at offset 1024 bytes from the start of the filesystem
image.
The BLOCK_SIZE parameter specifies the block size used by the
filesystem. Normally this is determined automatically from the
filesystem uperblock. If BLOCK_SIZE is non-zero, it must match
the block size found in the superblock, or the error
`EXT2_ET_UNEXPECTED_BLOCK_SIZE' will be returned. The BLOCK_SIZE
parameter is also used to help fund the superblock when SUPERBLOCK
is non-zero.
The FLAGS argument contains a bitmask of flags which control how
the filesystem open should be handled.
`EXT2_FLAG_RW'
Open the filesystem for reading and writing. Without this
flag, the filesystem is opened for reading only.
`EXT2_FLAG_FORCE'
Open the filesystem regardless of the feature sets listed in
the superblock.