Started work on commit facility.
[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.1  1995-11-30 08:33:12  adam
8  * Started work on commit facility.
9  *
10  */
11
12 #ifndef CFILE_H
13 #define CFILE_H
14
15 #define HASH_BUCKET 63
16
17 struct CFile_hash_bucket {
18     struct CFile_ph_bucket {
19         int no[HASH_BUCKET];
20         int vno[HASH_BUCKET];
21         int this_bucket;
22         int next_bucket;
23     } ph;
24     int dirty;
25     struct CFile_hash_bucket *h_next, **h_prev;
26     struct CFile_hash_bucket *lru_next, *lru_prev;
27 };
28
29 #define HASH_BSIZE sizeof(struct CFile_ph_bucket)
30
31 typedef struct CFile_struct
32 {
33     struct CFile_head {
34         int hash_size;
35         int next_bucket;
36         int next_block;
37         int block_size;
38     } head;
39     int block_fd;
40     int hash_fd;
41     int *array;
42     struct CFile_hash_bucket **parray;
43     struct CFile_hash_bucket *bucket_lru_front, *bucket_lru_back;
44     int dirty;
45     int bucket_in_memory;
46     int max_bucket_in_memory;
47     char *iobuf;
48     MFile mf;
49 } *CFile;
50
51 int cf_close (CFile cf);
52 CFile cf_open (MFile mf, const char *cname, const char *fname,
53                int block_size, int wflag, int *firstp);
54 int cf_read (CFile cf, int no, int offset, int num, void *buf);
55 int cf_write (CFile cf, int no, int offset, int num, const void *buf);
56 void cf_commit (CFile cf);
57
58 #endif