201 panic(
NULL,
"Failed to create ramfs file dentry");
210 panic(
NULL,
"Failed to create ramfs file inode");
226 panic(
NULL,
"Failed to create ramfs dentry");
235 panic(
NULL,
"Failed to create ramfs inode");
262 if (superblock ==
NULL)
void dentry_make_positive(dentry_t *dentry, inode_t *inode)
Make a dentry positive by associating it with an inode.
dentry_t * dentry_new(superblock_t *superblock, dentry_t *parent, const char *name)
Create a new dentry.
uint64_t dentry_generic_getdents(dentry_t *dentry, dirent_t *buffer, uint64_t count, uint64_t *offset, mode_t mode)
Helper function for a basic getdents.
uint64_t file_generic_seek(file_t *file, int64_t offset, seek_origin_t origin)
Helper function for basic seeking.
uint64_t filesystem_register(filesystem_t *fs)
Registers a filesystem.
inode_t * inode_new(superblock_t *superblock, inode_number_t number, inode_type_t type, const inode_ops_t *ops, const file_ops_t *fileOps)
Create a new inode.
mode_t
Path flags and permissions.
#define RAMFS_NAME
The name of the ramfs filesystem.
void ramfs_init(void)
Registers the ramfs filesystem and mounts it as the root filesystem.
superblock_t * superblock_new(filesystem_t *fs, const char *deviceName, const superblock_ops_t *ops, const dentry_ops_t *dentryOps)
Create a new superblock.
boot_info_t * boot_info_get(void)
Gets the boot info structure.
NORETURN void panic(const interrupt_frame_t *frame, const char *format,...)
Panic the kernel, printing a message and halting.
#define LOG_INFO(format,...)
process_t * sched_process(void)
Retrieves the process of the currently running thread.
static void lock_init(lock_t *lock)
Initializes a lock.
static void lock_release(lock_t *lock)
Releases a lock.
static void lock_acquire(lock_t *lock)
Acquires a lock, blocking until it is available.
#define MUTEX_SCOPE(mutex)
Acquires a mutex for the reminder of the current scope.
#define UNREF_DEFER(ptr)
RAII-style cleanup for scoped references.
#define REF(ptr)
Increment reference count.
#define UNREF(ptr)
Decrement reference count.
#define VFS_ROOT_ENTRY_NAME
The name of the root entry.
#define VFS_DEVICE_NAME_NONE
The name used to indicate no device.
#define BUFFER_READ(buffer, count, offset, src, size)
Helper macros for implementing file operations dealing with simple buffers.
#define BUFFER_WRITE(buffer, count, offset, src, size)
Helper macro for implementing file operations dealing with simple buffer writes.
uint64_t vfs_id_get(void)
Generates a new unique ID, to be used for any VFS object.
#define ENOTEMPTY
Directory not empty.
#define errno
Error number variable.
inode_type_t
Inode type enum.
@ MOUNT_PROPAGATE_PARENT
Propagate the mount to parent namespaces.
@ MOUNT_PROPAGATE_CHILDREN
Propagate the mount to child namespaces.
@ INODE_DIR
Is a directory.
#define LIST_FOR_EACH(elem, list, member)
Iterates over a list.
static void list_push_back(list_t *list, list_entry_t *entry)
Pushes an entry to the end of the list.
#define LIST_FOR_EACH_SAFE(elem, temp, list, member)
Safely iterates over a list, allowing for element removal during iteration.
static void list_remove(list_t *list, list_entry_t *entry)
Removes a list entry from its current list.
static bool list_is_empty(list_t *list)
Checks if a list is empty.
static void list_init(list_t *list)
Initializes a list.
#define NULL
Pointer error value.
#define ERR
Integer error value.
EFI_PHYSICAL_ADDRESS buffer
static inode_ops_t inodeOps
static void ramfs_superblock_cleanup(superblock_t *superblock)
static void ramfs_dentry_add(dentry_t *dentry)
static void ramfs_dentry_remove(dentry_t *dentry)
static dentry_t * ramfs_load_file(superblock_t *superblock, dentry_t *parent, const char *name, const boot_file_t *in)
static dentry_ops_t dentryOps
static void ramfs_truncate(inode_t *inode)
static dentry_t * ramfs_mount(filesystem_t *fs, const char *devName, void *private)
static dentry_t * ramfs_load_dir(superblock_t *superblock, dentry_t *parent, const char *name, const boot_dir_t *in)
static filesystem_t ramfs
static void ramfs_inode_cleanup(inode_t *inode)
static uint64_t ramfs_link(inode_t *dir, dentry_t *old, dentry_t *target)
static inode_t * ramfs_inode_new(superblock_t *superblock, inode_type_t type, void *buffer, uint64_t size)
static uint64_t ramfs_create(inode_t *dir, dentry_t *target, mode_t mode)
static uint64_t ramfs_write(file_t *file, const void *buffer, uint64_t count, uint64_t *offset)
static superblock_ops_t superOps
static uint64_t ramfs_read(file_t *file, void *buffer, uint64_t count, uint64_t *offset)
static uint64_t ramfs_remove(inode_t *dir, dentry_t *target, mode_t mode)
static file_ops_t fileOps
_PUBLIC void * realloc(void *ptr, size_t size)
_PUBLIC void * malloc(size_t size)
_PUBLIC void free(void *ptr)
_PUBLIC void * memcpy(void *_RESTRICT s1, const void *_RESTRICT s2, size_t n)
_PUBLIC void * memset(void *s, int c, size_t n)
Dentry operations structure.
uint64_t(* getdents)(dentry_t *dentry, dirent_t *buffer, uint64_t count, uint64_t *offset, mode_t mode)
Directory entry structure.
inode_t * inode
Will be NULL if the dentry is negative, once positive it will never be NULL.
char name[MAX_NAME]
Constant after creation.
list_entry_t otherEntry
Made available for use by any other subsystems for convenience.
superblock_t * superblock
File operations structure.
uint64_t(* read)(file_t *file, void *buffer, uint64_t count, uint64_t *offset)
Filesystem structure, represents a filesystem type, e.g. fat32, ramfs, sysfs, etc.
Inode operations structure.
uint64_t(* create)(inode_t *dir, dentry_t *target, mode_t mode)
Handles both directories and files depending on mode.
inode_type_t type
Constant after creation.
superblock_t * superblock
Constant after creation.
Superblock private data for ramfs.
Superblock operations structure.
void(* cleanup)(superblock_t *superblock)