2 Copyright © 2010-2015, The AROS Development Team. All rights reserved.
11 #include <exec/types.h>
12 #include <exec/lists.h>
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 */
20 ULONG num
; /* start block number */
21 UBYTE
*data
; /* actual block data */
26 struct ExecBase
*sys_base
;
27 struct DosLibrary
*dos_base
;
28 APTR priv
; /* private data sent to AccessDisk() */
29 ULONG block_count
; /* number of blocks allocated */
30 ULONG block_size
; /* size of a disk block */
31 ULONG hash_size
; /* size of hash table */
32 struct BlockRange
**blocks
; /* array of pointers to all blocks */
33 struct MinList
*hash_table
; /* hash table of all valid cache blocks */
34 struct MinList dirty_list
; /* the dirty list */
35 struct MinList free_list
; /* the free list */
46 APTR
Cache_CreateCache(APTR priv
, ULONG hash_size
, ULONG block_count
,
47 ULONG block_size
, struct ExecBase
*sys_base
, struct DosLibrary
*dos_base
);
48 VOID
Cache_DestroyCache(APTR cache
);
49 APTR
Cache_GetBlock(APTR cache
, ULONG blockNum
, UBYTE
**data
);
50 VOID
Cache_FreeBlock(APTR cache
, APTR block
);
51 VOID
Cache_MarkBlockDirty(APTR cache
, APTR block
);
52 BOOL
Cache_Flush(APTR cache
);
54 LONG
AccessDisk(BOOL do_write
, ULONG num
, ULONG nblocks
, ULONG block_size
,
55 UBYTE
*data
, APTR priv
);