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