revert between 56095 -> 55830 in arch
[AROS.git] / rom / filesys / SFS / FS / cachebuffers.h
blobc39a76ac143e86b1a26ba739eb024a5609046485
1 #ifndef _CACHEBUFFERS_H
2 #define _CACHEBUFFERS_H
4 #include <exec/nodes.h>
5 #include <exec/types.h>
7 struct CacheBuffer {
8 /* Keep the below two structures in this order. There is no support for linking
9 structures in two different lists properly, so to find the start of the CacheBuffer
10 structure in the case of the 2nd MinNode we substract a few bytes from it. */
12 struct MinNode node; // LRU link
13 struct MinNode hashnode; // Linked chain of blocks with same hash value
15 UBYTE locked; // 0 if unlocked.
16 UBYTE bits; /* Bit 0: Set means this block is original.
17 Bit 1: Set means this block is the latest version.
18 Bit 2: Set means that this block has an empty original.
19 Bit 3: Set means that this block was checksummed correctly. */
20 UWORD id; // a 2-byte id code used to check if this really IS a cachebuffer...
22 ULONG blckno; // Partition Blocknumber, or zero if this block isn't in use
24 void *data; /* Make sure this is LONGWORD aligned! */
26 UBYTE attached_data[0];
29 #define CB_ORIGINAL (1)
30 #define CB_LATEST (2)
31 #define CB_EMPTY (4)
32 #define CB_CHECKSUM (8)
35 CB_ORIGINAL : This CacheBuffer contains a block exactly like it is currently on disk.
37 CB_LATEST : This CacheBuffer contains the latest version of a block (ie, including
38 modifications made during a transaction).
40 CB_LATEST | CB_EMPTY : Same as CB_LATEST, but the block has no original version (it was based
41 on an as of yet unallocated block).
43 Other combinations of CB_LATEST, CB_ORIGINAL and CB_EMPTY are invalid.
45 An exception to this rule could be none set at all, which would indicate an unused cachebuffer.
48 #endif // _CACHEBUFFERS_H