|
miniOS
x86_64 hobby kernel with SMP, VFS, and POSIX process model
|
#include <miniOS/fs/tmpfs.h>#include <miniOS/fs/ext2.h>#include <miniOS/fs/vfs.h>#include <miniOS/mm/heap.h>#include <miniOS/io.h>#include <string.h>
Classes | |
| struct | tmpfs_inode_t |
Macros | |
| #define | TMPFS_MAX_INODES 64 |
| #define | TMPFS_BLOCK_SIZE 4096 |
| #define | TMPFS_MAX_BLOCKS 16 /* max direct blocks per inode = 64 KiB max file size */ |
| #define | TMPFS_ROOT_INO 1 |
| #define | TMPFS_NAME_MAX 255 |
Variables | |
| static tmpfs_inode_t | g_tmpfs_inodes [TMPFS_MAX_INODES] |
| static uint32_t | g_tmpfs_next_ino = TMPFS_ROOT_INO |
| static int | g_tmpfs_initialized = 0 |
| static uint32_t | g_tmpfs_active_root = TMPFS_ROOT_INO |
: Symlink filename (null-terminated; max TMPFS_NAME_MAX chars). | |
tmpfs_symlink() - Create a symlink in a tmpfs directory. @parent_ino: Parent directory inode number. @target: Target string (null-terminated; max 255 chars stored).
| |
| static vfs_ops_t | g_tmpfs_ops |
| static int | tmpfs_symlink (uint32_t parent_ino, const char *name, const char *target) |
| static int | tmpfs_chmod (uint32_t ino, uint16_t mode) |
| static int | tmpfs_rename (uint32_t old_parent_ino, const char *old_name, uint32_t new_parent_ino, const char *new_name) |
| static int | tmpfs_statfs (vfs_statfs_t *out) |
| static int | tmpfs_fs_mount (const char *source, const char *target, const void *data) |
| void | tmpfs_init (void) |
| vfs_ops_t * | tmpfs_get_ops (void) |
| uint32_t | tmpfs_alloc_root (void) |
| int | tmpfs_create (uint32_t parent_ino, const char *name, uint16_t mode, uint32_t *new_ino_out) |
| int | tmpfs_create_device (uint32_t parent_ino, const char *name, uint8_t device_type, uint32_t *new_ino_out) |
| int | tmpfs_mknod (uint32_t parent_ino, const char *name, uint16_t mode, uint32_t dev, uint32_t *new_ino_out) |
| int | tmpfs_mkdir (uint32_t parent_ino, const char *name, uint32_t *new_ino_out) |
| int | tmpfs_unlink (uint32_t parent_ino, const char *name) |
| int | tmpfs_rmdir (uint32_t parent_ino, const char *name) |
| #define TMPFS_BLOCK_SIZE 4096 |
| #define TMPFS_MAX_BLOCKS 16 /* max direct blocks per inode = 64 KiB max file size */ |
| #define TMPFS_MAX_INODES 64 |
| #define TMPFS_NAME_MAX 255 |
| #define TMPFS_ROOT_INO 1 |
|
static |

| uint32_t tmpfs_alloc_root | ( | void | ) |
tmpfs_alloc_root() - Allocate a fresh root directory inode for a new mount.
Each call to mount tmpfs <target> should call this to get an isolated root directory. The returned inode number is stored in vfs_mount_t.root_ino and activated via set_root() before each path lookup on that mount.



| int tmpfs_create_device | ( | uint32_t | parent_ino, |
| const char * | name, | ||
| uint8_t | device_type, | ||
| uint32_t * | new_ino_out ) |

|
static |


|
static |


|
static |


|
static |
|
static |


|
static |


| vfs_ops_t * tmpfs_get_ops | ( | void | ) |
tmpfs_get_ops() - Return a pointer to the static tmpfs vfs_ops_t table.
The returned pointer is valid for the lifetime of the kernel.
|
static |


| void tmpfs_init | ( | void | ) |
tmpfs_init() - Initialise the tmpfs inode pool and register the "tmpfs" type.
Initialises the shared inode table (inode 1 = internal sentinel root) and calls register_filesystem("tmpfs", ...) so that vfs_mount_fstype("tmpfs", ...) works. Safe to call multiple times — subsequent calls are no-ops. Must be called before any vfs_mount_fstype("tmpfs", ...) invocation.


|
static |

|
static |


| int tmpfs_mknod | ( | uint32_t | parent_ino, |
| const char * | name, | ||
| uint16_t | mode, | ||
| uint32_t | dev, | ||
| uint32_t * | new_ino_out ) |


|
static |

tmpfs_readlink() - Read the stored symlink_target of a tmpfs symlink inode. @ino: Inode number (must have i_mode & EXT2_S_IFLNK set). @buf: Output buffer. NOT null-terminated (POSIX readlink semantics). @len: Maximum bytes to copy.

|
static |

| int tmpfs_rmdir | ( | uint32_t | parent_ino, |
| const char * | name ) |

|
static |
|
static |
|
static |


| int tmpfs_unlink | ( | uint32_t | parent_ino, |
| const char * | name ) |




|
static |
|
static |
|
static |
|
static |
|
static |