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