cpu.resource(pc-i386) Get this compile again, with acpica.library
[AROS.git] / workbench / fs / ntfs / cache.h
blob812d036c44b84aecb85711944aca9c112d1fea52
1 /*
2 Copyright © 2010, The AROS Development Team. All rights reserved.
3 $Id: cache.h 33098 2010-04-26 16:58:12Z neil $
5 Disk cache.
6 */
8 #ifndef CACHE_H
9 #define CACHE_H
11 #include <exec/types.h>
12 #include <exec/lists.h>
14 struct BlockRange
16 struct MinNode node1; /* links into hash table */
17 struct MinNode node2; /* links into free and dirty lists */
18 ULONG use_count; /* number of users of this block */
19 UWORD state;
20 ULONG num; /* start block number */
21 UBYTE *data; /* actual block data */
24 struct Cache
26 ULONG block_count; /* number of blocks allocated */
27 ULONG block_size; /* size of a disk block */
28 ULONG hash_size; /* size of hash table */
29 struct BlockRange **blocks; /* array of pointers to all blocks */
30 struct MinList *hash_table; /* hash table of all valid cache blocks */
31 struct MinList dirty_list; /* the dirty list */
32 struct MinList free_list; /* the free list */
35 /* Block states */
37 #define BS_EMPTY 0
38 #define BS_VALID 1
39 #define BS_DIRTY 2
41 /* Prototypes */
43 APTR Cache_CreateCache(ULONG hash_size, ULONG block_count, ULONG block_size);
44 VOID Cache_DestroyCache(APTR cache);
45 APTR Cache_GetBlock(APTR cache, UQUAD blockNum, UBYTE **data);
46 VOID Cache_FreeBlock(APTR cache, APTR block);
47 VOID Cache_MarkBlockDirty(APTR cache, APTR block);
48 BOOL Cache_Flush(APTR cache);
50 #endif