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 12 typedef void *bcache_t; 13 14 bcache_t bcache_create(bdev_t *dev, size_t block_size, int block_count); 15 void bcache_destroy(bcache_t); 16 17 int bcache_read_block(bcache_t, void *, uint block); 18 19 // get and put a pointer directly to the block 20 int bcache_get_block(bcache_t, void **, uint block); 21 int bcache_put_block(bcache_t, uint block); 22 int bcache_mark_block_dirty(bcache_t priv, uint blocknum); 23 int bcache_zero_block(bcache_t priv, uint blocknum); 24 int bcache_flush(bcache_t priv); 25 void bcache_dump(bcache_t priv, const char *name); 26 27