AquilaOS documentation
How it works, and its code
Loading...
Searching...
No Matches
vcache.h
Go to the documentation of this file.
1#ifndef _FS_VCACHE_H
2#define _FS_VCACHE_H
3
4#include <fs/vfs.h>
5#include <ds/hashmap.h>
6
10struct vcache {
12};
13
14/* Sets up a cache; adds, removes and finds a vnode. */
15void vcache_init(struct vcache *vcache);
16int vcache_insert(struct vcache *vcache, struct vnode *vnode);
17int vcache_remove(struct vcache *vcache, struct vnode *vnode);
18struct vnode *vcache_find(struct vcache *vcache, ino_t ino);
19
20MALLOC_DECLARE(M_VCACHE);
21
22#endif /* ! _FS_VCACHE_H */
#define MALLOC_DECLARE(type)
Definition kvmem.h:29
A filesystem's vnode cache (fs/vcache.c): its vnodes in memory, by their inode number,...
Definition vcache.h:10
struct hashmap * hashmap
Definition vcache.h:11
A file in memory (a vnode): what its inode says, and the kernel's own state.
Definition vfs.h:113
ino_t ino
Definition vfs.h:114
uintptr_t ino_t
Definition types.h:23
void vcache_init(struct vcache *vcache)
Sets up an empty vnode cache.
Definition vcache.c:25
struct vnode * vcache_find(struct vcache *vcache, ino_t ino)
Finds the cached vnode of an inode.
Definition vcache.c:80
int vcache_insert(struct vcache *vcache, struct vnode *vnode)
Adds a vnode to a cache.
Definition vcache.c:37
int vcache_remove(struct vcache *vcache, struct vnode *vnode)
Takes a vnode out of a cache.
Definition vcache.c:56