Subversion Repositories planix.SVN

Rev

Details | Last modification | View Log | RSS feed

Rev Author Line No. Line
2 - 1
typedef	struct	Chan	Chan;
2
typedef struct	Command	Command;
3
typedef	struct	Conf	Conf;
4
typedef	struct	Cons	Cons;
5
typedef struct	Devcall	Devcall;
6
 
7
#define MAXBUFSIZE	(16*1024)	/* max. buffer size */
8
 
9
#include "portdat.h"
10
 
11
struct	Chan
12
{
13
	int	chan;			/* fd request came in on */
14
	QLock rlock, wlock;		/* lock for reading/writing messages on chan */
15
	int	type;
16
	int	flags;
17
	long	whotime;
18
	File*	flist;			/* base of file structures */
19
	Lock	flock;			/* manipulate flist */
20
	RWLock	reflock;		/* lock for Tflush */
21
	int	msize;			/* version */
22
	int	authed;		/* someone other than ``none'' has authed */
23
 
24
/* 9p1 auth */
25
	uchar	chal[8];
26
	uchar	rchal[8];
27
	int	idoffset;
28
	int	idvec;
29
	Lock	idlock;
30
};
31
 
32
/*
33
 * console cons.flag flags
34
 */
35
enum
36
{
37
	Fchat	= (1<<0),	/* print out filesys rpc traffic */
38
	Fuid	= (1<<2),	/* print out uids */
39
				/* debugging flags for drivers */
40
};
41
 
42
struct	Cons
43
{
44
	int	flags;		/* overall flags for all channels */
45
	int	uid;		/* botch -- used to get uid on cons_create */
46
	int	gid;		/* botch -- used to get gid on cons_create */
47
	int	allow;		/* no-protection flag */
48
	long	offset;		/* used to read files, c.f. fchar */
49
	char*	arg;		/* pointer to remaining line */
50
 
51
	Chan	*chan;	/* console channel */
52
	Chan	*srvchan;	/* local server channel */
53
 
54
	Filter	work;		/* thruput in messages */
55
	Filter	rate;		/* thruput in bytes */
56
	Filter	bhit;		/* getbufs that hit */
57
	Filter	bread;		/* getbufs that miss and read */
58
	Filter	binit;		/* getbufs that miss and dont read */
59
	Filter	tags[MAXTAG];	/* reads of each type of block */
60
};
61
 
62
struct	Conf
63
{
64
	ulong	niobuf;		/* number of iobufs to allocate */
65
	ulong	nuid;		/* distinct uids */
66
	ulong	uidspace;	/* space for uid names -- derrived from nuid */
67
	ulong	gidspace;	/* space for gid names -- derrived from nuid */
68
	ulong	nserve;		/* server processes */
69
	ulong	nfile;		/* number of fid -- system wide */
70
	ulong	nwpath;		/* number of active paths, derrived from nfile */
71
	ulong	bootsize;	/* number of bytes reserved for booting */
72
};
73
 
74
struct	Command
75
{
76
	char	*string;
77
	void	(*func)(void);
78
	char	*args;
79
};
80
 
81
struct Devcall
82
{
83
	void	(*init)(Device);
84
	void	(*ream)(Device);
85
	int	(*check)(Device);
86
	long	(*super)(Device);
87
	long	(*root)(Device);
88
	long	(*size)(Device);
89
	int	(*read)(Device, long, void*);
90
	int	(*write)(Device, long, void*);
91
};
92
 
93
/*
94
 * device types
95
 */
96
enum
97
{
98
	Devnone 	= 0,
99
	Devwren,
100
	MAXDEV
101
};
102
 
103
/*
104
 * file systems
105
 */
106
enum
107
{
108
	MAXFILSYS = 4
109
};
110
 
111
/*
112
 * should be in portdat.h
113
 */
114
#define	QPDIR	0x80000000L
115
#define	QPNONE	0
116
#define	QPROOT	1
117
#define	QPSUPER	2
118
 
119
/*
120
 * perm argument in p9 create
121
 */
122
#define	PDIR	(1L<<31)	/* is a directory */
123
#define	PAPND	(1L<<30)	/* is append only */
124
#define	PLOCK	(1L<<29)	/* is locked on open */
125
 
126
#define	NOF	(-1)
127
 
128
#define	FID1		1
129
#define	FID2		2
130
#define	FID3		3
131
 
132
#define SECOND(n) 	(n)
133
#define MINUTE(n)	(n*SECOND(60))
134
#define HOUR(n)		(n*MINUTE(60))
135
#define DAY(n)		(n*HOUR(24))
136
#define	TLOCK		MINUTE(5)
137
 
138
#define	CHAT(cp)	(chat)
139
#define	QID9P1(a,b)	(Qid9p1){a,b}
140
 
141
extern	Uid*	uid;
142
extern	char*	uidspace;
143
extern	short*	gidspace;
144
extern	char*	errstring[MAXERR];
145
extern	Chan*	chans;
146
extern	RWLock	mainlock;
147
extern	long	boottime;
148
extern	Tlock	*tlocks;
149
extern	Device	devnone;
150
extern	Filsys	filesys[];
151
extern	char	service[];
152
extern	char*	tagnames[];
153
extern	Conf	conf;
154
extern	Cons	cons;
155
extern	Command	command[];
156
extern	Chan	*chan;
157
extern	Devcall	devcall[];
158
extern	char	*progname;
159
extern	char	*procname;
160
extern	long	niob;
161
extern	long	nhiob;
162
extern	Hiob	*hiob;
163
extern	int	chat;
164
extern	int	writeallow;
165
extern	int	wstatallow;
166
extern	int	allownone;
167
extern	int	noatime;
168
extern	int	writegroup;
169
 
170
extern Lock wpathlock;