Subversion Repositories planix.SVN

Rev

Rev 2 | Details | Compare with Previous | Last modification | View Log | RSS feed

Rev Author Line No. Line
2 - 1
typedef struct Bbuf	Bbuf;
2
typedef struct Bcache	Bcache;
3
 
4
enum
5
{
6
	Nbcache=	32,		/* number of blocks kept in pool */
7
};
8
 
9
/*
10
 *  block cache descriptor
11
 */
12
struct Bbuf
13
{
14
	Lru;				/* must be first in struct */
15
	ulong	bno;
16
	int	inuse;
17
	Bbuf	*next;			/* next in dirty list */
18
	int	dirty;
19
	char	*data;
20
};
21
 
22
/*
23
 *  the buffer cache
24
 */
25
struct Bcache
26
{
27
	Lru;
28
	int	bsize;			/* block size in bytes */
29
	int	f;			/* fd to disk */
30
	Bbuf	*dfirst;		/* dirty list */
31
	Bbuf	*dlast;
32
	Bbuf	bb[Nbcache];
33
};
34
 
35
int	bcinit(Bcache*, int, int);
36
Bbuf*	bcalloc(Bcache*, ulong);
37
Bbuf*	bcread(Bcache*, ulong);
38
void	bcmark(Bcache*, Bbuf*);
39
int	bcwrite(Bcache*, Bbuf*);
40
int	bcsync(Bcache*);
41
int	bread(Bcache*, ulong, void*);
42
int	bwrite(Bcache*, ulong, void*);
43
int	bref(Bcache*, Bbuf*);
44
void	error(char*, ...);
45
void	warning(char*);