|
AquilaOS documentation
How it works, and its code
|
tmpfs: a filesystem in memory, gone when the system stops. More...
#include <core/system.h>#include <core/module.h>#include <core/string.h>#include <core/panic.h>#include <core/time.h>#include <mm/mm.h>#include <fs/vfs.h>#include <fs/iobuf.h>#include <fs/pseudofs.h>#include <fs/tmpfs.h>#include <fs/posix.h>#include <aquila/errno.h>#include <aquila/dirent.h>Go to the source code of this file.
Functions | |
| static int | tmpfs_vget (struct vnode *super, ino_t ino, struct vnode **vnode) |
| Gets a vnode by its inode number, which is its address. | |
| static int | tmpfs_close (struct vnode *vnode) |
| Frees a vnode that has neither references nor names left. | |
| static ssize_t | tmpfs_read (struct vnode *node, off_t offset, struct iobuf *io) |
| Reads a file's data from its buffer. | |
| static ssize_t | tmpfs_write (struct vnode *node, off_t offset, struct iobuf *io) |
| Writes a file's data into its buffer, which grows to hold it. | |
| static int | tmpfs_trunc (struct vnode *vnode, off_t len) |
| Changes a file's length: its buffer is cut, or grows with zeros. | |
| static int | tmpfs_file_can_read (struct file *file, size_t size) |
| Says whether size bytes can be read from the file's offset. | |
| static int | tmpfs_file_can_write (struct file *file, size_t size) |
| Says that a write can always go on: tmpfs has no size limit yet. | |
| static int | tmpfs_file_eof (struct file *file) |
| Says whether the file's offset is at its end. | |
| static int | tmpfs_init () |
| Installs tmpfs at boot. | |
| static int | tmpfs_mount (struct vnode *dir, int flags, void *data) |
| Mounts a new, empty tmpfs on a directory. | |
Variables | |
| struct fs | tmpfs |
tmpfs: a filesystem in memory, gone when the system stops.
Its vnodes are its inodes: each lives in memory as long as it has a name or a reference, and its inode number is its address. A file's data is one buffer of its size. The directories are pseudofs's (fs/pseudofs/), which devfs and devpts share.
Definition in file tmpfs.c.
|
static |
Frees a vnode that has neither references nor names left.
Definition at line 38 of file tmpfs.c.
References kfree(), vnode::nlink, vnode::p, pseudofs_close(), vnode::ref, and tmpfs_close().
Referenced by tmpfs_close().
Says whether size bytes can be read from the file's offset.
Definition at line 131 of file tmpfs.c.
References file::offset, vnode::size, and tmpfs_file_can_read().
Referenced by tmpfs_file_can_read().
Says that a write can always go on: tmpfs has no size limit yet.
Definition at line 140 of file tmpfs.c.
References tmpfs_file_can_write().
Referenced by tmpfs_file_can_write().
|
static |
Says whether the file's offset is at its end.
Definition at line 146 of file tmpfs.c.
References file::offset, and tmpfs_file_eof().
Referenced by tmpfs_file_eof().
|
static |
Installs tmpfs at boot.
Definition at line 152 of file tmpfs.c.
References tmpfs, tmpfs_init(), and vfs_install().
Referenced by tmpfs_init().
|
static |
Mounts a new, empty tmpfs on a directory.
The mode= option (octal) sets its root's permissions, 0777 otherwise. Returns 0, -ENOMEM, or -EBUSY if something is mounted on the directory already.
Definition at line 160 of file tmpfs.c.
References vnode::atime, vnode::ctime, vnode::fs, gettime(), vnode::ino, kfree(), kmalloc(), M_ZERO, vnode::mode, vnode::mtime, vnode::nlink, NULL, vnode::p, vnode::ref, vnode::size, tmpfs, tmpfs_mount(), and vfs_bind().
Referenced by tmpfs_mount().
Reads a file's data from its buffer.
Definition at line 49 of file tmpfs.c.
References iobuf_out(), vnode::p, vnode::size, and tmpfs_read().
Referenced by tmpfs_read().
Changes a file's length: its buffer is cut, or grows with zeros.
Definition at line 95 of file tmpfs.c.
References kfree(), kmalloc(), memcpy(), memset(), MIN, NULL, vnode::p, vnode::size, and tmpfs_trunc().
Referenced by tmpfs_trunc().
Gets a vnode by its inode number, which is its address.
Definition at line 28 of file tmpfs.c.
References vnode::ino, and tmpfs_vget().
Referenced by tmpfs_vget().
Writes a file's data into its buffer, which grows to hold it.
Definition at line 61 of file tmpfs.c.
References iobuf_in(), kfree(), kmalloc(), M_ZERO, MAX, memcpy(), vnode::p, iobuf::resid, vnode::size, and tmpfs_write().
Referenced by tmpfs_write().
| struct fs tmpfs |
Definition at line 214 of file tmpfs.c.
Referenced by devfs_init(), devpts_init(), tmpfs_init(), and tmpfs_mount().