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