The fsread library provides simple read-only access to Linux ext2fs, BSD FFS, and MINIX filesystems and is useful for small programs, such as boot loaders, that need to read files from the local disk but don’t have the space for or need the features of the larger OSKit filesystem libraries.
Typically this library is used with the disk partitioning library (Section 33) and one of the driver libraries.
This depends on several memory and string routines from the OSKit C library, more specifically it depends on
Each of these functions takes an oskit_blkio_t (Section 7.3) interface to the underlying device and a pathname relative to the root directory of the file system, and if the specified file can be found, returns an oskit_blkio_t object that can be used to read from that file. The blkio object returned will have a block size of 1, meaning that there are no alignment restrictions on file reads. The blkio object passed, representing the underlying device, can have a block size greater than 1, but if it is larger than the file system’s block size, file system interpretation will fail. Also, any absolute symlinks followed during the open will be interpreted as if this is the root file system.
#include <oskit/fs/read.h>
oskit_error_t fsread_open(oskit_blkio_t *device, const char *path, [out] oskit_blkio_t **out_file);
Tries to open a file named by path in the filesystem on device. If successful, returns a blkio into out_file that can be used to read the file.
This function is just a wrapper that calls the various filesystem-specific fsread functions, failing if none of them recognize the filesystem.
Returns 0 on success, or an error code specified in <oskit/error.h>, on error.
#include <oskit/fs/read.h>
oskit_error_t fsread_FSTYPE_open(oskit_blkio_t *device, const char *path, [out] oskit_blkio_t **out_file);
Tries to open a file named by path in the FSTYPE filesystem on device. If successful, returns a blkio into out_file that can be used to read the file.
FSTYPE can be one of ext2, ffs, minix.
Returns 0 on success, or an error code specified in <oskit/error.h>, on error.