2 * Copyright (C) 1994-1995, Index Data I/S
4 * Sebastian Hammer, Adam Dickmeiss
7 * Revision 1.4 1995-11-30 08:33:30 adam
8 * Started work on commit facility.
10 * Revision 1.3 1995/09/04 12:33:35 adam
11 * Various cleanup. YAZ util used instead.
13 * Revision 1.2 1994/09/14 13:10:36 quinn
16 * Revision 1.1 1994/08/23 14:41:46 quinn
17 * First functional version of mfile.
28 #define MF_MIN_BLOCKS_CREAT 1 /* minimum free blocks in new dir */
29 #define MF_DEFAULT_AREA "register" /* Use if no mf_init */
30 #define MF_MAX_PARTS 28 /* max # of part-files per metafile */
32 #define mf_blocksize(mf) ((mf)->blocksize)
36 char name[FILENAME_MAX+1];
37 int max_bytes; /* allocated bytes in this dir. */
38 int avail_bytes; /* bytes left */
42 typedef struct part_file
53 struct MFile_area_struct;
54 typedef struct MFile_area_struct *MFile_area;
56 typedef struct meta_file
58 char name[FILENAME_MAX+1];
59 part_file files[MF_MAX_PARTS];
62 int open; /* is this file open? */
64 int min_bytes_creat; /* minimum bytes required to enter directory */
68 struct meta_file *next;
71 typedef struct MFile_area_struct
73 char name[FILENAME_MAX+1];
75 struct meta_file *mfiles;
76 struct MFile_area_struct *next; /* global list of active areas */
80 * Open an area, cotaining metafiles in directories.
82 MFile_area mf_init(const char *name);
87 int mf_dispose(MFile_area ma);
92 MFile mf_open(MFile_area ma, const char *name, int block_size, int wflag);
97 int mf_close(MFile mf);
100 * Read one block from a metafile. Interface mirrors bfile.
102 int mf_read(MFile mf, int no, int offset, int num, void *buf);
107 int mf_write(MFile mf, int no, int offset, int num, const void *buf);
110 * Destroy a metafile, unlinking component files. File must be open.
112 int mf_unlink(MFile mf);
115 * Unlink the file by name, rather than MFile-handle.
117 int mf_unlink_name(MFile_area, const char *name);