xref: /freebsd/stand/libsa/nfsv2.h (revision 1719886f6d08408b834d270c59ffcfd821c8f63a)
1 /*	$NetBSD: nfsv2.h,v 1.2 1996/02/26 23:05:23 gwr Exp $	*/
2 
3 /*
4  * Copyright (c) 1989, 1993
5  *	The Regents of the University of California.  All rights reserved.
6  *
7  * This code is derived from software contributed to Berkeley by
8  * Rick Macklem at The University of Guelph.
9  *
10  * Redistribution and use in source and binary forms, with or without
11  * modification, are permitted provided that the following conditions
12  * are met:
13  * 1. Redistributions of source code must retain the above copyright
14  *    notice, this list of conditions and the following disclaimer.
15  * 2. Redistributions in binary form must reproduce the above copyright
16  *    notice, this list of conditions and the following disclaimer in the
17  *    documentation and/or other materials provided with the distribution.
18  * 3. Neither the name of the University nor the names of its contributors
19  *    may be used to endorse or promote products derived from this software
20  *    without specific prior written permission.
21  *
22  * THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND
23  * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
24  * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
25  * ARE DISCLAIMED.  IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE
26  * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
27  * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
28  * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
29  * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
30  * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
31  * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
32  * SUCH DAMAGE.
33  */
34 
35 /*
36  * nfs definitions as per the version 2 specs
37  */
38 
39 /*
40  * Constants as defined in the Sun NFS Version 2 spec.
41  * "NFS: Network File System Protocol Specification" RFC1094
42  */
43 
44 #define NFS_PORT	2049
45 #define	NFS_PROG	100003
46 #define NFS_VER2	2
47 #define	NFS_MAXDGRAMDATA 8192
48 #define	NFS_MAXDATA	32768
49 #define	NFS_MAXPATHLEN	1024
50 #define	NFS_MAXNAMLEN	255
51 #define	NFS_FHSIZE	32
52 #define	NFS_MAXPKTHDR	404
53 #define NFS_MAXPACKET	(NFS_MAXPKTHDR+NFS_MAXDATA)
54 #define	NFS_MINPACKET	20
55 #define	NFS_FABLKSIZE	512	/* Size in bytes of a block wrt fa_blocks */
56 #define	NFS_READDIRSIZE	1024
57 
58 /* Stat numbers for rpc returns */
59 #define	NFS_OK		0
60 #define	NFSERR_PERM	1
61 #define	NFSERR_NOENT	2
62 #define	NFSERR_IO	5
63 #define	NFSERR_NXIO	6
64 #define	NFSERR_ACCES	13
65 #define	NFSERR_EXIST	17
66 #define	NFSERR_NODEV	19
67 #define	NFSERR_NOTDIR	20
68 #define	NFSERR_ISDIR	21
69 #define	NFSERR_FBIG	27
70 #define	NFSERR_NOSPC	28
71 #define	NFSERR_ROFS	30
72 #define	NFSERR_NAMETOL	63
73 #define	NFSERR_NOTEMPTY	66
74 #define	NFSERR_DQUOT	69
75 #define	NFSERR_STALE	70
76 #define	NFSERR_WFLUSH	99
77 
78 /* Sizes in bytes of various nfs rpc components */
79 #define	NFSX_FH		32
80 #define	NFSX_UNSIGNED	4
81 #define	NFSX_FATTR	68
82 #define	NFSX_SATTR	32
83 #define NFSX_STATFS	20
84 #define	NFSX_COOKIE	4
85 
86 /* nfs rpc procedure numbers */
87 #define	NFSPROC_NULL		0
88 #define	NFSPROC_GETATTR		1
89 #define	NFSPROC_SETATTR		2
90 #define	NFSPROC_NOOP		3
91 #define	NFSPROC_ROOT		NFSPROC_NOOP	/* Obsolete */
92 #define	NFSPROC_LOOKUP		4
93 #define	NFSPROC_READLINK	5
94 #define	NFSPROC_READ		6
95 #define	NFSPROC_WRITECACHE	NFSPROC_NOOP	/* Obsolete */
96 #define	NFSPROC_WRITE		8
97 #define	NFSPROC_CREATE		9
98 #define	NFSPROC_REMOVE		10
99 #define	NFSPROC_RENAME		11
100 #define	NFSPROC_LINK		12
101 #define	NFSPROC_SYMLINK		13
102 #define	NFSPROC_MKDIR		14
103 #define	NFSPROC_RMDIR		15
104 #define	NFSPROC_READDIR		16
105 #define	NFSPROC_STATFS		17
106 
107 #define	NFS_NPROCS		18
108 
109 
110 /* File types */
111 typedef enum {
112 	NFNON=0,
113 	NFREG=1,
114 	NFDIR=2,
115 	NFBLK=3,
116 	NFCHR=4,
117 	NFLNK=5
118 } nfstype;
119