2 * Copyright (C) 1995-1999, Index Data
4 * Sebastian Hammer, Adam Dickmeiss
6 * $Id: cfile.h,v 1.11 1999-05-12 13:08:06 adam Exp $
12 #define HASH_BUCKET 15
14 struct CFile_ph_bucket { /* structure on disc */
15 int no[HASH_BUCKET]; /* block number in original file */
16 int vno[HASH_BUCKET]; /* block number in shadow file */
17 int this_bucket; /* this bucket number */
18 int next_bucket; /* next bucket number */
21 struct CFile_hash_bucket {
22 struct CFile_ph_bucket ph;
24 struct CFile_hash_bucket *h_next, **h_prev;
25 struct CFile_hash_bucket *lru_next, *lru_prev;
28 #define HASH_BSIZE sizeof(struct CFile_ph_bucket)
32 typedef struct CFile_struct
35 int state; /* 1 = hash, 2 = flat */
36 int next_block; /* next free block / last block */
37 int block_size; /* mfile/bfile block size */
38 int hash_size; /* no of chains in hash table */
39 int first_bucket; /* first hash bucket */
40 int next_bucket; /* last hash bucket + 1 = first flat bucket */
41 int flat_bucket; /* last flat bucket + 1 */
46 struct CFile_hash_bucket **parray;
47 struct CFile_hash_bucket *bucket_lru_front, *bucket_lru_back;
50 int max_bucket_in_memory;
57 int cf_close (CFile cf);
58 CFile cf_open (MFile mf, MFile_area area, const char *fname, int block_size,
59 int wflag, int *firstp);
60 int cf_read (CFile cf, int no, int offset, int nbytes, void *buf);
61 int cf_write (CFile cf, int no, int offset, int nbytes, const void *buf);
62 void cf_unlink (CFile cf);
63 void cf_commit (CFile cf);