2 * Simple and Quick Shared Memory Cache
4 * (c) 2005 Martin Mares <mj@ucw.cz>
7 #include "sherlock/sherlock.h"
11 /* FIXME: do we really need to msync() the regions on Linux? */
16 * qache_entry[max_entries] table of entries and their keys
17 * u32 qache_hash[hash_size] hash table pointing to keys
18 * padding to a multiple of block size
19 * blocks[] data blocks, each block starts with u32 next_ptr
23 u32 magic; /* QCACHE_MAGIC */
24 u32 block_size; /* Parameters as in qache_params */
27 u32 entry_table_start; /* Array of qache_entry's */
29 u32 hash_table_start; /* Hash table containing all keys */
31 u32 lru_first; /* First entry in the LRU */
32 u32 first_free_entry; /* Head of the list of free entries */
33 u32 first_free_block; /* Head of the list of free blocks */
36 #define QACHE_MAGIC 0xb79f6d12
39 u32 lru_prev, lru_next;
40 u32 data_len; /* ~0 if a free entry */
41 u32 first_data_block; /* next free if a free entry */
47 struct qache_header *hdr;