2 * Copyright (C) 1994-1997, Index Data I/S
4 * Sebastian Hammer, Adam Dickmeiss
7 * Revision 1.8 1997-09-17 12:19:10 adam
8 * Zebra version corresponds to YAZ version 1.4.
9 * Changed Zebra server so that it doesn't depend on global common_resource.
11 * Revision 1.7 1997/09/05 15:30:01 adam
12 * Changed prototype for chr_map_input - added const.
13 * Added support for C++, headers uses extern "C" for public definitions.
15 * Revision 1.6 1996/10/29 13:46:10 adam
16 * Removed obsolete headers alexpath, alexutil. Created zebrautl.h as
19 * Revision 1.5 1995/12/05 11:15:03 quinn
20 * Fixed FILENAME_MAX for some Sun systems, hopefully.
22 * Revision 1.4 1995/11/30 08:33:30 adam
23 * Started work on commit facility.
25 * Revision 1.3 1995/09/04 12:33:35 adam
26 * Various cleanup. YAZ util used instead.
28 * Revision 1.2 1994/09/14 13:10:36 quinn
31 * Revision 1.1 1994/08/23 14:41:46 quinn
32 * First functional version of mfile.
42 #include <sys/param.h>
43 #define FILENAME_MAX MAXPATHLEN
50 #define MF_MIN_BLOCKS_CREAT 1 /* minimum free blocks in new dir */
51 #define MF_MAX_PARTS 28 /* max # of part-files per metafile */
53 #define mf_blocksize(mf) ((mf)->blocksize)
57 char name[FILENAME_MAX+1];
58 int max_bytes; /* allocated bytes in this dir. */
59 int avail_bytes; /* bytes left */
63 typedef struct part_file
74 struct MFile_area_struct;
75 typedef struct MFile_area_struct *MFile_area;
77 typedef struct meta_file
79 char name[FILENAME_MAX+1];
80 part_file files[MF_MAX_PARTS];
83 int open; /* is this file open? */
85 int min_bytes_creat; /* minimum bytes required to enter directory */
89 struct meta_file *next;
92 typedef struct MFile_area_struct
94 char name[FILENAME_MAX+1];
96 struct meta_file *mfiles;
97 struct MFile_area_struct *next; /* global list of active areas */
101 * Open an area, cotaining metafiles in directories.
103 MFile_area mf_init(const char *name, const char *spec);
108 int mf_dispose(MFile_area ma);
113 MFile mf_open(MFile_area ma, const char *name, int block_size, int wflag);
118 int mf_close(MFile mf);
121 * Read one block from a metafile. Interface mirrors bfile.
123 int mf_read(MFile mf, int no, int offset, int num, void *buf);
128 int mf_write(MFile mf, int no, int offset, int num, const void *buf);
131 * Destroy a metafile, unlinking component files. File must be open.
133 int mf_unlink(MFile mf);
136 * Unlink the file by name, rather than MFile-handle.
138 int mf_unlink_name(MFile_area, const char *name);