aboutsummaryrefslogtreecommitdiff
path: root/src/cmd/vac/dat.h
blob: 869ea7a2ebb745c6de71018319f54cd5e02bb412 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
typedef struct MetaBlock MetaBlock;
typedef struct MetaEntry MetaEntry;

#define MaxBlock (1UL<<31)

enum {
	BytesPerEntry = 100,	/* estimate of bytes per dir entries - determines number of index entries in the block */
	FullPercentage = 80,	/* don't allocate in block if more than this percentage full */
	FlushSize = 200,	/* number of blocks to flush */
	DirtyPercentage = 50,	/* maximum percentage of dirty blocks */
};


struct MetaEntry
{
	uchar *p;
	ushort size;
};

struct MetaBlock
{
	int maxsize;		/* size of block */
	int size;		/* size used */
	int free;		/* free space within used size */
	int maxindex;		/* entries allocated for table */
	int nindex;		/* amount of table used */
	int unbotch;
	uchar *buf;
};

struct VacDirEnum
{
	VacFile *file;
	u32int boff;
	int i, n;
	VacDir *buf;
};

void _mbinit(MetaBlock*, u8int*, uint, uint);
int _mbsearch(MetaBlock*, char*, int*, MetaEntry*);