xref: /haiku/src/tests/add-ons/kernel/file_systems/bfs/btree/cache.h (revision b6f76ebe7153b94820cf35f8db4facc158841abb)
1 #ifndef CACHE_H
2 #define CACHE_H
3 /* cache - emulation for the B+Tree torture test
4 **
5 ** Initial version by Axel Dörfler, axeld@pinc-software.de
6 ** This file may be used under the terms of the MIT License.
7 */
8 
9 
10 #include <SupportDefs.h>
11 
12 class BFile;
13 
14 
15 extern void init_cache(BFile* file, int32 blockSize);
16 extern void shutdown_cache(BFile* file, int32 blockSize);
17 
18 extern status_t cached_write(void* cache, off_t num, const void* _data,
19 	off_t numBlocks);
20 
21 
22 // Block Cache API
23 
24 extern "C" {
25 
26 extern const void* block_cache_get(void* _cache, off_t blockNumber);
27 
28 extern status_t block_cache_make_writable(void* _cache, off_t blockNumber,
29 	int32 transaction);
30 extern void* block_cache_get_writable(void* _cache, off_t blockNumber,
31 	int32 transaction);
32 
33 extern status_t block_cache_set_dirty(void* _cache, off_t blockNumber,
34 	bool dirty, int32 transaction);
35 extern void block_cache_put(void* _cache, off_t blockNumber);
36 
37 } // extern "C"
38 
39 #endif	/* CACHE_H */
40