2 * Copyright (C) 1994-1995, Index Data I/S
4 * Sebastian Hammer, Adam Dickmeiss
7 * Revision 1.5 1995-12-05 11:15:03 quinn
8 * Fixed FILENAME_MAX for some Sun systems, hopefully.
10 * Revision 1.4 1995/11/30 08:33:30 adam
11 * Started work on commit facility.
13 * Revision 1.3 1995/09/04 12:33:35 adam
14 * Various cleanup. YAZ util used instead.
16 * Revision 1.2 1994/09/14 13:10:36 quinn
19 * Revision 1.1 1994/08/23 14:41:46 quinn
20 * First functional version of mfile.
32 #include <sys/param.h>
33 #define FILENAME_MAX MAXPATHLEN
36 #define MF_MIN_BLOCKS_CREAT 1 /* minimum free blocks in new dir */
37 #define MF_DEFAULT_AREA "register" /* Use if no mf_init */
38 #define MF_MAX_PARTS 28 /* max # of part-files per metafile */
40 #define mf_blocksize(mf) ((mf)->blocksize)
44 char name[FILENAME_MAX+1];
45 int max_bytes; /* allocated bytes in this dir. */
46 int avail_bytes; /* bytes left */
50 typedef struct part_file
61 struct MFile_area_struct;
62 typedef struct MFile_area_struct *MFile_area;
64 typedef struct meta_file
66 char name[FILENAME_MAX+1];
67 part_file files[MF_MAX_PARTS];
70 int open; /* is this file open? */
72 int min_bytes_creat; /* minimum bytes required to enter directory */
76 struct meta_file *next;
79 typedef struct MFile_area_struct
81 char name[FILENAME_MAX+1];
83 struct meta_file *mfiles;
84 struct MFile_area_struct *next; /* global list of active areas */
88 * Open an area, cotaining metafiles in directories.
90 MFile_area mf_init(const char *name);
95 int mf_dispose(MFile_area ma);
100 MFile mf_open(MFile_area ma, const char *name, int block_size, int wflag);
105 int mf_close(MFile mf);
108 * Read one block from a metafile. Interface mirrors bfile.
110 int mf_read(MFile mf, int no, int offset, int num, void *buf);
115 int mf_write(MFile mf, int no, int offset, int num, const void *buf);
118 * Destroy a metafile, unlinking component files. File must be open.
120 int mf_unlink(MFile mf);
123 * Unlink the file by name, rather than MFile-handle.
125 int mf_unlink_name(MFile_area, const char *name);