2 * Copyright (C) 1995-1999, Index Data
4 * Sebastian Hammer, Adam Dickmeiss
6 * $Id: cfile.h,v 1.12 1999-05-26 07:49:12 adam Exp $
16 #define HASH_BUCKET 15
18 struct CFile_ph_bucket { /* structure on disc */
19 int no[HASH_BUCKET]; /* block number in original file */
20 int vno[HASH_BUCKET]; /* block number in shadow file */
21 int this_bucket; /* this bucket number */
22 int next_bucket; /* next bucket number */
25 struct CFile_hash_bucket {
26 struct CFile_ph_bucket ph;
28 struct CFile_hash_bucket *h_next, **h_prev;
29 struct CFile_hash_bucket *lru_next, *lru_prev;
32 #define HASH_BSIZE sizeof(struct CFile_ph_bucket)
36 typedef struct CFile_struct
39 int state; /* 1 = hash, 2 = flat */
40 int next_block; /* next free block / last block */
41 int block_size; /* mfile/bfile block size */
42 int hash_size; /* no of chains in hash table */
43 int first_bucket; /* first hash bucket */
44 int next_bucket; /* last hash bucket + 1 = first flat bucket */
45 int flat_bucket; /* last flat bucket + 1 */
50 struct CFile_hash_bucket **parray;
51 struct CFile_hash_bucket *bucket_lru_front, *bucket_lru_back;
54 int max_bucket_in_memory;
61 int cf_close (CFile cf);
62 CFile cf_open (MFile mf, MFile_area area, const char *fname, int block_size,
63 int wflag, int *firstp);
64 int cf_read (CFile cf, int no, int offset, int nbytes, void *buf);
65 int cf_write (CFile cf, int no, int offset, int nbytes, const void *buf);
66 void cf_unlink (CFile cf);
67 void cf_commit (CFile cf);