AquilaOS documentation
How it works, and its code
Loading...
Searching...
No Matches
bcache.h
Go to the documentation of this file.
1#ifndef _FS_BCACHE_H
2#define _FS_BCACHE_H
3
4#include <fs/vfs.h>
5#include <ds/hashmap.h>
6
9struct bcache {
11};
12
13/* Sets up a cache; adds, removes and finds a block by its offset. */
14void bcache_init(struct bcache *bcache);
15int bcache_insert(struct bcache *bcache, uint64_t off, void *data);
16int bcache_remove(struct bcache *bcache, uint64_t off);
17void *bcache_find(struct bcache *bcache, uint64_t off);
18
19MALLOC_DECLARE(M_BCACHE);
20MALLOC_DECLARE(M_CACHE_BLOCK);
21
22#endif /* ! _FS_BCACHE_H */
23
int bcache_remove(struct bcache *bcache, uint64_t off)
Takes a block out of a cache.
Definition bcache.c:73
int bcache_insert(struct bcache *bcache, uint64_t off, void *data)
Adds a block to a cache, which keeps its memory from now on.
Definition bcache.c:48
void * bcache_find(struct bcache *bcache, uint64_t off)
Finds a cached block.
Definition bcache.c:100
void bcache_init(struct bcache *bcache)
Sets up an empty block cache.
Definition bcache.c:35
#define MALLOC_DECLARE(type)
Definition kvmem.h:29
unsigned long long int uint64_t
Definition stddef.h:23
A filesystem's block cache (fs/bcache.c): its blocks that were read, by their offset.
Definition bcache.h:9
struct hashmap * hashmap
Definition bcache.h:10