2 % * Sun RPC is a product of Sun Microsystems, Inc. and is provided for
3 % * unrestricted use provided that this legend is included on all tape
4 % * media and as a part of the software program in whole or part. Users
5 % * may copy or modify Sun RPC without charge, but are not authorized
6 % * to license or distribute it to anyone else except as part of a product or
7 % * program developed by the user or with the express written consent of
8 % * Sun Microsystems, Inc.
10 % * SUN RPC IS PROVIDED AS IS WITH NO WARRANTIES OF ANY KIND INCLUDING THE
11 % * WARRANTIES OF DESIGN, MERCHANTIBILITY AND FITNESS FOR A PARTICULAR
12 % * PURPOSE, OR ARISING FROM A COURSE OF DEALING, USAGE OR TRADE PRACTICE.
14 % * Sun RPC is provided with no support and without any obligation on the
15 % * part of Sun Microsystems, Inc. to assist in its use, correction,
16 % * modification or enhancement.
18 % * SUN MICROSYSTEMS, INC. SHALL HAVE NO LIABILITY WITH RESPECT TO THE
19 % * INFRINGEMENT OF COPYRIGHTS, TRADE SECRETS OR ANY PATENTS BY SUN RPC
20 % * OR ANY PART THEREOF.
22 % * In no event will Sun Microsystems, Inc. be liable for any lost revenue
23 % * or profits or other special, indirect and consequential damages, even if
24 % * Sun has been advised of the possibility of such damages.
26 % * Sun Microsystems, Inc.
27 % * 2550 Garcia Avenue
28 % * Mountain View, California 94043
32 % * Copyright (c) 1987, 1990 by Sun Microsystems, Inc.
35 %/* from @(#)nfs_prot.x 1.3 91/03/11 TIRPC 1.0 */
38 %#ifndef _rpcsvc_nfs_prot_h
39 %#define _rpcsvc_nfs_prot_h
42 const NFS_PORT = 2049;
43 const NFS_MAXDATA = 8192;
44 const NFS_MAXPATHLEN = 1024;
45 const NFS_MAXNAMLEN = 255;
46 const NFS_FHSIZE = 32;
47 const NFS_COOKIESIZE = 4;
48 const NFS_FIFO_DEV = -1; /* size kludge for named pipes */
53 const NFSMODE_FMT = 0170000; /* type of file */
54 const NFSMODE_DIR = 0040000; /* directory */
55 const NFSMODE_CHR = 0020000; /* character special */
56 const NFSMODE_BLK = 0060000; /* block special */
57 const NFSMODE_REG = 0100000; /* regular */
58 const NFSMODE_LNK = 0120000; /* symbolic link */
59 const NFSMODE_SOCK = 0140000; /* socket */
60 const NFSMODE_FIFO = 0010000; /* fifo */
66 NFS_OK= 0, /* no error */
67 NFSERR_PERM=1, /* Not owner */
68 NFSERR_NOENT=2, /* No such file or directory */
69 NFSERR_IO=5, /* I/O error */
70 NFSERR_NXIO=6, /* No such device or address */
71 NFSERR_ACCES=13, /* Permission denied */
72 NFSERR_EXIST=17, /* File exists */
73 NFSERR_NODEV=19, /* No such device */
74 NFSERR_NOTDIR=20, /* Not a directory*/
75 NFSERR_ISDIR=21, /* Is a directory */
76 NFSERR_INVAL=22, /* invalid argument */
77 NFSERR_FBIG=27, /* File too large */
78 NFSERR_NOSPC=28, /* No space left on device */
79 NFSERR_ROFS=30, /* Read-only file system */
80 NFSERR_NAMETOOLONG=63, /* File name too long */
81 NFSERR_NOTEMPTY=66, /* Directory not empty */
82 NFSERR_DQUOT=69, /* Disc quota exceeded */
83 NFSERR_STALE=70, /* Stale NFS file handle */
84 NFSERR_WFLUSH=99 /* write cache flushed */
91 NFNON = 0, /* non-file */
92 NFREG = 1, /* regular file */
93 NFDIR = 2, /* directory */
94 NFBLK = 3, /* block special */
95 NFCHR = 4, /* character special */
96 NFLNK = 5, /* symbolic link */
97 NFSOCK = 6, /* unix domain sockets */
98 NFBAD = 7, /* unused */
99 NFFIFO = 8 /* named pipe */
106 opaque data[NFS_FHSIZE];
122 ftype type; /* file type */
123 unsigned mode; /* protection mode bits */
124 unsigned nlink; /* # hard links */
125 unsigned uid; /* owner user id */
126 unsigned gid; /* owner group id */
127 unsigned size; /* file size in bytes */
128 unsigned blocksize; /* prefered block size */
129 unsigned rdev; /* special device # */
130 unsigned blocks; /* Kb of disk used by file */
131 unsigned fsid; /* device # */
132 unsigned fileid; /* inode # */
133 nfstime atime; /* time of last access */
134 nfstime mtime; /* time of last modification */
135 nfstime ctime; /* time of last change */
139 * File attributes which can be set
142 unsigned mode; /* protection mode bits */
143 unsigned uid; /* owner user id */
144 unsigned gid; /* owner group id */
145 unsigned size; /* file size in bytes */
146 nfstime atime; /* time of last access */
147 nfstime mtime; /* time of last modification */
151 typedef string filename<NFS_MAXNAMLEN>;
152 typedef string nfspath<NFS_MAXPATHLEN>;
155 * Reply status with file attributes
157 union attrstat switch (nfsstat status) {
170 * Arguments for directory operations
173 nfs_fh dir; /* directory file handle */
174 filename name; /* name (up to NFS_MAXNAMLEN bytes) */
183 * Results from directory operation
185 union diropres switch (nfsstat status) {
192 union readlinkres switch (nfsstat status) {
200 * Arguments to remote read
203 nfs_fh file; /* handle for file */
204 unsigned offset; /* byte offset in file */
205 unsigned count; /* immediate read count */
206 unsigned totalcount; /* total read count (from this offset)*/
210 * Status OK portion of remote read reply
213 fattr attributes; /* attributes, need for pagin*/
214 opaque data<NFS_MAXDATA>;
217 union readres switch (nfsstat status) {
225 * Arguments to remote write
228 nfs_fh file; /* handle for file */
229 unsigned beginoffset; /* beginning byte offset in file */
230 unsigned offset; /* current byte offset in file */
231 unsigned totalcount; /* total write count (to this offset)*/
232 opaque data<NFS_MAXDATA>;
257 typedef opaque nfscookie[NFS_COOKIESIZE];
260 * Arguments to readdir
263 nfs_fh dir; /* directory handle */
265 unsigned count; /* number of directory bytes to read */
280 union readdirres switch (nfsstat status) {
288 unsigned tsize; /* preferred transfer size in bytes */
289 unsigned bsize; /* fundamental file system block size */
290 unsigned blocks; /* total blocks in file system */
291 unsigned bfree; /* free blocks in fs */
292 unsigned bavail; /* free blocks avail to non-superuser */
295 union statfsres switch (nfsstat status) {
303 * Remote file service routines
305 program NFS_PROGRAM {
306 version NFS_VERSION {
308 NFSPROC_NULL(void) = 0;
311 NFSPROC_GETATTR(nfs_fh) = 1;
314 NFSPROC_SETATTR(sattrargs) = 2;
317 NFSPROC_ROOT(void) = 3;
320 NFSPROC_LOOKUP(diropargs) = 4;
323 NFSPROC_READLINK(nfs_fh) = 5;
326 NFSPROC_READ(readargs) = 6;
329 NFSPROC_WRITECACHE(void) = 7;
332 NFSPROC_WRITE(writeargs) = 8;
335 NFSPROC_CREATE(createargs) = 9;
338 NFSPROC_REMOVE(diropargs) = 10;
341 NFSPROC_RENAME(renameargs) = 11;
344 NFSPROC_LINK(linkargs) = 12;
347 NFSPROC_SYMLINK(symlinkargs) = 13;
350 NFSPROC_MKDIR(createargs) = 14;
353 NFSPROC_RMDIR(diropargs) = 15;
356 NFSPROC_READDIR(readdirargs) = 16;
359 NFSPROC_STATFS(nfs_fh) = 17;
364 %#endif /*!_rpcsvc_nfs_prot_h*/