2 * Copyright (C) 1994-1997, Index Data I/S
4 * Sebastian Hammer, Adam Dickmeiss
7 * Revision 1.9 1997-09-18 08:59:19 adam
8 * Extra generic handle for the character mapping routines.
10 * Revision 1.8 1997/09/17 12:19:10 adam
11 * Zebra version corresponds to YAZ version 1.4.
12 * Changed Zebra server so that it doesn't depend on global common_resource.
14 * Revision 1.7 1997/09/05 15:30:01 adam
15 * Changed prototype for chr_map_input - added const.
16 * Added support for C++, headers uses extern "C" for public definitions.
18 * Revision 1.6 1996/10/29 13:46:10 adam
19 * Removed obsolete headers alexpath, alexutil. Created zebrautl.h as
22 * Revision 1.5 1995/12/05 11:15:03 quinn
23 * Fixed FILENAME_MAX for some Sun systems, hopefully.
25 * Revision 1.4 1995/11/30 08:33:30 adam
26 * Started work on commit facility.
28 * Revision 1.3 1995/09/04 12:33:35 adam
29 * Various cleanup. YAZ util used instead.
31 * Revision 1.2 1994/09/14 13:10:36 quinn
34 * Revision 1.1 1994/08/23 14:41:46 quinn
35 * First functional version of mfile.
45 #include <sys/param.h>
46 #define FILENAME_MAX MAXPATHLEN
53 #define MF_MIN_BLOCKS_CREAT 1 /* minimum free blocks in new dir */
54 #define MF_MAX_PARTS 28 /* max # of part-files per metafile */
56 #define mf_blocksize(mf) ((mf)->blocksize)
60 char name[FILENAME_MAX+1];
61 int max_bytes; /* allocated bytes in this dir. */
62 int avail_bytes; /* bytes left */
66 typedef struct part_file
77 struct MFile_area_struct;
78 typedef struct MFile_area_struct *MFile_area;
80 typedef struct meta_file
82 char name[FILENAME_MAX+1];
83 part_file files[MF_MAX_PARTS];
86 int open; /* is this file open? */
88 int min_bytes_creat; /* minimum bytes required to enter directory */
92 struct meta_file *next;
95 typedef struct MFile_area_struct
97 char name[FILENAME_MAX+1];
99 struct meta_file *mfiles;
100 struct MFile_area_struct *next; /* global list of active areas */
104 * Open an area, cotaining metafiles in directories.
106 MFile_area mf_init(const char *name, const char *spec);
111 void mf_destroy(MFile_area ma);
116 MFile mf_open(MFile_area ma, const char *name, int block_size, int wflag);
121 int mf_close(MFile mf);
124 * Read one block from a metafile. Interface mirrors bfile.
126 int mf_read(MFile mf, int no, int offset, int num, void *buf);
131 int mf_write(MFile mf, int no, int offset, int num, const void *buf);
134 * Destroy a metafile, unlinking component files. File must be open.
136 int mf_unlink(MFile mf);
139 * Unlink the file by name, rather than MFile-handle.
141 int mf_unlink_name(MFile_area, const char *name);