Using mfile.
[idzebra-moved-to-github.git] / bfile / bfile.c
1 /*
2  * Copyright (C) 1994, Index Data I/S 
3  * All rights reserved.
4  * Sebastian Hammer, Adam Dickmeiss
5  *
6  * $Log: bfile.c,v $
7  * Revision 1.9  1994-08-24 08:45:48  quinn
8  * Using mfile.
9  *
10  * Revision 1.8  1994/08/23  15:03:34  quinn
11  * *** empty log message ***
12  *
13  * Revision 1.7  1994/08/23  14:25:45  quinn
14  * Added O_CREAT because some geek wanted it. Sheesh.
15  *
16  * Revision 1.6  1994/08/23  14:21:38  quinn
17  * Fixed call to log
18  *
19  * Revision 1.5  1994/08/18  08:10:08  quinn
20  * Minimal changes
21  *
22  * Revision 1.4  1994/08/17  14:27:32  quinn
23  * last mods
24  *
25  * Revision 1.2  1994/08/17  14:09:32  quinn
26  * Compiles cleanly (still only dummy).
27  *
28  * Revision 1.1  1994/08/17  13:55:08  quinn
29  * New blocksystem. dummy only
30  *
31  */
32
33 #include <util.h>
34 #include <bfile.h>
35 #include <sys/types.h>
36 #include <fcntl.h>
37 #include <unistd.h>
38 #include <stdlib.h>
39
40 int bf_close (BFile bf)
41 {
42     mf_close(bf->mf);
43     xfree(bf);
44     return(0);
45 }
46
47 BFile bf_open (const char *name, int block_size, int wflag)
48 {
49     BFile tmp = xmalloc(sizeof(BFile_struct));
50
51     if (!(tmp->mf = mf_open(0, name, block_size, wflag)))
52     {
53         log(LOG_FATAL|LOG_ERRNO, "mfopen %s", name); 
54         return(0);
55     }
56     return(tmp);
57 }
58
59 int bf_read (BFile bf, int no, int offset, int num, void *buf)
60 {
61     return mf_read(bf->mf, no, offset, num, buf);
62 }
63
64 int bf_write (BFile bf, int no, int offset, int num, const void *buf)
65 {
66     return mf_write(bf->mf, no, offset, num, buf);
67 }