2 * Copyright (C) 1994-1995, Index Data I/S
4 * Sebastian Hammer, Adam Dickmeiss
7 * Revision 1.6 1996-10-29 13:46:10 adam
8 * Removed obsolete headers alexpath, alexutil. Created zebrautl.h as
11 * Revision 1.5 1995/12/05 11:15:03 quinn
12 * Fixed FILENAME_MAX for some Sun systems, hopefully.
14 * Revision 1.4 1995/11/30 08:33:30 adam
15 * Started work on commit facility.
17 * Revision 1.3 1995/09/04 12:33:35 adam
18 * Various cleanup. YAZ util used instead.
20 * Revision 1.2 1994/09/14 13:10:36 quinn
23 * Revision 1.1 1994/08/23 14:41:46 quinn
24 * First functional version of mfile.
34 #include <sys/param.h>
35 #define FILENAME_MAX MAXPATHLEN
38 #define MF_MIN_BLOCKS_CREAT 1 /* minimum free blocks in new dir */
39 #define MF_DEFAULT_AREA "register" /* Use if no mf_init */
40 #define MF_MAX_PARTS 28 /* max # of part-files per metafile */
42 #define mf_blocksize(mf) ((mf)->blocksize)
46 char name[FILENAME_MAX+1];
47 int max_bytes; /* allocated bytes in this dir. */
48 int avail_bytes; /* bytes left */
52 typedef struct part_file
63 struct MFile_area_struct;
64 typedef struct MFile_area_struct *MFile_area;
66 typedef struct meta_file
68 char name[FILENAME_MAX+1];
69 part_file files[MF_MAX_PARTS];
72 int open; /* is this file open? */
74 int min_bytes_creat; /* minimum bytes required to enter directory */
78 struct meta_file *next;
81 typedef struct MFile_area_struct
83 char name[FILENAME_MAX+1];
85 struct meta_file *mfiles;
86 struct MFile_area_struct *next; /* global list of active areas */
90 * Open an area, cotaining metafiles in directories.
92 MFile_area mf_init(const char *name);
97 int mf_dispose(MFile_area ma);
102 MFile mf_open(MFile_area ma, const char *name, int block_size, int wflag);
107 int mf_close(MFile mf);
110 * Read one block from a metafile. Interface mirrors bfile.
112 int mf_read(MFile mf, int no, int offset, int num, void *buf);
117 int mf_write(MFile mf, int no, int offset, int num, const void *buf);
120 * Destroy a metafile, unlinking component files. File must be open.
122 int mf_unlink(MFile mf);
125 * Unlink the file by name, rather than MFile-handle.
127 int mf_unlink_name(MFile_area, const char *name);