Voxia OS v0.0.1
Hobby Project Operating System Targeting x86-64
Loading...
Searching...
No Matches
vfs.c File Reference
#include "console/console.h"
#include "init/init.h"
#include "ioforge/ioforge_block.h"
#include "libk/debug/debug.h"
#include "libk/fs/iso9660.h"
#include "libk/serial.h"
#include "llist.h"
#include "memory/slab.h"
#include "notify.h"
#include "str.h"
#include "vfs/vnode.h"
#include <string.h>
#include <type.h>
#include <vector.h>
#include <vfs/dentry.h>
#include <vfs/dev.h>
#include <vfs/enum.h>
#include <vfs/filesystem.h>
#include <vfs/mount.h>
#include <vfs/vfs.h>
#include <libk/tree/rbt.h>

Go to the source code of this file.

Macros

#define RBT_TYPE   vnode_t
 
#define RBT_ID_NAME   id
 
#define VFS_DEBUG   1
 
#define PATH_MAX   4096
 
#define NAME_MAX   255
 
#define VFS_MAX_FS   512
 
#define VFS_MAX_PATH_CACHE   512
 
#define CALC_PATH_HASH_LEN(path, curr_depth)
 

Functions

static void vfs_event_handler (uint32_t event, void *data, void *ctx)
 
 __attribute__ ((used, visibility("default"), section(".export")))
 This function handles memory allocation for a new dentry using the slab allocator.
 
 INIT (Vfs)
 
static int vfs_umount_recursive (dentry_t *dentry)
 
int vfs_umount (dentry_ptr dentry)
 
 __attribute__ ((unused))
 

Variables

static rbt_nodeNIL
 
static rbt_nodevfs_tree
 
static struct slab_cacherbt_node_cache
 

Macro Definition Documentation

◆ CALC_PATH_HASH_LEN

#define CALC_PATH_HASH_LEN ( path,
curr_depth )
Value:
4096 + 1024 * pow(strlen(path), curr_depth)
uint64_t pow(uint64_t base, uint64_t exp)
Definition math.c:3
size_t strlen(const char *s)
Definition str.c:105
kstring path
Definition voxmo.h:7

Definition at line 33 of file vfs.c.

◆ NAME_MAX

#define NAME_MAX   255

Definition at line 30 of file vfs.c.

◆ PATH_MAX

#define PATH_MAX   4096

Definition at line 29 of file vfs.c.

◆ RBT_ID_NAME

#define RBT_ID_NAME   id

Definition at line 24 of file vfs.c.

◆ RBT_TYPE

#define RBT_TYPE   vnode_t

Definition at line 23 of file vfs.c.

◆ VFS_DEBUG

#define VFS_DEBUG   1

Definition at line 28 of file vfs.c.

◆ VFS_MAX_FS

#define VFS_MAX_FS   512

Definition at line 31 of file vfs.c.

◆ VFS_MAX_PATH_CACHE

#define VFS_MAX_PATH_CACHE   512

Definition at line 32 of file vfs.c.

Function Documentation

◆ __attribute__() [1/2]

◆ __attribute__() [2/2]

__attribute__ ( (used, visibility("default"), section(".export")) )

This function handles memory allocation for a new dentry using the slab allocator.

It also links the dentry to its corresponding VNode (if provided).

Note
This function performs lazy initialization of the dentry slab cache if it does not exist yet.
Parameters
nameThe name of the file or directory.
vnodePointer to the associated VNode (inode data). Pass NULL if the VNode is not yet available.
Returns
dentry_ptr A pointer to the newly allocated and initialized dentry.

Definition at line 42 of file vfs.c.

References KERNEL_API, memset(), NIL, rbt_insert_node(), rbt_node_cache, vfs_tree, and vxSlabAlloc().

◆ INIT()

◆ vfs_event_handler()

static void vfs_event_handler ( uint32_t event,
void * data,
void * ctx )
static

Definition at line 362 of file vfs.c.

References data, DEBUG_LEVEL_OK, KDEBUG, LOG2_DEBUG, UNUSED, and VFS_NOTIFY_PROBE.

Referenced by INIT().

◆ vfs_umount()

◆ vfs_umount_recursive()

Variable Documentation

◆ NIL

◆ rbt_node_cache

struct slab_cache* rbt_node_cache
static

Definition at line 39 of file vfs.c.

◆ vfs_tree

rbt_node* vfs_tree
static

Definition at line 38 of file vfs.c.

Referenced by __attribute__(), and INIT().