2 * Sherlock Library -- Fast Database Management Routines -- Internal Declarations
4 * (c) 1999 Martin Mares <mj@atrey.karlin.mff.cuni.cz>
7 #define SDBM_NUM_FREE_PAGE_POOLS 32
12 u32 page_order; /* Binary logarithm of page size */
13 s32 key_size; /* Key/val size, -1=variable */
15 u32 dir_start; /* First page of the page directory */
16 u32 dir_order; /* Binary logarithm of directory size */
18 * As we know the only thing which can be freed is the page directory
19 * and it can grow only a limited number of times, we can use a very
20 * simple-minded representation of the free page pool. We also assume
21 * these entries are sorted by start position.
26 } free_pool[SDBM_NUM_FREE_PAGE_POOLS];
30 u32 used; /* Bytes used in this bucket */
35 struct page_cache *cache;
37 struct sdbm_root *root;
38 struct page *root_page;
39 int key_size; /* Cached values from root page */
43 uns page_mask; /* page_size - 1 */
44 uns dir_size; /* Page directory size in entries */
45 uns dir_shift; /* Number of significant bits of hash function */
48 uns find_pos; /* Current pointer for sdbm_find_next() */
49 uns find_free_list; /* First free list entry not skipped by sdbm_find_next() */
52 #define SDBM_MAGIC 0x5344424d
53 #define SDBM_VERSION 1
55 #define GET32(p,o) *((u32 *)((p)+(o)))