Voxia OS v0.0.1
Hobby Project Operating System Targeting x86-64
Loading...
Searching...
No Matches
vnode.c
Go to the documentation of this file.
1#include "vfs/vnode.h"
2#include "init/init.h"
3#include "libk/serial.h"
4#include "memory/slab.h"
5#include <str.h>
6
7static struct slab_cache* vnode_cache = 0;
8static uint64_t vnode_id = 0;
9
10INIT(Vnode) {
11 LOG_INFO("vnode", "init");
12 vxCreateSlabCache(&vnode_cache, "vnode", sizeof(vnode_t), 64, 0);
13}
14
15vnode_ptr_t KERNEL_API create_vnode() {
17 memset(vnode, 0, sizeof(*vnode));
18 vnode->id = vnode_id++;
19 return vnode;
20}
21
24}
struct vnode * vnode_ptr_t
Definition dentry.h:115
struct vnode vnode_t
Definition filesystem.h:10
#define INIT(fn)
Definition init.h:26
#define LOG_INFO(mod, fmt,...)
Definition serial.h:20
void * vxSlabAlloc(struct slab_cache *cache)
Definition slab.c:93
void slab_free(struct slab_cache *cache, void *obj)
Definition slab.c:235
void vxCreateSlabCache(struct slab_cache **cache, const char *name, const size_t obj_size, size_t alignment, const uintptr_t virt_addr)
Definition slab.c:44
void memset(void *ptr, int value, size_t num)
Definition vnode.h:59
vnode_id_t id
Definition vnode.h:61
#define KERNEL_API
Definition type.h:93
unsigned long uint64_t
Definition type.h:25
static uint64_t vnode_id
Definition vnode.c:8
static struct slab_cache * vnode_cache
Definition vnode.c:7
void vxFreeVnode(vnode_ptr_t vnode)