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
7
static
struct
slab_cache
*
vnode_cache
= 0;
8
static
uint64_t
vnode_id
= 0;
9
10
INIT
(Vnode) {
11
LOG_INFO
(
"vnode"
,
"init"
);
12
vxCreateSlabCache
(&
vnode_cache
,
"vnode"
,
sizeof
(
vnode_t
), 64, 0);
13
}
14
15
vnode_ptr_t
KERNEL_API
create_vnode() {
16
auto
vnode
= (
vnode_t
*)
vxSlabAlloc
(
vnode_cache
);
17
memset
(
vnode
, 0,
sizeof
(*
vnode
));
18
vnode
->
id
=
vnode_id
++;
19
return
vnode
;
20
}
21
22
void
KERNEL_API
vxFreeVnode
(
vnode_ptr_t
vnode
) {
23
slab_free
(
vnode_cache
,
vnode
);
24
}
vnode_ptr_t
struct vnode * vnode_ptr_t
Definition
dentry.h:115
vnode_t
struct vnode vnode_t
Definition
filesystem.h:10
init.h
INIT
#define INIT(fn)
Definition
init.h:26
serial.h
LOG_INFO
#define LOG_INFO(mod, fmt,...)
Definition
serial.h:20
vxSlabAlloc
void * vxSlabAlloc(struct slab_cache *cache)
Definition
slab.c:93
slab_free
void slab_free(struct slab_cache *cache, void *obj)
Definition
slab.c:235
vxCreateSlabCache
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
slab.h
str.h
memset
void memset(void *ptr, int value, size_t num)
slab_cache
Definition
slab.h:18
vnode
Definition
vnode.h:59
vnode::id
vnode_id_t id
Definition
vnode.h:61
KERNEL_API
#define KERNEL_API
Definition
type.h:93
uint64_t
unsigned long uint64_t
Definition
type.h:25
vnode_id
static uint64_t vnode_id
Definition
vnode.c:8
vnode_cache
static struct slab_cache * vnode_cache
Definition
vnode.c:7
vnode.h
vxFreeVnode
void vxFreeVnode(vnode_ptr_t vnode)
kernel
vfs
vnode.c
Generated on Sat May 30 2026 11:09:57 for Voxia OS by
1.13.2