AquilaOS documentation
How it works, and its code
Toggle main menu visibility
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
9
struct
bcache
{
10
struct
hashmap
*
hashmap
;
11
};
12
13
/* Sets up a cache; adds, removes and finds a block by its offset. */
14
void
bcache_init
(
struct
bcache
*
bcache
);
15
int
bcache_insert
(
struct
bcache
*
bcache
,
uint64_t
off,
void
*data);
16
int
bcache_remove
(
struct
bcache
*
bcache
,
uint64_t
off);
17
void
*
bcache_find
(
struct
bcache
*
bcache
,
uint64_t
off);
18
19
MALLOC_DECLARE
(M_BCACHE);
20
MALLOC_DECLARE
(M_CACHE_BLOCK);
21
22
#endif
/* ! _FS_BCACHE_H */
23
bcache_remove
int bcache_remove(struct bcache *bcache, uint64_t off)
Takes a block out of a cache.
Definition
bcache.c:73
bcache_insert
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
bcache_find
void * bcache_find(struct bcache *bcache, uint64_t off)
Finds a cached block.
Definition
bcache.c:100
bcache_init
void bcache_init(struct bcache *bcache)
Sets up an empty block cache.
Definition
bcache.c:35
hashmap.h
MALLOC_DECLARE
#define MALLOC_DECLARE(type)
Definition
kvmem.h:29
uint64_t
unsigned long long int uint64_t
Definition
stddef.h:23
bcache
A filesystem's block cache (fs/bcache.c): its blocks that were read, by their offset.
Definition
bcache.h:9
bcache::hashmap
struct hashmap * hashmap
Definition
bcache.h:10
vfs.h
kernel
include
fs
bcache.h
Generated by
1.18.0