The manual
ginnOS
The reference: libc, the libraries and the kernel
Loading...
Searching...
No Matches
tmpfs.c File Reference

a filesystem that keeps its files in kernel memory. More...

#include "tmpfs.h"
#include "common/memory.h"
#include "common/string.h"
#include "kernel/errno.h"
#include "kernel/memory/heap.h"
#include "kernel/sync/mutex.h"
#include "kernel/time/clock.h"
#include "kernel/vfs/stat.h"

Macros

#define TMPFS_NAME_MAX   64
#define TMPFS_MAX_BYTES   (8u * 1024u * 1024u)

Typedefs

typedef struct tmpfs_node tmpfs_node_t

Functions

kerr_t tmpfs_mount (fs_mount_t *mount)
 set up the tmpfs (empty) on a mount.

Detailed Description

a filesystem that keeps its files in kernel memory.

every file and directory is a node on the kernel heap; a file's bytes are one heap buffer that grows as it is written. nothing survives a reboot.

an open file keeps its node in fs_data and its offset in fs_pos (for a directory, fs_pos is the index of the next entry). a node removed while it is open stays alive until its last close.

a symbolic link is a node whose bytes are its target. there are no hard links: a node is one name.

locking: one mutex for the whole filesystem (there is one tmpfs).

Macro Definition Documentation

◆ TMPFS_NAME_MAX

#define TMPFS_NAME_MAX   64

◆ TMPFS_MAX_BYTES

#define TMPFS_MAX_BYTES   (8u * 1024u * 1024u)

Typedef Documentation

◆ tmpfs_node_t

typedef struct tmpfs_node tmpfs_node_t

Function Documentation

◆ tmpfs_mount()

kerr_t tmpfs_mount ( fs_mount_t * mount)

set up the tmpfs (empty) on a mount.

hand it to vfs_mount afterwards.

Parameters
mountfilesystem mount object to initialize.
Returns
KERR_OK.