2 * Copyright (C) 1994, Index Data I/S
4 * Sebastian Hammer, Adam Dickmeiss
7 * Revision 1.1 1994-08-23 14:41:46 quinn
8 * First functional version of mfile.
19 #define MF_MIN_BLOCKS_CREAT 1 /* minimum free blocks in new dir */
20 #define MF_DEFAULT_AREA "register" /* Use if no mf_init */
21 #define MF_MAX_PARTS 28 /* max # of part-files per metafile */
25 char name[FILENAME_MAX+1];
26 int max_bytes; /* allocated bytes in this dir. */
27 int avail_bytes; /* bytes left */
31 typedef struct part_file
42 struct MFile_area_struct;
43 typedef struct MFile_area_struct *MFile_area;
45 typedef struct meta_file
47 char name[FILENAME_MAX+1];
48 part_file files[MF_MAX_PARTS];
51 int open; /* is this file open? */
53 int min_bytes_creat; /* minimum bytes required to enter directory */
57 struct meta_file *next;
60 typedef struct MFile_area_struct
62 char name[FILENAME_MAX+1];
64 struct meta_file *mfiles;
65 struct MFile_area_struct *next; /* global list of active areas */
69 * Open an area, cotaining metafiles in directories.
71 MFile_area mf_init(const char *name);
76 int mf_dispose(MFile_area ma);
81 MFile mf_open(MFile_area ma, const char *name, int block_size, int wflag);
86 int mf_close(MFile mf);
89 * Read one block from a metafile. Interface mirrors bfile.
91 int mf_read(MFile mf, int no, int offset, int num, void *buf);
96 int mf_write(MFile mf, int no, int offset, int num, const void *buf);
99 * Destroy a metafile, unlinking component files. File must be open.
101 int mf_unlink(MFile mf);
104 * Unlink the file by name, rather than MFile-handle.
106 int mf_unlink_name(MFile_area, const char *name);