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