Chapter 36
Linux File Systems: liboskit_linux_fs.a

The Linux filesystem library consists of the Linux virtual and real filesystem code along with glue code to export the OSKit filesystem interface (See Chapter 9).

The header file <oskit/fs/linux_filesystems.h> determines which of the real Linux real filesystems, e.g. ext2, iso9660, are compiled into liboskit_linux_fs.a. All the filesystems listed in that file will compile, but only ext2, msdos, vfat, and iso9660 have been tested.

The Linux filesystem library provides two additional interfaces:

fs_linux_init:
Initialize the Linux fs library.
fs_linux_mount:
Mount a filesystem via the Linux fs library

36.0.4 fs_linux_init: Initialize the Linux fs library

SYNOPSIS

#include <oskit/fs/linux.h>

oskit_error_t fs_linux_init(void);

DIRECTION

client OS --> filesystem library

DESCRIPTION

This function initializes the Linux fs library, and must be invoked prior to the first call to fs_linux_mount. This function only needs to be invoked once by the client operating system.

All filesystems listed in <oskit/fs/linux_filesystems.h> are initialized.

RETURNS

Returns 0 on success, or an error code specified in <oskit/error.h>, on error.

36.0.5 fs_linux_mount: Mount a filesystem via the Linux fs library

SYNOPSIS

#include <oskit/fs/linux.h>

oskit_error_t fs_linux_mount(oskit_blkio_t *bio, oskit_u32_t flags, oskit_filesystem_t **out_fs);

DIRECTION

client OS --> filesystem library

DESCRIPTION

This function looks in the partition described by bio for a filesystem superblock, calls the corresponding filesystem mount code, and returns a handle to an oskit_filesystem_t for this filesystem.

This function may be used multiple times by a client operating system to mount multiple file systems.

Note that this function does not graft the filesystem into a namespace; oskit_dir_reparent or other layers may be used for that purpose.

Typically, this interface is not exported to clients, and is only used by the client operating system during initialization.

This function is a wrapper for Linux’s mount_root.

PARAMETERS
bio:
Describes the partition containing a filesytem. Can be the whole disk like that returned from oskit_linux_block_open, or a subset of one like what is given by diskpart_blkio_lookup_bsd_string.
flags:
The mount flags. These are formed by or’ing the following values:
OSKIT_FS_RDONLY
Read only filesystem
OSKIT_FS_NOEXEC
Can’t exec from filesystem
OSKIT_FS_NOSUID
Don’t honor setuid bits on fs
OSKIT_FS_NODEV
Don’t interpret special files
out_fs:
Upon success, is set to point to an oskit_filesystem_t for this filesystem.
RETURNS

Returns 0 on success, or an error code specified in <oskit/error.h>, on error.