nfs_prot.h
001:
002:
003:
004:
005:
006: #ifndef _NFS_PROT_H_RPCGEN
007: #define _NFS_PROT_H_RPCGEN
008:
009: #include <rpc/rpc.h>
010:
011:
012: #ifdef __cplusplus
013: extern "C" {
014: #endif
015:
016: #define NFS_PORT 2049
017: #define NFS_MAXDATA 8192
018: #define NFS_MAXPATHLEN 1024
019: #define NFS_MAXNAMLEN 255
020: #define NFS_FHSIZE 32
021: #define NFS_COOKIESIZE 4
022: #define NFS_FIFO_DEV -1
023: #define NFSMODE_FMT 0170000
024: #define NFSMODE_DIR 0040000
025: #define NFSMODE_CHR 0020000
026: #define NFSMODE_BLK 0060000
027: #define NFSMODE_REG 0100000
028: #define NFSMODE_LNK 0120000
029: #define NFSMODE_SOCK 0140000
030: #define NFSMODE_FIFO 0010000
031:
032: enum nfsstat {
033: NFS_OK = 0,
034: NFSERR_PERM = 1,
035: NFSERR_NOENT = 2,
036: NFSERR_IO = 5,
037: NFSERR_NXIO = 6,
038: NFSERR_ACCES = 13,
039: NFSERR_EXIST = 17,
040: NFSERR_NODEV = 19,
041: NFSERR_NOTDIR = 20,
042: NFSERR_ISDIR = 21,
043: NFSERR_FBIG = 27,
044: NFSERR_NOSPC = 28,
045: NFSERR_ROFS = 30,
046: NFSERR_NAMETOOLONG = 63,
047: NFSERR_NOTEMPTY = 66,
048: NFSERR_DQUOT = 69,
049: NFSERR_STALE = 70,
050: NFSERR_WFLUSH = 99,
051: };
052: typedef enum nfsstat nfsstat;
053:
054: enum ftype {
055: NFNON = 0,
056: NFREG = 1,
057: NFDIR = 2,
058: NFBLK = 3,
059: NFCHR = 4,
060: NFLNK = 5,
061: NFSOCK = 6,
062: NFBAD = 7,
063: NFFIFO = 8,
064: };
065: typedef enum ftype ftype;
066:
067: struct nfs_fh {
068: char data[NFS_FHSIZE];
069: };
070: typedef struct nfs_fh nfs_fh;
071:
072: struct nfstime {
073: u_int seconds;
074: u_int useconds;
075: };
076: typedef struct nfstime nfstime;
077:
078: struct fattr {
079: ftype type;
080: u_int mode;
081: u_int nlink;
082: u_int uid;
083: u_int gid;
084: u_int size;
085: u_int blocksize;
086: u_int rdev;
087: u_int blocks;
088: u_int fsid;
089: u_int fileid;
090: nfstime atime;
091: nfstime mtime;
092: nfstime ctime;
093: };
094: typedef struct fattr fattr;
095:
096: struct sattr {
097: u_int mode;
098: u_int uid;
099: u_int gid;
100: u_int size;
101: nfstime atime;
102: nfstime mtime;
103: };
104: typedef struct sattr sattr;
105:
106: typedef char *filename;
107:
108: typedef char *nfspath;
109:
110: struct attrstat {
111: nfsstat status;
112: union {
113: fattr attributes;
114: } attrstat_u;
115: };
116: typedef struct attrstat attrstat;
117:
118: struct sattrargs {
119: nfs_fh file;
120: sattr attributes;
121: };
122: typedef struct sattrargs sattrargs;
123:
124: struct diropargs {
125: nfs_fh dir;
126: filename name;
127: };
128: typedef struct diropargs diropargs;
129:
130: struct diropokres {
131: nfs_fh file;
132: fattr attributes;
133: };
134: typedef struct diropokres diropokres;
135:
136: struct diropres {
137: nfsstat status;
138: union {
139: diropokres diropres;
140: } diropres_u;
141: };
142: typedef struct diropres diropres;
143:
144: struct readlinkres {
145: nfsstat status;
146: union {
147: nfspath data;
148: } readlinkres_u;
149: };
150: typedef struct readlinkres readlinkres;
151:
152: struct readargs {
153: nfs_fh file;
154: u_int offset;
155: u_int count;
156: u_int totalcount;
157: };
158: typedef struct readargs readargs;
159:
160: struct readokres {
161: fattr attributes;
162: struct {
163: u_int data_len;
164: char *data_val;
165: } data;
166: };
167: typedef struct readokres readokres;
168:
169: struct readres {
170: nfsstat status;
171: union {
172: readokres reply;
173: } readres_u;
174: };
175: typedef struct readres readres;
176:
177: struct writeargs {
178: nfs_fh file;
179: u_int beginoffset;
180: u_int offset;
181: u_int totalcount;
182: struct {
183: u_int data_len;
184: char *data_val;
185: } data;
186: };
187: typedef struct writeargs writeargs;
188:
189: struct createargs {
190: diropargs where;
191: sattr attributes;
192: };
193: typedef struct createargs createargs;
194:
195: struct renameargs {
196: diropargs from;
197: diropargs to;
198: };
199: typedef struct renameargs renameargs;
200:
201: struct linkargs {
202: nfs_fh from;
203: diropargs to;
204: };
205: typedef struct linkargs linkargs;
206:
207: struct symlinkargs {
208: diropargs from;
209: nfspath to;
210: sattr attributes;
211: };
212: typedef struct symlinkargs symlinkargs;
213:
214: typedef char nfscookie[NFS_COOKIESIZE];
215:
216: struct readdirargs {
217: nfs_fh dir;
218: nfscookie cookie;
219: u_int count;
220: };
221: typedef struct readdirargs readdirargs;
222:
223: struct entry {
224: u_int fileid;
225: filename name;
226: nfscookie cookie;
227: struct entry *nextentry;
228: };
229: typedef struct entry entry;
230:
231: struct dirlist {
232: entry *entries;
233: bool_t eof;
234: };
235: typedef struct dirlist dirlist;
236:
237: struct readdirres {
238: nfsstat status;
239: union {
240: dirlist reply;
241: } readdirres_u;
242: };
243: typedef struct readdirres readdirres;
244:
245: struct statfsokres {
246: u_int tsize;
247: u_int bsize;
248: u_int blocks;
249: u_int bfree;
250: u_int bavail;
251: };
252: typedef struct statfsokres statfsokres;
253:
254: struct statfsres {
255: nfsstat status;
256: union {
257: statfsokres reply;
258: } statfsres_u;
259: };
260: typedef struct statfsres statfsres;
261:
262: #define NFS_PROGRAM 100003
263: #define NFS_VERSION 2
264:
265: #if defined(__STDC__) || defined(__cplusplus)
266: #define NFSPROC_NULL 0
267: extern void * nfsproc_null_2(void *, CLIENT *);
268: extern void * nfsproc_null_2_svc(void *, struct svc_req *);
269: #define NFSPROC_GETATTR 1
270: extern attrstat * nfsproc_getattr_2(nfs_fh *, CLIENT *);
271: extern attrstat * nfsproc_getattr_2_svc(nfs_fh *, struct svc_req *);
272: #define NFSPROC_SETATTR 2
273: extern attrstat * nfsproc_setattr_2(sattrargs *, CLIENT *);
274: extern attrstat * nfsproc_setattr_2_svc(sattrargs *, struct svc_req *);
275: #define NFSPROC_ROOT 3
276: extern void * nfsproc_root_2(void *, CLIENT *);
277: extern void * nfsproc_root_2_svc(void *, struct svc_req *);
278: #define NFSPROC_LOOKUP 4
279: extern diropres * nfsproc_lookup_2(diropargs *, CLIENT *);
280: extern diropres * nfsproc_lookup_2_svc(diropargs *, struct svc_req *);
281: #define NFSPROC_READLINK 5
282: extern readlinkres * nfsproc_readlink_2(nfs_fh *, CLIENT *);
283: extern readlinkres * nfsproc_readlink_2_svc(nfs_fh *, struct svc_req *);
284: #define NFSPROC_READ 6
285: extern readres * nfsproc_read_2(readargs *, CLIENT *);
286: extern readres * nfsproc_read_2_svc(readargs *, struct svc_req *);
287: #define NFSPROC_WRITECACHE 7
288: extern void * nfsproc_writecache_2(void *, CLIENT *);
289: extern void * nfsproc_writecache_2_svc(void *, struct svc_req *);
290: #define NFSPROC_WRITE 8
291: extern attrstat * nfsproc_write_2(writeargs *, CLIENT *);
292: extern attrstat * nfsproc_write_2_svc(writeargs *, struct svc_req *);
293: #define NFSPROC_CREATE 9
294: extern diropres * nfsproc_create_2(createargs *, CLIENT *);
295: extern diropres * nfsproc_create_2_svc(createargs *, struct svc_req *);
296: #define NFSPROC_REMOVE 10
297: extern nfsstat * nfsproc_remove_2(diropargs *, CLIENT *);
298: extern nfsstat * nfsproc_remove_2_svc(diropargs *, struct svc_req *);
299: #define NFSPROC_RENAME 11
300: extern nfsstat * nfsproc_rename_2(renameargs *, CLIENT *);
301: extern nfsstat * nfsproc_rename_2_svc(renameargs *, struct svc_req *);
302: #define NFSPROC_LINK 12
303: extern nfsstat * nfsproc_link_2(linkargs *, CLIENT *);
304: extern nfsstat * nfsproc_link_2_svc(linkargs *, struct svc_req *);
305: #define NFSPROC_SYMLINK 13
306: extern nfsstat * nfsproc_symlink_2(symlinkargs *, CLIENT *);
307: extern nfsstat * nfsproc_symlink_2_svc(symlinkargs *, struct svc_req *);
308: #define NFSPROC_MKDIR 14
309: extern diropres * nfsproc_mkdir_2(createargs *, CLIENT *);
310: extern diropres * nfsproc_mkdir_2_svc(createargs *, struct svc_req *);
311: #define NFSPROC_RMDIR 15
312: extern nfsstat * nfsproc_rmdir_2(diropargs *, CLIENT *);
313: extern nfsstat * nfsproc_rmdir_2_svc(diropargs *, struct svc_req *);
314: #define NFSPROC_READDIR 16
315: extern readdirres * nfsproc_readdir_2(readdirargs *, CLIENT *);
316: extern readdirres * nfsproc_readdir_2_svc(readdirargs *, struct svc_req *);
317: #define NFSPROC_STATFS 17
318: extern statfsres * nfsproc_statfs_2(nfs_fh *, CLIENT *);
319: extern statfsres * nfsproc_statfs_2_svc(nfs_fh *, struct svc_req *);
320: extern int nfs_program_2_freeresult (SVCXPRT *, xdrproc_t, caddr_t);
321:
322: #else
323: #define NFSPROC_NULL 0
324: extern void * nfsproc_null_2();
325: extern void * nfsproc_null_2_svc();
326: #define NFSPROC_GETATTR 1
327: extern attrstat * nfsproc_getattr_2();
328: extern attrstat * nfsproc_getattr_2_svc();
329: #define NFSPROC_SETATTR 2
330: extern attrstat * nfsproc_setattr_2();
331: extern attrstat * nfsproc_setattr_2_svc();
332: #define NFSPROC_ROOT 3
333: extern void * nfsproc_root_2();
334: extern void * nfsproc_root_2_svc();
335: #define NFSPROC_LOOKUP 4
336: extern diropres * nfsproc_lookup_2();
337: extern diropres * nfsproc_lookup_2_svc();
338: #define NFSPROC_READLINK 5
339: extern readlinkres * nfsproc_readlink_2();
340: extern readlinkres * nfsproc_readlink_2_svc();
341: #define NFSPROC_READ 6
342: extern readres * nfsproc_read_2();
343: extern readres * nfsproc_read_2_svc();
344: #define NFSPROC_WRITECACHE 7
345: extern void * nfsproc_writecache_2();
346: extern void * nfsproc_writecache_2_svc();
347: #define NFSPROC_WRITE 8
348: extern attrstat * nfsproc_write_2();
349: extern attrstat * nfsproc_write_2_svc();
350: #define NFSPROC_CREATE 9
351: extern diropres * nfsproc_create_2();
352: extern diropres * nfsproc_create_2_svc();
353: #define NFSPROC_REMOVE 10
354: extern nfsstat * nfsproc_remove_2();
355: extern nfsstat * nfsproc_remove_2_svc();
356: #define NFSPROC_RENAME 11
357: extern nfsstat * nfsproc_rename_2();
358: extern nfsstat * nfsproc_rename_2_svc();
359: #define NFSPROC_LINK 12
360: extern nfsstat * nfsproc_link_2();
361: extern nfsstat * nfsproc_link_2_svc();
362: #define NFSPROC_SYMLINK 13
363: extern nfsstat * nfsproc_symlink_2();
364: extern nfsstat * nfsproc_symlink_2_svc();
365: #define NFSPROC_MKDIR 14
366: extern diropres * nfsproc_mkdir_2();
367: extern diropres * nfsproc_mkdir_2_svc();
368: #define NFSPROC_RMDIR 15
369: extern nfsstat * nfsproc_rmdir_2();
370: extern nfsstat * nfsproc_rmdir_2_svc();
371: #define NFSPROC_READDIR 16
372: extern readdirres * nfsproc_readdir_2();
373: extern readdirres * nfsproc_readdir_2_svc();
374: #define NFSPROC_STATFS 17
375: extern statfsres * nfsproc_statfs_2();
376: extern statfsres * nfsproc_statfs_2_svc();
377: extern int nfs_program_2_freeresult ();
378: #endif
379:
380:
381:
382: #if defined(__STDC__) || defined(__cplusplus)
383: extern bool_t xdr_nfsstat (XDR *, nfsstat*);
384: extern bool_t xdr_ftype (XDR *, ftype*);
385: extern bool_t xdr_nfs_fh (XDR *, nfs_fh*);
386: extern bool_t xdr_nfstime (XDR *, nfstime*);
387: extern bool_t xdr_fattr (XDR *, fattr*);
388: extern bool_t xdr_sattr (XDR *, sattr*);
389: extern bool_t xdr_filename (XDR *, filename*);
390: extern bool_t xdr_nfspath (XDR *, nfspath*);
391: extern bool_t xdr_attrstat (XDR *, attrstat*);
392: extern bool_t xdr_sattrargs (XDR *, sattrargs*);
393: extern bool_t xdr_diropargs (XDR *, diropargs*);
394: extern bool_t xdr_diropokres (XDR *, diropokres*);
395: extern bool_t xdr_diropres (XDR *, diropres*);
396: extern bool_t xdr_readlinkres (XDR *, readlinkres*);
397: extern bool_t xdr_readargs (XDR *, readargs*);
398: extern bool_t xdr_readokres (XDR *, readokres*);
399: extern bool_t xdr_readres (XDR *, readres*);
400: extern bool_t xdr_writeargs (XDR *, writeargs*);
401: extern bool_t xdr_createargs (XDR *, createargs*);
402: extern bool_t xdr_renameargs (XDR *, renameargs*);
403: extern bool_t xdr_linkargs (XDR *, linkargs*);
404: extern bool_t xdr_symlinkargs (XDR *, symlinkargs*);
405: extern bool_t xdr_nfscookie (XDR *, nfscookie);
406: extern bool_t xdr_readdirargs (XDR *, readdirargs*);
407: extern bool_t xdr_entry (XDR *, entry*);
408: extern bool_t xdr_dirlist (XDR *, dirlist*);
409: extern bool_t xdr_readdirres (XDR *, readdirres*);
410: extern bool_t xdr_statfsokres (XDR *, statfsokres*);
411: extern bool_t xdr_statfsres (XDR *, statfsres*);
412:
413: #else
414: extern bool_t xdr_nfsstat ();
415: extern bool_t xdr_ftype ();
416: extern bool_t xdr_nfs_fh ();
417: extern bool_t xdr_nfstime ();
418: extern bool_t xdr_fattr ();
419: extern bool_t xdr_sattr ();
420: extern bool_t xdr_filename ();
421: extern bool_t xdr_nfspath ();
422: extern bool_t xdr_attrstat ();
423: extern bool_t xdr_sattrargs ();
424: extern bool_t xdr_diropargs ();
425: extern bool_t xdr_diropokres ();
426: extern bool_t xdr_diropres ();
427: extern bool_t xdr_readlinkres ();
428: extern bool_t xdr_readargs ();
429: extern bool_t xdr_readokres ();
430: extern bool_t xdr_readres ();
431: extern bool_t xdr_writeargs ();
432: extern bool_t xdr_createargs ();
433: extern bool_t xdr_renameargs ();
434: extern bool_t xdr_linkargs ();
435: extern bool_t xdr_symlinkargs ();
436: extern bool_t xdr_nfscookie ();
437: extern bool_t xdr_readdirargs ();
438: extern bool_t xdr_entry ();
439: extern bool_t xdr_dirlist ();
440: extern bool_t xdr_readdirres ();
441: extern bool_t xdr_statfsokres ();
442: extern bool_t xdr_statfsres ();
443:
444: #endif
445:
446: #ifdef __cplusplus
447: }
448: #endif
449:
450: #endif
451:
© Andrew Scott 2006 -
2025,
All Rights Reserved