2 * Copyright (C) 1994-1999, Index Data
4 * Sebastian Hammer, Adam Dickmeiss
6 * $Id: bfile.h,v 1.19 2000-03-15 15:00:30 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 Zebra_lock_rdwr rdwr_lock;
29 struct CFile_struct *cf;
30 } *BFile, BFile_struct;
32 /* bf_close: closes bfile.
33 returns 0 if successful; non-zero otherwise
37 /* bf_open: opens bfile.
38 opens bfile with name 'name' and with 'block_size' as block size.
39 returns bfile handle is successful; NULL otherwise
41 BFile bf_open (BFiles bfs, const char *name, int block_size, int wflag);
43 /* bf_read: reads bytes from bfile 'bf'.
44 reads 'nbytes' bytes (or whole block if 0) from offset 'offset' from
45 block 'no'. stores contents in buffer 'buf'.
46 returns 1 if whole block could be read; 0 otherwise.
48 int bf_read (BFile bf, int no, int offset, int nbytes, void *buf);
50 /* bf_write: writes bytes to bfile 'bf'.
51 writes 'nbytes' bytes (or whole block if 0) at offset 'offset' to
52 block 'no'. retrieves contents from buffer 'buf'.
53 returns 0 if successful; non-zero otherwise.
55 int bf_write (BFile bf, int no, int offset, int nbytes, const void *buf);
57 /* bf_cache: enables bfile cache if spec is not NULL */
58 void bf_cache (BFiles bfs, const char *spec);
60 /* bf_lockDir: specifies locking directory for the cache system */
61 void bf_lockDir (BFiles bfs, const char *lockDir);
63 /* bf_commitExists: returns 1 if commit is pending; 0 otherwise */
64 int bf_commitExists (BFiles bfs);
66 /* bf_commitExec: executes commit */
67 void bf_commitExec (BFiles bfs);
69 /* bf_commitClean: cleans commit files, etc */
70 void bf_commitClean (BFiles bfs, const char *spec);
72 /* bf_reset: delete register and shadow completely */
73 void bf_reset (BFiles bfs);