AquilaOS documentation
How it works, and its code
Loading...
Searching...
No Matches
mount.c File Reference

Mounting: a filesystem on a directory, by type (mount()), and the root filesystem from a disk partition. More...

#include <core/system.h>
#include <core/string.h>
#include <fs/vfs.h>
#include <fs/devfs.h>
#include <dev/dev.h>
#include <ds/queue.h>

Go to the source code of this file.

Functions

int vfs_mount (const char *type, const char *dir, int flags, void *data, struct uio *uio)
 Mounts a filesystem of a type on a directory, for mount().
static int root_dev (const char *name, dev_t *dev)
 Gets the device number of an ATA disk partition, by its name (/dev/hda1 to /dev/hdd4).
int vfs_mount_root_dev (const char *name, const char *type)
 Mounts the root filesystem from a disk partition (the root=/dev/hda2 kernel argument).

Variables

struct queue * mounts = QUEUE_NEW()

Detailed Description

Mounting: a filesystem on a directory, by type (mount()), and the root filesystem from a disk partition.

/proc/mounts lists the mounts.

Definition in file mount.c.

Function Documentation

◆ root_dev()

int root_dev ( const char * name,
dev_t * dev )
static

Gets the device number of an ATA disk partition, by its name (/dev/hda1 to /dev/hdd4).

Returns 0, or -ENODEV for another name.

Definition at line 100 of file mount.c.

References DEV, and root_dev().

Referenced by root_dev(), and vfs_mount_root_dev().

◆ vfs_mount()

int vfs_mount ( const char * type,
const char * dir,
int flags,
void * data,
struct uio * uio )

Mounts a filesystem of a type on a directory, for mount().

Parameters
typethe filesystem's name ("ext2", "procfs", ...)
dirthe directory's path
flagspassed on to the filesystem
datathe filesystem's arguments (its device, its options)
uiowho is asking
Returns
0, -EINVAL for an unknown type, -ENOTDIR, -EBUSY if something is mounted there already, or the filesystem's error

Definition at line 29 of file mount.c.

References vnode::covered, mountpoint::dev, kfree(), kmalloc(), vnode::mode, fs::mount, vnode::mounted, mounts, fs_list::next, NULL, mountpoint::options, mountpoint::path, registered_fs, mountpoint::type, vfs_close(), vfs_lookup(), vfs_mount(), and vfs_vnode_path().

Referenced by kmain(), sys_mount(), and vfs_mount().

◆ vfs_mount_root_dev()

int vfs_mount_root_dev ( const char * name,
const char * type )

Mounts the root filesystem from a disk partition (the root=/dev/hda2 kernel argument).

There are no device nodes yet at boot, so the partition's vnode is made here, as the RAM disk's is.

Parameters
namethe partition's name, /dev/hda1 to /dev/hdd4
typethe filesystem's type (rootfstype=), or NULL for ext2
Returns
0, -ENODEV for a bad name, -EINVAL for an unknown type, or the filesystem's error

Definition at line 120 of file mount.c.

References devfs, kfree(), kmalloc(), fs::load, M_ZERO, fs::name, fs_list::next, NULL, printk(), vnode::rdev, registered_fs, root_dev(), vfs_mount_root(), and vfs_mount_root_dev().

Referenced by kmain(), and vfs_mount_root_dev().

Variable Documentation

◆ mounts

struct queue* mounts = QUEUE_NEW()

Definition at line 14 of file mount.c.

Referenced by procfs_mounts(), and vfs_mount().