xref: /original-bsd/usr.sbin/amd/rpcx/nfs_prot.h (revision 571e3350)
1 /* $Id: nfs_prot.h,v 5.2.1.1 90/10/21 22:30:23 jsp Exp $ */
2 
3 #define	xdr_nfsstat xdr_enum
4 #define	xdr_ftype xdr_enum
5 
6 #define NFS_PORT 2049
7 #define NFS_MAXDATA 8192
8 #define NFS_MAXPATHLEN 1024
9 #define NFS_MAXNAMLEN 255
10 #define NFS_FHSIZE 32
11 #define NFS_COOKIESIZE 4
12 #define NFS_FIFO_DEV -1
13 #define NFSMODE_FMT 0170000
14 #define NFSMODE_DIR 0040000
15 #define NFSMODE_CHR 0020000
16 #define NFSMODE_BLK 0060000
17 #define NFSMODE_REG 0100000
18 #define NFSMODE_LNK 0120000
19 #define NFSMODE_SOCK 0140000
20 #define NFSMODE_FIFO 0010000
21 
22 enum nfsstat {
23 	NFS_OK = 0,
24 	NFSERR_PERM = 1,
25 	NFSERR_NOENT = 2,
26 	NFSERR_IO = 5,
27 	NFSERR_NXIO = 6,
28 	NFSERR_ACCES = 13,
29 	NFSERR_EXIST = 17,
30 	NFSERR_NODEV = 19,
31 	NFSERR_NOTDIR = 20,
32 	NFSERR_ISDIR = 21,
33 	NFSERR_FBIG = 27,
34 	NFSERR_NOSPC = 28,
35 	NFSERR_ROFS = 30,
36 	NFSERR_NAMETOOLONG = 63,
37 	NFSERR_NOTEMPTY = 66,
38 	NFSERR_DQUOT = 69,
39 	NFSERR_STALE = 70,
40 	NFSERR_WFLUSH = 99
41 };
42 typedef enum nfsstat nfsstat;
43 bool_t xdr_nfsstat();
44 
45 
46 enum ftype {
47 	NFNON = 0,
48 	NFREG = 1,
49 	NFDIR = 2,
50 	NFBLK = 3,
51 	NFCHR = 4,
52 	NFLNK = 5,
53 	NFSOCK = 6,
54 	NFBAD = 7,
55 	NFFIFO = 8
56 };
57 typedef enum ftype ftype;
58 /* static bool_t xdr_ftype(); */
59 
60 
61 struct nfs_fh {
62 	char data[NFS_FHSIZE];
63 };
64 typedef struct nfs_fh nfs_fh;
65 bool_t xdr_nfs_fh();
66 
67 
68 struct nfstime {
69 	u_int seconds;
70 	u_int useconds;
71 };
72 typedef struct nfstime nfstime;
73 /* static bool_t xdr_nfstime(); */
74 
75 
76 struct fattr {
77 	ftype type;
78 	u_int mode;
79 	u_int nlink;
80 	u_int uid;
81 	u_int gid;
82 	u_int size;
83 	u_int blocksize;
84 	u_int rdev;
85 	u_int blocks;
86 	u_int fsid;
87 	u_int fileid;
88 	nfstime atime;
89 	nfstime mtime;
90 	nfstime ctime;
91 };
92 typedef struct fattr fattr;
93 /* static bool_t xdr_fattr(); */
94 
95 
96 struct sattr {
97 	u_int mode;
98 	u_int uid;
99 	u_int gid;
100 	u_int size;
101 	nfstime atime;
102 	nfstime mtime;
103 };
104 typedef struct sattr sattr;
105 /* static bool_t xdr_sattr(); */
106 
107 
108 typedef char *filename;
109 /* static bool_t xdr_filename(); */
110 
111 
112 typedef char *nfspath;
113 bool_t xdr_nfspath();
114 
115 
116 struct attrstat {
117 	nfsstat status;
118 	union {
119 		fattr attributes;
120 	} attrstat_u;
121 };
122 typedef struct attrstat attrstat;
123 bool_t xdr_attrstat();
124 
125 
126 struct sattrargs {
127 	nfs_fh file;
128 	sattr attributes;
129 };
130 typedef struct sattrargs sattrargs;
131 bool_t xdr_sattrargs();
132 
133 
134 struct diropargs {
135 	nfs_fh dir;
136 	filename name;
137 };
138 typedef struct diropargs diropargs;
139 bool_t xdr_diropargs();
140 
141 
142 struct diropokres {
143 	nfs_fh file;
144 	fattr attributes;
145 };
146 typedef struct diropokres diropokres;
147 bool_t xdr_diropokres();
148 
149 
150 struct diropres {
151 	nfsstat status;
152 	union {
153 		diropokres diropres;
154 	} diropres_u;
155 };
156 typedef struct diropres diropres;
157 bool_t xdr_diropres();
158 
159 
160 struct readlinkres {
161 	nfsstat status;
162 	union {
163 		nfspath data;
164 	} readlinkres_u;
165 };
166 typedef struct readlinkres readlinkres;
167 bool_t xdr_readlinkres();
168 
169 
170 struct readargs {
171 	nfs_fh file;
172 	u_int offset;
173 	u_int count;
174 	u_int totalcount;
175 };
176 typedef struct readargs readargs;
177 bool_t xdr_readargs();
178 
179 
180 struct readokres {
181 	fattr attributes;
182 	struct {
183 		u_int data_len;
184 		char *data_val;
185 	} data;
186 };
187 typedef struct readokres readokres;
188 bool_t xdr_readokres();
189 
190 
191 struct readres {
192 	nfsstat status;
193 	union {
194 		readokres reply;
195 	} readres_u;
196 };
197 typedef struct readres readres;
198 bool_t xdr_readres();
199 
200 
201 struct writeargs {
202 	nfs_fh file;
203 	u_int beginoffset;
204 	u_int offset;
205 	u_int totalcount;
206 	struct {
207 		u_int data_len;
208 		char *data_val;
209 	} data;
210 };
211 typedef struct writeargs writeargs;
212 bool_t xdr_writeargs();
213 
214 
215 struct createargs {
216 	diropargs where;
217 	sattr attributes;
218 };
219 typedef struct createargs createargs;
220 bool_t xdr_createargs();
221 
222 
223 struct renameargs {
224 	diropargs from;
225 	diropargs to;
226 };
227 typedef struct renameargs renameargs;
228 bool_t xdr_renameargs();
229 
230 
231 struct linkargs {
232 	nfs_fh from;
233 	diropargs to;
234 };
235 typedef struct linkargs linkargs;
236 bool_t xdr_linkargs();
237 
238 
239 struct symlinkargs {
240 	diropargs from;
241 	nfspath to;
242 	sattr attributes;
243 };
244 typedef struct symlinkargs symlinkargs;
245 bool_t xdr_symlinkargs();
246 
247 
248 typedef char nfscookie[NFS_COOKIESIZE];
249 /* static bool_t xdr_nfscookie(); */
250 
251 
252 struct readdirargs {
253 	nfs_fh dir;
254 	nfscookie cookie;
255 	u_int count;
256 };
257 typedef struct readdirargs readdirargs;
258 bool_t xdr_readdirargs();
259 
260 
261 struct entry {
262 	u_int fileid;
263 	filename name;
264 	nfscookie cookie;
265 	struct entry *nextentry;
266 };
267 typedef struct entry entry;
268 /* static bool_t xdr_entry(); */
269 
270 
271 struct dirlist {
272 	entry *entries;
273 	bool_t eof;
274 };
275 typedef struct dirlist dirlist;
276 /* static bool_t xdr_dirlist(); */
277 
278 
279 struct readdirres {
280 	nfsstat status;
281 	union {
282 		dirlist reply;
283 	} readdirres_u;
284 };
285 typedef struct readdirres readdirres;
286 bool_t xdr_readdirres();
287 
288 
289 struct statfsokres {
290 	u_int tsize;
291 	u_int bsize;
292 	u_int blocks;
293 	u_int bfree;
294 	u_int bavail;
295 };
296 typedef struct statfsokres statfsokres;
297 bool_t xdr_statfsokres();
298 
299 
300 struct statfsres {
301 	nfsstat status;
302 	union {
303 		statfsokres reply;
304 	} statfsres_u;
305 };
306 typedef struct statfsres statfsres;
307 bool_t xdr_statfsres();
308 
309 
310 #define NFS_PROGRAM ((u_long)100003)
311 #define NFS_VERSION ((u_long)2)
312 #define NFSPROC_NULL ((u_long)0)
313 extern voidp nfsproc_null_2();
314 #define NFSPROC_GETATTR ((u_long)1)
315 extern attrstat *nfsproc_getattr_2();
316 #define NFSPROC_SETATTR ((u_long)2)
317 extern attrstat *nfsproc_setattr_2();
318 #define NFSPROC_ROOT ((u_long)3)
319 extern voidp nfsproc_root_2();
320 #define NFSPROC_LOOKUP ((u_long)4)
321 extern diropres *nfsproc_lookup_2();
322 #define NFSPROC_READLINK ((u_long)5)
323 extern readlinkres *nfsproc_readlink_2();
324 #define NFSPROC_READ ((u_long)6)
325 extern readres *nfsproc_read_2();
326 #define NFSPROC_WRITECACHE ((u_long)7)
327 extern voidp nfsproc_writecache_2();
328 #define NFSPROC_WRITE ((u_long)8)
329 extern attrstat *nfsproc_write_2();
330 #define NFSPROC_CREATE ((u_long)9)
331 extern diropres *nfsproc_create_2();
332 #define NFSPROC_REMOVE ((u_long)10)
333 extern nfsstat *nfsproc_remove_2();
334 #define NFSPROC_RENAME ((u_long)11)
335 extern nfsstat *nfsproc_rename_2();
336 #define NFSPROC_LINK ((u_long)12)
337 extern nfsstat *nfsproc_link_2();
338 #define NFSPROC_SYMLINK ((u_long)13)
339 extern nfsstat *nfsproc_symlink_2();
340 #define NFSPROC_MKDIR ((u_long)14)
341 extern diropres *nfsproc_mkdir_2();
342 #define NFSPROC_RMDIR ((u_long)15)
343 extern nfsstat *nfsproc_rmdir_2();
344 #define NFSPROC_READDIR ((u_long)16)
345 extern readdirres *nfsproc_readdir_2();
346 #define NFSPROC_STATFS ((u_long)17)
347 extern statfsres *nfsproc_statfs_2();
348 
349