Commit files use separate meta file area.
[idzebra-moved-to-github.git] / bfile / cfile.h
1 /*
2  * Copyright (C) 1995, Index Data I/S 
3  * All rights reserved.
4  * Sebastian Hammer, Adam Dickmeiss
5  *
6  * $Log: cfile.h,v $
7  * Revision 1.3  1995-12-01 16:24:29  adam
8  * Commit files use separate meta file area.
9  *
10  * Revision 1.2  1995/12/01  11:37:23  adam
11  * Cached/commit files implemented as meta-files.
12  *
13  * Revision 1.1  1995/11/30  08:33:12  adam
14  * Started work on commit facility.
15  *
16  */
17
18 #ifndef CFILE_H
19 #define CFILE_H
20
21 #define HASH_BUCKET 63
22
23 struct CFile_hash_bucket {
24     struct CFile_ph_bucket {
25         int no[HASH_BUCKET];
26         int vno[HASH_BUCKET];
27         int this_bucket;
28         int next_bucket;
29     } ph;
30     int dirty;
31     struct CFile_hash_bucket *h_next, **h_prev;
32     struct CFile_hash_bucket *lru_next, *lru_prev;
33 };
34
35 #define HASH_BSIZE sizeof(struct CFile_ph_bucket)
36
37 typedef struct CFile_struct
38 {
39     struct CFile_head {
40         int hash_size;
41         int next_bucket;
42         int next_block;
43         int block_size;
44     } head;
45     MFile block_mf;
46     MFile hash_mf;
47     int *array;
48     struct CFile_hash_bucket **parray;
49     struct CFile_hash_bucket *bucket_lru_front, *bucket_lru_back;
50     int dirty;
51     int bucket_in_memory;
52     int max_bucket_in_memory;
53     char *iobuf;
54     MFile rmf;
55 } *CFile;
56
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 num, void *buf);
61 int cf_write (CFile cf, int no, int offset, int num, const void *buf);
62 void cf_commit (CFile cf);
63
64 #endif