1 /* $Id: bfile.h,v 1.1 2004-12-08 12:23:09 adam Exp $
2 Copyright (C) 1995,1996,1997,1998,1999,2000,2001,2002,2003,2004
5 This file is part of the Zebra server.
7 Zebra is free software; you can redistribute it and/or modify it under
8 the terms of the GNU General Public License as published by the Free
9 Software Foundation; either version 2, or (at your option) any later
12 Zebra is distributed in the hope that it will be useful, but WITHOUT ANY
13 WARRANTY; without even the implied warranty of MERCHANTABILITY or
14 FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
17 You should have received a copy of the GNU General Public License
18 along with Zebra; see the file LICENSE.zebra. If not, write to the
19 Free Software Foundation, 59 Temple Place - Suite 330, Boston, MA
26 #include <idzebra/version.h>
30 typedef struct BFiles_struct *BFiles;
31 typedef struct BFile_struct *BFile;
33 BFiles bfs_create (const char *spec, const char *base);
34 void bfs_destroy (BFiles bfiles);
36 /* bf_close: closes bfile.
37 returns 0 if successful; non-zero otherwise
42 /* bf_open: opens bfile.
43 opens bfile with name 'name' and with 'block_size' as block size.
44 returns bfile handle is successful; NULL otherwise
47 BFile bf_open (BFiles bfs, const char *name, int block_size, int wflag);
49 /* bf_read: reads bytes from bfile 'bf'.
50 reads 'nbytes' bytes (or whole block if 0) from offset 'offset' from
51 block 'no'. stores contents in buffer 'buf'.
52 returns 1 if whole block could be read; 0 otherwise.
55 int bf_read (BFile bf, zint no, int offset, int nbytes, void *buf);
57 /* bf_write: writes bytes to bfile 'bf'.
58 writes 'nbytes' bytes (or whole block if 0) at offset 'offset' to
59 block 'no'. retrieves contents from buffer 'buf'.
60 returns 0 if successful; non-zero otherwise.
63 int bf_write (BFile bf, zint no, int offset, int nbytes, const void *buf);
65 /* bf_cache: enables bfile cache if spec is not NULL */
67 void bf_cache (BFiles bfs, const char *spec);
69 /* bf_commitExists: returns 1 if commit is pending; 0 otherwise */
71 int bf_commitExists (BFiles bfs);
73 /* bf_commitExec: executes commit */
75 void bf_commitExec (BFiles bfs);
77 /* bf_commitClean: cleans commit files, etc */
79 void bf_commitClean (BFiles bfs, const char *spec);
81 /* bf_reset: delete register and shadow completely */
83 void bf_reset (BFiles bfs);