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

devfs: the filesystem of device nodes, usually mounted on /dev. More...

#include <core/system.h>
#include <core/module.h>
#include <core/string.h>
#include <core/time.h>
#include <fs/vfs.h>
#include <fs/devfs.h>
#include <fs/tmpfs.h>
#include <aquila/errno.h>

Go to the source code of this file.

Functions

static int devfs_init ()
 Sets devfs up at boot: tmpfs's operations, and its root directory.
static int devfs_mount (struct vnode *dir, int flags, void *data)
 Mounts devfs on a directory: its one root directory is bound there.

Variables

struct vnode * devfs_root = NULL
struct fs devfs

Detailed Description

devfs: the filesystem of device nodes, usually mounted on /dev.

It is a tmpfs with one root of its own: every mount of devfs shows the same directory, so the nodes made at boot (rootfs's runit stage 1, or a test program) are there for whoever mounts it.

Definition in file devfs.c.

Function Documentation

◆ devfs_init()

int devfs_init ( )
static

Sets devfs up at boot: tmpfs's operations, and its root directory.

Definition at line 24 of file devfs.c.

References vnode::atime, vnode::ctime, devfs, devfs_init(), devfs_root, fs::fops, vnode::fs, gettime(), vnode::ino, kmalloc(), M_ZERO, vnode::mode, vnode::mtime, vnode::nlink, vnode::ref, tmpfs, vfs_install(), and fs::vops.

Referenced by devfs_init().

◆ devfs_mount()

int devfs_mount ( struct vnode * dir,
int flags,
void * data )
static

Mounts devfs on a directory: its one root directory is bound there.

Definition at line 52 of file devfs.c.

References devfs_mount(), devfs_root, and vfs_bind().

Referenced by devfs_mount().

Variable Documentation

◆ devfs

struct fs devfs
Initial value:
= {
.name = "devfs",
.nodev = 1,
.init = devfs_init,
.mount = devfs_mount,
}
static int devfs_init()
Sets devfs up at boot: tmpfs's operations, and its root directory.
Definition devfs.c:24
static int devfs_mount(struct vnode *dir, int flags, void *data)
Mounts devfs on a directory: its one root directory is bound there.
Definition devfs.c:52

Definition at line 60 of file devfs.c.

Referenced by devfs_init(), load_ramdisk(), and vfs_mount_root_dev().

◆ devfs_root

struct vnode* devfs_root = NULL

Definition at line 21 of file devfs.c.

Referenced by devfs_init(), and devfs_mount().