1 /*
2  * Copyright (c) 2007 Travis Geiselbrecht
3  *
4  * Use of this source code is governed by a MIT-style
5  * license that can be found in the LICENSE file or at
6  * https://opensource.org/licenses/MIT
7  */
8 #pragma once
9 
10 #include <lib/bio.h>
11 #include <lk/compiler.h>
12 
13 __BEGIN_CDECLS
14 
15 typedef void *bcache_t;
16 
17 bcache_t bcache_create(bdev_t *dev, size_t block_size, int block_count);
18 void bcache_destroy(bcache_t);
19 
20 int bcache_read_block(bcache_t, void *, uint block);
21 
22 // get and put a pointer directly to the block
23 int bcache_get_block(bcache_t, void **, uint block);
24 int bcache_put_block(bcache_t, uint block);
25 int bcache_mark_block_dirty(bcache_t priv, uint blocknum);
26 int bcache_zero_block(bcache_t priv, uint blocknum);
27 int bcache_flush(bcache_t priv);
28 void bcache_dump(bcache_t priv, const char *name);
29 
30 __END_CDECLS
31