xref: /freebsd/stand/libsa/nfsv2.h (revision d0b2dbfa0ecf2bbc9709efc5e20baf8e4b44bbbf)
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  *	@(#)nfsv2.h	8.1 (Berkeley) 6/10/93
35  */
36 
37 /*
38  * nfs definitions as per the version 2 specs
39  */
40 
41 /*
42  * Constants as defined in the Sun NFS Version 2 spec.
43  * "NFS: Network File System Protocol Specification" RFC1094
44  */
45 
46 #define NFS_PORT	2049
47 #define	NFS_PROG	100003
48 #define NFS_VER2	2
49 #define	NFS_MAXDGRAMDATA 8192
50 #define	NFS_MAXDATA	32768
51 #define	NFS_MAXPATHLEN	1024
52 #define	NFS_MAXNAMLEN	255
53 #define	NFS_FHSIZE	32
54 #define	NFS_MAXPKTHDR	404
55 #define NFS_MAXPACKET	(NFS_MAXPKTHDR+NFS_MAXDATA)
56 #define	NFS_MINPACKET	20
57 #define	NFS_FABLKSIZE	512	/* Size in bytes of a block wrt fa_blocks */
58 #define	NFS_READDIRSIZE	1024
59 
60 /* Stat numbers for rpc returns */
61 #define	NFS_OK		0
62 #define	NFSERR_PERM	1
63 #define	NFSERR_NOENT	2
64 #define	NFSERR_IO	5
65 #define	NFSERR_NXIO	6
66 #define	NFSERR_ACCES	13
67 #define	NFSERR_EXIST	17
68 #define	NFSERR_NODEV	19
69 #define	NFSERR_NOTDIR	20
70 #define	NFSERR_ISDIR	21
71 #define	NFSERR_FBIG	27
72 #define	NFSERR_NOSPC	28
73 #define	NFSERR_ROFS	30
74 #define	NFSERR_NAMETOL	63
75 #define	NFSERR_NOTEMPTY	66
76 #define	NFSERR_DQUOT	69
77 #define	NFSERR_STALE	70
78 #define	NFSERR_WFLUSH	99
79 
80 /* Sizes in bytes of various nfs rpc components */
81 #define	NFSX_FH		32
82 #define	NFSX_UNSIGNED	4
83 #define	NFSX_FATTR	68
84 #define	NFSX_SATTR	32
85 #define NFSX_STATFS	20
86 #define	NFSX_COOKIE	4
87 
88 /* nfs rpc procedure numbers */
89 #define	NFSPROC_NULL		0
90 #define	NFSPROC_GETATTR		1
91 #define	NFSPROC_SETATTR		2
92 #define	NFSPROC_NOOP		3
93 #define	NFSPROC_ROOT		NFSPROC_NOOP	/* Obsolete */
94 #define	NFSPROC_LOOKUP		4
95 #define	NFSPROC_READLINK	5
96 #define	NFSPROC_READ		6
97 #define	NFSPROC_WRITECACHE	NFSPROC_NOOP	/* Obsolete */
98 #define	NFSPROC_WRITE		8
99 #define	NFSPROC_CREATE		9
100 #define	NFSPROC_REMOVE		10
101 #define	NFSPROC_RENAME		11
102 #define	NFSPROC_LINK		12
103 #define	NFSPROC_SYMLINK		13
104 #define	NFSPROC_MKDIR		14
105 #define	NFSPROC_RMDIR		15
106 #define	NFSPROC_READDIR		16
107 #define	NFSPROC_STATFS		17
108 
109 #define	NFS_NPROCS		18
110 
111 
112 /* File types */
113 typedef enum {
114 	NFNON=0,
115 	NFREG=1,
116 	NFDIR=2,
117 	NFBLK=3,
118 	NFCHR=4,
119 	NFLNK=5
120 } nfstype;
121