2 * Copyright (C) 1994-1999, Index Data
4 * Sebastian Hammer, Adam Dickmeiss
6 * $Id: bfile.h,v 1.17 1999-05-12 13:08:06 adam Exp $
18 #define bf_blocksize(bf) mf_blocksize(bf->mf)
20 typedef struct BFiles_struct *BFiles;
22 BFiles bfs_create (const char *spec);
23 void bfs_destroy (BFiles bfiles);
25 typedef struct BFile_struct
28 struct CFile_struct *cf;
29 } *BFile, BFile_struct;
31 /* bf_close: closes bfile.
32 returns 0 if successful; non-zero otherwise
36 /* bf_open: opens bfile.
37 opens bfile with name 'name' and with 'block_size' as block size.
38 returns bfile handle is successful; NULL otherwise
40 BFile bf_open (BFiles bfs, const char *name, int block_size, int wflag);
42 /* bf_read: reads bytes from bfile 'bf'.
43 reads 'nbytes' bytes (or whole block if 0) from offset 'offset' from
44 block 'no'. stores contents in buffer 'buf'.
45 returns 1 if whole block could be read; 0 otherwise.
47 int bf_read (BFile bf, int no, int offset, int nbytes, void *buf);
49 /* bf_write: writes bytes to bfile 'bf'.
50 writes 'nbytes' bytes (or whole block if 0) at offset 'offset' to
51 block 'no'. retrieves contents from buffer 'buf'.
52 returns 0 if successful; non-zero otherwise.
54 int bf_write (BFile bf, int no, int offset, int nbytes, const void *buf);
56 /* bf_cache: enables bfile cache if spec is not NULL */
57 void bf_cache (BFiles bfs, const char *spec);
59 /* bf_lockDir: specifies locking directory for the cache system */
60 void bf_lockDir (BFiles bfs, const char *lockDir);
62 /* bf_commitExists: returns 1 if commit is pending; 0 otherwise */
63 int bf_commitExists (BFiles bfs);
65 /* bf_commitExec: executes commit */
66 void bf_commitExec (BFiles bfs);
68 /* bf_commitClean: cleans commit files, etc */
69 void bf_commitClean (BFiles bfs, const char *spec);