Changed logging a bit.
[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.8  1996-04-18 16:02:56  adam
8  * Changed logging a bit.
9  * Removed warning message when commiting flat shadow files.
10  *
11  * Revision 1.7  1996/02/07  14:03:48  adam
12  * Work on flat indexed shadow files.
13  *
14  * Revision 1.6  1996/02/07  10:08:45  adam
15  * Work on flat shadow (not finished yet).
16  *
17  * Revision 1.5  1995/12/15  12:36:52  adam
18  * Moved hash file information to union.
19  * Renamed commit files.
20  *
21  * Revision 1.4  1995/12/11  09:03:54  adam
22  * New function: cf_unlink.
23  * New member of commit file head: state (0) deleted, (1) hash file.
24  *
25  * Revision 1.3  1995/12/01  16:24:29  adam
26  * Commit files use separate meta file area.
27  *
28  * Revision 1.2  1995/12/01  11:37:23  adam
29  * Cached/commit files implemented as meta-files.
30  *
31  * Revision 1.1  1995/11/30  08:33:12  adam
32  * Started work on commit facility.
33  *
34  */
35
36 #ifndef CFILE_H
37 #define CFILE_H
38
39 #define HASH_BUCKET 15
40
41 struct CFile_hash_bucket {
42     struct CFile_ph_bucket {
43         int no[HASH_BUCKET];
44         int vno[HASH_BUCKET];
45         int this_bucket;
46         int next_bucket;
47     } ph;
48     int dirty;
49     struct CFile_hash_bucket *h_next, **h_prev;
50     struct CFile_hash_bucket *lru_next, *lru_prev;
51 };
52
53 #define HASH_BSIZE sizeof(struct CFile_ph_bucket)
54
55 #define CFILE_FLAT 1
56
57 typedef struct CFile_struct
58 {
59     struct CFile_head {
60         int state;
61         int next_block;
62         int block_size;
63         int hash_size;
64         int first_bucket;
65         int next_bucket;
66         int flat_bucket;
67     } head;
68     MFile block_mf;
69     MFile hash_mf;
70     int *array;
71     struct CFile_hash_bucket **parray;
72     struct CFile_hash_bucket *bucket_lru_front, *bucket_lru_back;
73     int dirty;
74     int bucket_in_memory;
75     int max_bucket_in_memory;
76     char *iobuf;
77     MFile rmf;
78     int  no_hits;
79     int  no_miss;
80 } *CFile;
81
82 int cf_close (CFile cf);
83 CFile cf_open (MFile mf, MFile_area area, const char *fname, int block_size,
84                int wflag, int *firstp);
85 int cf_read (CFile cf, int no, int offset, int num, void *buf);
86 int cf_write (CFile cf, int no, int offset, int num, const void *buf);
87 void cf_unlink (CFile cf);
88 void cf_commit (CFile cf);
89
90 #endif