Subversion Repositories planix.SVN

Rev

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

Rev Author Line No. Line
2 - 1
/*
2
 * exportfs.h - definitions for exporting file server
3
 */
4
 
5
#define DEBUG		if(!dbg){}else fprint
6
#define DFD		9
7
#define fidhash(s)	fhash[s%FHASHSIZE]
8
 
9
typedef struct Fsrpc Fsrpc;
10
typedef struct Fid Fid;
11
typedef struct File File;
12
typedef struct Proc Proc;
13
typedef struct Qidtab Qidtab;
14
 
15
struct Fsrpc
16
{
17
	int	busy;		/* Work buffer has pending rpc to service */
18
	uintptr	pid;		/* Pid of slave process executing the rpc */
19
	int	canint;		/* Interrupt gate */
20
	int	flushtag;	/* Tag on which to reply to flush */
21
	Fcall	work;		/* Plan 9 incoming Fcall */
22
	uchar	*buf;		/* Data buffer */
23
};
24
 
25
struct Fid
26
{
27
	int	fid;		/* system fd for i/o */
28
	File	*f;		/* File attached to this fid */
29
	int	mode;
30
	int	nr;		/* fid number */
31
	int	mid;		/* Mount id */
32
	Fid	*next;		/* hash link */
33
 
34
	/* for preaddir -- ARRGH! */
35
	Dir	*dir;		/* buffer for reading directories */
36
	int	ndir;		/* number of entries in dir */
37
	int	cdir;		/* number of consumed entries in dir */
38
	int	gdir;		/* glue index */
39
	vlong	offset;		/* offset in virtual directory */
40
};
41
 
42
struct File
43
{
44
	char	*name;
45
	int	ref;
46
	Qid	qid;
47
	Qidtab	*qidt;
48
	int	inval;
49
	File	*parent;
50
	File	*child;
51
	File	*childlist;
52
};
53
 
54
struct Proc
55
{
56
	uintptr	pid;
57
	int	busy;
58
	Proc	*next;
59
};
60
 
61
struct Qidtab
62
{
63
	int	ref;
64
	int	type;
65
	int	dev;
66
	vlong	path;
67
	vlong	uniqpath;
68
	Qidtab	*next;
69
};
70
 
71
enum
72
{
73
	MAXPROC		= 50,
74
	FHASHSIZE	= 64,
75
	Nr_workbufs 	= 50,
76
	Fidchunk	= 1000,
77
	Npsmpt		= 32,
78
	Nqidbits		= 5,
79
	Nqidtab		= (1<<Nqidbits),
80
};
81
 
82
char Ebadfid[];
83
char Enotdir[];
84
char Edupfid[];
85
char Eopen[];
86
char Exmnt[];
87
char Enomem[];
88
char Emip[];
89
char Enopsmt[];
90
 
91
Extern Fsrpc	*Workq;
92
Extern int  	dbg;
93
Extern File	*root;
94
Extern File	*psmpt;
95
Extern Fid	**fhash;
96
Extern Fid	*fidfree;
97
Extern Proc	*Proclist;
98
Extern char	psmap[Npsmpt];
99
Extern Qidtab	*qidtab[Nqidtab];
100
Extern ulong	messagesize;
101
Extern char	Enomem[];
102
Extern int	srvfd;
103
Extern char*	patternfile;
104
 
105
/* File system protocol service procedures */
106
void Xattach(Fsrpc*);
107
void Xauth(Fsrpc*);
108
void Xclunk(Fsrpc*); 
109
void Xcreate(Fsrpc*);
110
void Xflush(Fsrpc*); 
111
void Xnop(Fsrpc*);
112
void Xremove(Fsrpc*);
113
void Xstat(Fsrpc*);
114
void Xversion(Fsrpc*);
115
void Xwalk(Fsrpc*);
116
void Xwstat(Fsrpc*);
117
void slave(Fsrpc*);
118
 
119
void	reply(Fcall*, Fcall*, char*);
120
Fid 	*getfid(int);
121
int	freefid(int);
122
Fid	*newfid(int);
123
Fsrpc	*getsbuf(void);
124
void	initroot(void);
125
void	fatal(char*, ...);
126
char*	makepath(File*, char*);
127
File	*file(File*, char*);
128
void	freefile(File*);
129
void	slaveopen(Fsrpc*);
130
void	slaveread(Fsrpc*);
131
void	slavewrite(Fsrpc*);
132
void	blockingslave(void);
133
void	reopen(Fid *f);
134
void	noteproc(int, char*);
135
void	flushaction(void*, char*);
136
void	pushfcall(char*);
137
Qidtab* uniqueqid(Dir*);
138
void	freeqid(Qidtab*);
139
char*	estrdup(char*);
140
void*	emallocz(uint);
141
int	readmessage(int, char*, int);
142
void	exclusions(void);
143
int	excludefile(char*);
144
int	preaddir(Fid*, uchar*, int, vlong);