2 * Copyright (C) 1994, Index Data I/S
4 * Sebastian Hammer, Adam Dickmeiss
7 * Revision 1.2 1994-09-14 13:10:36 quinn
10 * Revision 1.1 1994/08/23 14:41:46 quinn
11 * First functional version of mfile.
22 #define MF_MIN_BLOCKS_CREAT 1 /* minimum free blocks in new dir */
23 #define MF_DEFAULT_AREA "register" /* Use if no mf_init */
24 #define MF_MAX_PARTS 28 /* max # of part-files per metafile */
26 #define mf_blocksize(mf) ((mf)->blocksize)
30 char name[FILENAME_MAX+1];
31 int max_bytes; /* allocated bytes in this dir. */
32 int avail_bytes; /* bytes left */
36 typedef struct part_file
47 struct MFile_area_struct;
48 typedef struct MFile_area_struct *MFile_area;
50 typedef struct meta_file
52 char name[FILENAME_MAX+1];
53 part_file files[MF_MAX_PARTS];
56 int open; /* is this file open? */
58 int min_bytes_creat; /* minimum bytes required to enter directory */
62 struct meta_file *next;
65 typedef struct MFile_area_struct
67 char name[FILENAME_MAX+1];
69 struct meta_file *mfiles;
70 struct MFile_area_struct *next; /* global list of active areas */
74 * Open an area, cotaining metafiles in directories.
76 MFile_area mf_init(const char *name);
81 int mf_dispose(MFile_area ma);
86 MFile mf_open(MFile_area ma, const char *name, int block_size, int wflag);
91 int mf_close(MFile mf);
94 * Read one block from a metafile. Interface mirrors bfile.
96 int mf_read(MFile mf, int no, int offset, int num, void *buf);
101 int mf_write(MFile mf, int no, int offset, int num, const void *buf);
104 * Destroy a metafile, unlinking component files. File must be open.
106 int mf_unlink(MFile mf);
109 * Unlink the file by name, rather than MFile-handle.
111 int mf_unlink_name(MFile_area, const char *name);