2 * Copyright (C) 1994-1999, Index Data
4 * Sebastian Hammer, Adam Dickmeiss
7 * Revision 1.10 1999-02-02 14:50:35 adam
8 * Updated WIN32 code specific sections. Changed header.
10 * Revision 1.9 1997/09/18 08:59:19 adam
11 * Extra generic handle for the character mapping routines.
13 * Revision 1.8 1997/09/17 12:19:10 adam
14 * Zebra version corresponds to YAZ version 1.4.
15 * Changed Zebra server so that it doesn't depend on global common_resource.
17 * Revision 1.7 1997/09/05 15:30:01 adam
18 * Changed prototype for chr_map_input - added const.
19 * Added support for C++, headers uses extern "C" for public definitions.
21 * Revision 1.6 1996/10/29 13:46:10 adam
22 * Removed obsolete headers alexpath, alexutil. Created zebrautl.h as
25 * Revision 1.5 1995/12/05 11:15:03 quinn
26 * Fixed FILENAME_MAX for some Sun systems, hopefully.
28 * Revision 1.4 1995/11/30 08:33:30 adam
29 * Started work on commit facility.
31 * Revision 1.3 1995/09/04 12:33:35 adam
32 * Various cleanup. YAZ util used instead.
34 * Revision 1.2 1994/09/14 13:10:36 quinn
37 * Revision 1.1 1994/08/23 14:41:46 quinn
38 * First functional version of mfile.
48 #include <sys/param.h>
49 #define FILENAME_MAX MAXPATHLEN
56 #define MF_MIN_BLOCKS_CREAT 1 /* minimum free blocks in new dir */
57 #define MF_MAX_PARTS 28 /* max # of part-files per metafile */
59 #define mf_blocksize(mf) ((mf)->blocksize)
63 char name[FILENAME_MAX+1];
64 int max_bytes; /* allocated bytes in this dir. */
65 int avail_bytes; /* bytes left */
69 typedef struct part_file
80 struct MFile_area_struct;
81 typedef struct MFile_area_struct *MFile_area;
83 typedef struct meta_file
85 char name[FILENAME_MAX+1];
86 part_file files[MF_MAX_PARTS];
89 int open; /* is this file open? */
91 int min_bytes_creat; /* minimum bytes required to enter directory */
95 struct meta_file *next;
98 typedef struct MFile_area_struct
100 char name[FILENAME_MAX+1];
102 struct meta_file *mfiles;
103 struct MFile_area_struct *next; /* global list of active areas */
107 * Open an area, cotaining metafiles in directories.
109 MFile_area mf_init(const char *name, const char *spec);
114 void mf_destroy(MFile_area ma);
119 MFile mf_open(MFile_area ma, const char *name, int block_size, int wflag);
124 int mf_close(MFile mf);
127 * Read one block from a metafile. Interface mirrors bfile.
129 int mf_read(MFile mf, int no, int offset, int num, void *buf);
134 int mf_write(MFile mf, int no, int offset, int num, const void *buf);
137 * Destroy a metafile, unlinking component files. File must be open.
139 int mf_unlink(MFile mf);
142 * Unlink the file by name, rather than MFile-handle.
144 int mf_unlink_name(MFile_area, const char *name);