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