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
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
|
#define DIRREC 116 /* size of a directory ascii record */
#define ERRREC 64 /* size of a error record */
#define MAXMSG 160 /* max header sans data */
typedef struct Oldfcall Oldfcall;
struct Oldfcall
{
char type;
ushort fid;
short err;
short tag;
union
{
struct
{
short uid; /* T-Userstr */
short oldtag; /* T-nFlush */
Qid9p1 qid; /* R-Attach, R-Clwalk, R-Walk,
* R-Open, R-Create */
char rauth[AUTHENTLEN]; /* R-attach */
};
struct
{
char uname[NAMELEN]; /* T-nAttach */
char aname[NAMELEN]; /* T-nAttach */
char ticket[TICKETLEN]; /* T-attach */
char auth[AUTHENTLEN]; /* T-attach */
};
struct
{
char ename[ERRREC]; /* R-nError */
char chal[CHALLEN]; /* T-session, R-session */
char authid[NAMELEN]; /* R-session */
char authdom[DOMLEN]; /* R-session */
};
struct
{
char name[NAMELEN]; /* T-Walk, T-Clwalk, T-Create, T-Remove */
long perm; /* T-Create */
ushort newfid; /* T-Clone, T-Clwalk */
char mode; /* T-Create, T-Open */
};
struct
{
long offset; /* T-Read, T-Write */
long count; /* T-Read, T-Write, R-Read */
char* data; /* T-Write, R-Read */
};
struct
{
char stat[DIRREC]; /* T-Wstat, R-Stat */
};
};
};
/*
* P9 protocol message types
*/
enum
{
Tnop9p1 = 50,
Rnop9p1,
Tosession9p1 = 52,
Rosession9p1,
Terror9p1 = 54, /* illegal */
Rerror9p1,
Tflush9p1 = 56,
Rflush9p1,
Toattach9p1 = 58,
Roattach9p1,
Tclone9p1 = 60,
Rclone9p1,
Twalk9p1 = 62,
Rwalk9p1,
Topen9p1 = 64,
Ropen9p1,
Tcreate9p1 = 66,
Rcreate9p1,
Tread9p1 = 68,
Rread9p1,
Twrite9p1 = 70,
Rwrite9p1,
Tclunk9p1 = 72,
Rclunk9p1,
Tremove9p1 = 74,
Rremove9p1,
Tstat9p1 = 76,
Rstat9p1,
Twstat9p1 = 78,
Rwstat9p1,
Tclwalk9p1 = 80,
Rclwalk9p1,
Tauth9p1 = 82, /* illegal */
Rauth9p1, /* illegal */
Tsession9p1 = 84,
Rsession9p1,
Tattach9p1 = 86,
Rattach9p1,
MAXSYSCALL
};
int convD2M9p1(Dentry*, char*);
int convM2D9p1(char*, Dentry*);
int convM2S9p1(uchar*, Oldfcall*, int);
int convS2M9p1(Oldfcall*, uchar*);
void fcall9p1(Chan*, Oldfcall*, Oldfcall*);
int authorize(Chan*, Oldfcall*, Oldfcall*);
void (*call9p1[MAXSYSCALL])(Chan*, Oldfcall*, Oldfcall*);
extern Nvrsafe nvr;
|