2 * Copyright (C) 1994-1995, Index Data I/S
4 * Sebastian Hammer, Adam Dickmeiss
7 * Revision 1.7 1997-09-05 15:30:01 adam
8 * Changed prototype for chr_map_input - added const.
9 * Added support for C++, headers uses extern "C" for public definitions.
11 * Revision 1.6 1996/10/29 13:46:10 adam
12 * Removed obsolete headers alexpath, alexutil. Created zebrautl.h as
15 * Revision 1.5 1995/12/05 11:15:03 quinn
16 * Fixed FILENAME_MAX for some Sun systems, hopefully.
18 * Revision 1.4 1995/11/30 08:33:30 adam
19 * Started work on commit facility.
21 * Revision 1.3 1995/09/04 12:33:35 adam
22 * Various cleanup. YAZ util used instead.
24 * Revision 1.2 1994/09/14 13:10:36 quinn
27 * Revision 1.1 1994/08/23 14:41:46 quinn
28 * First functional version of mfile.
38 #include <sys/param.h>
39 #define FILENAME_MAX MAXPATHLEN
46 #define MF_MIN_BLOCKS_CREAT 1 /* minimum free blocks in new dir */
47 #define MF_DEFAULT_AREA "register" /* Use if no mf_init */
48 #define MF_MAX_PARTS 28 /* max # of part-files per metafile */
50 #define mf_blocksize(mf) ((mf)->blocksize)
54 char name[FILENAME_MAX+1];
55 int max_bytes; /* allocated bytes in this dir. */
56 int avail_bytes; /* bytes left */
60 typedef struct part_file
71 struct MFile_area_struct;
72 typedef struct MFile_area_struct *MFile_area;
74 typedef struct meta_file
76 char name[FILENAME_MAX+1];
77 part_file files[MF_MAX_PARTS];
80 int open; /* is this file open? */
82 int min_bytes_creat; /* minimum bytes required to enter directory */
86 struct meta_file *next;
89 typedef struct MFile_area_struct
91 char name[FILENAME_MAX+1];
93 struct meta_file *mfiles;
94 struct MFile_area_struct *next; /* global list of active areas */
98 * Open an area, cotaining metafiles in directories.
100 MFile_area mf_init(const char *name);
105 int mf_dispose(MFile_area ma);
110 MFile mf_open(MFile_area ma, const char *name, int block_size, int wflag);
115 int mf_close(MFile mf);
118 * Read one block from a metafile. Interface mirrors bfile.
120 int mf_read(MFile mf, int no, int offset, int num, void *buf);
125 int mf_write(MFile mf, int no, int offset, int num, const void *buf);
128 * Destroy a metafile, unlinking component files. File must be open.
130 int mf_unlink(MFile mf);
133 * Unlink the file by name, rather than MFile-handle.
135 int mf_unlink_name(MFile_area, const char *name);