2 * Copyright (C) 1994, Index Data I/S
4 * Sebastian Hammer, Adam Dickmeiss
7 * Revision 1.3 1995-09-04 12:33:35 adam
8 * Various cleanup. YAZ util used instead.
10 * Revision 1.2 1994/09/14 13:10:36 quinn
13 * Revision 1.1 1994/08/23 14:41:46 quinn
14 * First functional version of mfile.
25 #define MF_MIN_BLOCKS_CREAT 1 /* minimum free blocks in new dir */
26 #define MF_DEFAULT_AREA "register" /* Use if no mf_init */
27 #define MF_MAX_PARTS 28 /* max # of part-files per metafile */
29 #define mf_blocksize(mf) ((mf)->blocksize)
33 char name[FILENAME_MAX+1];
34 int max_bytes; /* allocated bytes in this dir. */
35 int avail_bytes; /* bytes left */
39 typedef struct part_file
50 struct MFile_area_struct;
51 typedef struct MFile_area_struct *MFile_area;
53 typedef struct meta_file
55 char name[FILENAME_MAX+1];
56 part_file files[MF_MAX_PARTS];
59 int open; /* is this file open? */
61 int min_bytes_creat; /* minimum bytes required to enter directory */
65 struct meta_file *next;
68 typedef struct MFile_area_struct
70 char name[FILENAME_MAX+1];
72 struct meta_file *mfiles;
73 struct MFile_area_struct *next; /* global list of active areas */
77 * Open an area, cotaining metafiles in directories.
79 MFile_area mf_init(const char *name);
84 int mf_dispose(MFile_area ma);
89 MFile mf_open(MFile_area ma, const char *name, int block_size, int wflag);
94 int mf_close(MFile mf);
97 * Read one block from a metafile. Interface mirrors bfile.
99 int mf_read(MFile mf, int no, int offset, int num, void *buf);
104 int mf_write(MFile mf, int no, int offset, int num, const void *buf);
107 * Destroy a metafile, unlinking component files. File must be open.
109 int mf_unlink(MFile mf);
112 * Unlink the file by name, rather than MFile-handle.
114 int mf_unlink_name(MFile_area, const char *name);