nfsport.h revision 1.1.1.1.10.2 1 1.1.1.1.10.2 tls /* $NetBSD: nfsport.h,v 1.1.1.1.10.2 2014/08/20 00:04:27 tls Exp $ */
2 1.1.1.1.10.2 tls /*-
3 1.1.1.1.10.2 tls * Copyright (c) 1989, 1993
4 1.1.1.1.10.2 tls * The Regents of the University of California. All rights reserved.
5 1.1.1.1.10.2 tls *
6 1.1.1.1.10.2 tls * This code is derived from software contributed to Berkeley by
7 1.1.1.1.10.2 tls * Rick Macklem at The University of Guelph.
8 1.1.1.1.10.2 tls *
9 1.1.1.1.10.2 tls * Redistribution and use in source and binary forms, with or without
10 1.1.1.1.10.2 tls * modification, are permitted provided that the following conditions
11 1.1.1.1.10.2 tls * are met:
12 1.1.1.1.10.2 tls * 1. Redistributions of source code must retain the above copyright
13 1.1.1.1.10.2 tls * notice, this list of conditions and the following disclaimer.
14 1.1.1.1.10.2 tls * 2. Redistributions in binary form must reproduce the above copyright
15 1.1.1.1.10.2 tls * notice, this list of conditions and the following disclaimer in the
16 1.1.1.1.10.2 tls * documentation and/or other materials provided with the distribution.
17 1.1.1.1.10.2 tls * 4. Neither the name of the University nor the names of its contributors
18 1.1.1.1.10.2 tls * may be used to endorse or promote products derived from this software
19 1.1.1.1.10.2 tls * without specific prior written permission.
20 1.1.1.1.10.2 tls *
21 1.1.1.1.10.2 tls * THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND
22 1.1.1.1.10.2 tls * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
23 1.1.1.1.10.2 tls * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
24 1.1.1.1.10.2 tls * ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE
25 1.1.1.1.10.2 tls * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
26 1.1.1.1.10.2 tls * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
27 1.1.1.1.10.2 tls * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
28 1.1.1.1.10.2 tls * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
29 1.1.1.1.10.2 tls * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
30 1.1.1.1.10.2 tls * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
31 1.1.1.1.10.2 tls * SUCH DAMAGE.
32 1.1.1.1.10.2 tls *
33 1.1.1.1.10.2 tls * FreeBSD: head/sys/fs/nfs/nfsport.h 254337 2013-08-14 21:11:26Z rmacklem
34 1.1.1.1.10.2 tls * $NetBSD: nfsport.h,v 1.1.1.1.10.2 2014/08/20 00:04:27 tls Exp $
35 1.1.1.1.10.2 tls */
36 1.1.1.1.10.2 tls
37 1.1.1.1.10.2 tls #ifndef _NFS_NFSPORT_H_
38 1.1.1.1.10.2 tls #define _NFS_NFSPORT_H_
39 1.1.1.1.10.2 tls
40 1.1.1.1.10.2 tls /*
41 1.1.1.1.10.2 tls * In general, I'm not fond of #includes in .h files, but this seems
42 1.1.1.1.10.2 tls * to be the cleanest way to handle #include files for the ports.
43 1.1.1.1.10.2 tls */
44 1.1.1.1.10.2 tls #ifdef _KERNEL
45 1.1.1.1.10.2 tls #include <sys/unistd.h>
46 1.1.1.1.10.2 tls #include <sys/param.h>
47 1.1.1.1.10.2 tls #include <sys/systm.h>
48 1.1.1.1.10.2 tls #include <sys/conf.h>
49 1.1.1.1.10.2 tls #include <sys/dirent.h>
50 1.1.1.1.10.2 tls #include <sys/domain.h>
51 1.1.1.1.10.2 tls #include <sys/fcntl.h>
52 1.1.1.1.10.2 tls #include <sys/file.h>
53 1.1.1.1.10.2 tls #include <sys/filedesc.h>
54 1.1.1.1.10.2 tls #include <sys/jail.h>
55 1.1.1.1.10.2 tls #include <sys/kernel.h>
56 1.1.1.1.10.2 tls #include <sys/lockf.h>
57 1.1.1.1.10.2 tls #include <sys/malloc.h>
58 1.1.1.1.10.2 tls #include <sys/mbuf.h>
59 1.1.1.1.10.2 tls #include <sys/mount.h>
60 1.1.1.1.10.2 tls #include <sys/namei.h>
61 1.1.1.1.10.2 tls #include <sys/proc.h>
62 1.1.1.1.10.2 tls #include <sys/protosw.h>
63 1.1.1.1.10.2 tls #include <sys/reboot.h>
64 1.1.1.1.10.2 tls #include <sys/resourcevar.h>
65 1.1.1.1.10.2 tls #include <sys/signalvar.h>
66 1.1.1.1.10.2 tls #include <sys/socket.h>
67 1.1.1.1.10.2 tls #include <sys/socketvar.h>
68 1.1.1.1.10.2 tls #include <sys/stat.h>
69 1.1.1.1.10.2 tls #include <sys/syslog.h>
70 1.1.1.1.10.2 tls #include <sys/sysproto.h>
71 1.1.1.1.10.2 tls #include <sys/time.h>
72 1.1.1.1.10.2 tls #include <sys/uio.h>
73 1.1.1.1.10.2 tls #include <sys/vnode.h>
74 1.1.1.1.10.2 tls #include <sys/bio.h>
75 1.1.1.1.10.2 tls #include <sys/buf.h>
76 1.1.1.1.10.2 tls #include <sys/acl.h>
77 1.1.1.1.10.2 tls #include <sys/module.h>
78 1.1.1.1.10.2 tls #include <sys/sysent.h>
79 1.1.1.1.10.2 tls #include <sys/syscall.h>
80 1.1.1.1.10.2 tls #include <sys/priv.h>
81 1.1.1.1.10.2 tls #include <sys/kthread.h>
82 1.1.1.1.10.2 tls #include <sys/syscallsubr.h>
83 1.1.1.1.10.2 tls #include <net/if.h>
84 1.1.1.1.10.2 tls #include <net/radix.h>
85 1.1.1.1.10.2 tls #include <net/route.h>
86 1.1.1.1.10.2 tls #include <net/if_dl.h>
87 1.1.1.1.10.2 tls #include <netinet/in.h>
88 1.1.1.1.10.2 tls #include <netinet/in_pcb.h>
89 1.1.1.1.10.2 tls #include <netinet/in_systm.h>
90 1.1.1.1.10.2 tls #include <netinet/in_var.h>
91 1.1.1.1.10.2 tls #include <netinet/ip.h>
92 1.1.1.1.10.2 tls #include <netinet/ip_var.h>
93 1.1.1.1.10.2 tls #include <netinet/tcp.h>
94 1.1.1.1.10.2 tls #include <netinet/tcp_fsm.h>
95 1.1.1.1.10.2 tls #include <netinet/tcp_seq.h>
96 1.1.1.1.10.2 tls #include <netinet/tcp_timer.h>
97 1.1.1.1.10.2 tls #include <netinet/tcp_var.h>
98 1.1.1.1.10.2 tls #include <machine/in_cksum.h>
99 1.1.1.1.10.2 tls #include <crypto/des/des.h>
100 1.1.1.1.10.2 tls #include <sys/md5.h>
101 1.1.1.1.10.2 tls #include <rpc/rpc.h>
102 1.1.1.1.10.2 tls #include <rpc/rpcsec_gss.h>
103 1.1.1.1.10.2 tls
104 1.1.1.1.10.2 tls /*
105 1.1.1.1.10.2 tls * For Darwin, these functions should be "static" when built in a kext.
106 1.1.1.1.10.2 tls * (This is always defined as nil otherwise.)
107 1.1.1.1.10.2 tls */
108 1.1.1.1.10.2 tls #define APPLESTATIC
109 1.1.1.1.10.2 tls #include <ufs/ufs/dir.h>
110 1.1.1.1.10.2 tls #include <ufs/ufs/quota.h>
111 1.1.1.1.10.2 tls #include <ufs/ufs/inode.h>
112 1.1.1.1.10.2 tls #include <ufs/ufs/extattr.h>
113 1.1.1.1.10.2 tls #include <ufs/ufs/ufsmount.h>
114 1.1.1.1.10.2 tls #include <vm/uma.h>
115 1.1.1.1.10.2 tls #include <vm/vm.h>
116 1.1.1.1.10.2 tls #include <vm/vm_object.h>
117 1.1.1.1.10.2 tls #include <vm/vm_extern.h>
118 1.1.1.1.10.2 tls #include <nfs/nfssvc.h>
119 1.1.1.1.10.2 tls #include "opt_nfs.h"
120 1.1.1.1.10.2 tls #include "opt_ufs.h"
121 1.1.1.1.10.2 tls
122 1.1.1.1.10.2 tls /*
123 1.1.1.1.10.2 tls * These types must be defined before the nfs includes.
124 1.1.1.1.10.2 tls */
125 1.1.1.1.10.2 tls #define NFSSOCKADDR_T struct sockaddr *
126 1.1.1.1.10.2 tls #define NFSPROC_T struct thread
127 1.1.1.1.10.2 tls #define NFSDEV_T dev_t
128 1.1.1.1.10.2 tls #define NFSSVCARGS nfssvc_args
129 1.1.1.1.10.2 tls #define NFSACL_T struct acl
130 1.1.1.1.10.2 tls
131 1.1.1.1.10.2 tls /*
132 1.1.1.1.10.2 tls * These should be defined as the types used for the corresponding VOP's
133 1.1.1.1.10.2 tls * argument type.
134 1.1.1.1.10.2 tls */
135 1.1.1.1.10.2 tls #define NFS_ACCESS_ARGS struct vop_access_args
136 1.1.1.1.10.2 tls #define NFS_OPEN_ARGS struct vop_open_args
137 1.1.1.1.10.2 tls #define NFS_GETATTR_ARGS struct vop_getattr_args
138 1.1.1.1.10.2 tls #define NFS_LOOKUP_ARGS struct vop_lookup_args
139 1.1.1.1.10.2 tls #define NFS_READDIR_ARGS struct vop_readdir_args
140 1.1.1.1.10.2 tls
141 1.1.1.1.10.2 tls /*
142 1.1.1.1.10.2 tls * Allocate mbufs. Must succeed and never set the mbuf ptr to NULL.
143 1.1.1.1.10.2 tls */
144 1.1.1.1.10.2 tls #define NFSMGET(m) do { \
145 1.1.1.1.10.2 tls MGET((m), M_WAITOK, MT_DATA); \
146 1.1.1.1.10.2 tls while ((m) == NULL ) { \
147 1.1.1.1.10.2 tls (void) nfs_catnap(PZERO, 0, "nfsmget"); \
148 1.1.1.1.10.2 tls MGET((m), M_WAITOK, MT_DATA); \
149 1.1.1.1.10.2 tls } \
150 1.1.1.1.10.2 tls } while (0)
151 1.1.1.1.10.2 tls #define NFSMGETHDR(m) do { \
152 1.1.1.1.10.2 tls MGETHDR((m), M_WAITOK, MT_DATA); \
153 1.1.1.1.10.2 tls while ((m) == NULL ) { \
154 1.1.1.1.10.2 tls (void) nfs_catnap(PZERO, 0, "nfsmget"); \
155 1.1.1.1.10.2 tls MGETHDR((m), M_WAITOK, MT_DATA); \
156 1.1.1.1.10.2 tls } \
157 1.1.1.1.10.2 tls } while (0)
158 1.1.1.1.10.2 tls #define NFSMCLGET(m, w) do { \
159 1.1.1.1.10.2 tls MGET((m), M_WAITOK, MT_DATA); \
160 1.1.1.1.10.2 tls while ((m) == NULL ) { \
161 1.1.1.1.10.2 tls (void) nfs_catnap(PZERO, 0, "nfsmget"); \
162 1.1.1.1.10.2 tls MGET((m), M_WAITOK, MT_DATA); \
163 1.1.1.1.10.2 tls } \
164 1.1.1.1.10.2 tls MCLGET((m), (w)); \
165 1.1.1.1.10.2 tls } while (0)
166 1.1.1.1.10.2 tls #define NFSMCLGETHDR(m, w) do { \
167 1.1.1.1.10.2 tls MGETHDR((m), M_WAITOK, MT_DATA); \
168 1.1.1.1.10.2 tls while ((m) == NULL ) { \
169 1.1.1.1.10.2 tls (void) nfs_catnap(PZERO, 0, "nfsmget"); \
170 1.1.1.1.10.2 tls MGETHDR((m), M_WAITOK, MT_DATA); \
171 1.1.1.1.10.2 tls } \
172 1.1.1.1.10.2 tls } while (0)
173 1.1.1.1.10.2 tls #define NFSMTOD mtod
174 1.1.1.1.10.2 tls
175 1.1.1.1.10.2 tls /*
176 1.1.1.1.10.2 tls * Client side constant for size of a lockowner name.
177 1.1.1.1.10.2 tls */
178 1.1.1.1.10.2 tls #define NFSV4CL_LOCKNAMELEN 12
179 1.1.1.1.10.2 tls
180 1.1.1.1.10.2 tls /*
181 1.1.1.1.10.2 tls * Type for a mutex lock.
182 1.1.1.1.10.2 tls */
183 1.1.1.1.10.2 tls #define NFSMUTEX_T struct mtx
184 1.1.1.1.10.2 tls
185 1.1.1.1.10.2 tls #endif /* _KERNEL */
186 1.1.1.1.10.2 tls
187 1.1.1.1.10.2 tls /*
188 1.1.1.1.10.2 tls * NFSv4 Operation numbers.
189 1.1.1.1.10.2 tls */
190 1.1.1.1.10.2 tls #define NFSV4OP_ACCESS 3
191 1.1.1.1.10.2 tls #define NFSV4OP_CLOSE 4
192 1.1.1.1.10.2 tls #define NFSV4OP_COMMIT 5
193 1.1.1.1.10.2 tls #define NFSV4OP_CREATE 6
194 1.1.1.1.10.2 tls #define NFSV4OP_DELEGPURGE 7
195 1.1.1.1.10.2 tls #define NFSV4OP_DELEGRETURN 8
196 1.1.1.1.10.2 tls #define NFSV4OP_GETATTR 9
197 1.1.1.1.10.2 tls #define NFSV4OP_GETFH 10
198 1.1.1.1.10.2 tls #define NFSV4OP_LINK 11
199 1.1.1.1.10.2 tls #define NFSV4OP_LOCK 12
200 1.1.1.1.10.2 tls #define NFSV4OP_LOCKT 13
201 1.1.1.1.10.2 tls #define NFSV4OP_LOCKU 14
202 1.1.1.1.10.2 tls #define NFSV4OP_LOOKUP 15
203 1.1.1.1.10.2 tls #define NFSV4OP_LOOKUPP 16
204 1.1.1.1.10.2 tls #define NFSV4OP_NVERIFY 17
205 1.1.1.1.10.2 tls #define NFSV4OP_OPEN 18
206 1.1.1.1.10.2 tls #define NFSV4OP_OPENATTR 19
207 1.1.1.1.10.2 tls #define NFSV4OP_OPENCONFIRM 20
208 1.1.1.1.10.2 tls #define NFSV4OP_OPENDOWNGRADE 21
209 1.1.1.1.10.2 tls #define NFSV4OP_PUTFH 22
210 1.1.1.1.10.2 tls #define NFSV4OP_PUTPUBFH 23
211 1.1.1.1.10.2 tls #define NFSV4OP_PUTROOTFH 24
212 1.1.1.1.10.2 tls #define NFSV4OP_READ 25
213 1.1.1.1.10.2 tls #define NFSV4OP_READDIR 26
214 1.1.1.1.10.2 tls #define NFSV4OP_READLINK 27
215 1.1.1.1.10.2 tls #define NFSV4OP_REMOVE 28
216 1.1.1.1.10.2 tls #define NFSV4OP_RENAME 29
217 1.1.1.1.10.2 tls #define NFSV4OP_RENEW 30
218 1.1.1.1.10.2 tls #define NFSV4OP_RESTOREFH 31
219 1.1.1.1.10.2 tls #define NFSV4OP_SAVEFH 32
220 1.1.1.1.10.2 tls #define NFSV4OP_SECINFO 33
221 1.1.1.1.10.2 tls #define NFSV4OP_SETATTR 34
222 1.1.1.1.10.2 tls #define NFSV4OP_SETCLIENTID 35
223 1.1.1.1.10.2 tls #define NFSV4OP_SETCLIENTIDCFRM 36
224 1.1.1.1.10.2 tls #define NFSV4OP_VERIFY 37
225 1.1.1.1.10.2 tls #define NFSV4OP_WRITE 38
226 1.1.1.1.10.2 tls #define NFSV4OP_RELEASELCKOWN 39
227 1.1.1.1.10.2 tls
228 1.1.1.1.10.2 tls /*
229 1.1.1.1.10.2 tls * Must be one greater than the last Operation#.
230 1.1.1.1.10.2 tls */
231 1.1.1.1.10.2 tls #define NFSV4OP_NOPS 40
232 1.1.1.1.10.2 tls
233 1.1.1.1.10.2 tls /*
234 1.1.1.1.10.2 tls * Additional Ops for NFSv4.1.
235 1.1.1.1.10.2 tls */
236 1.1.1.1.10.2 tls #define NFSV4OP_BACKCHANNELCTL 40
237 1.1.1.1.10.2 tls #define NFSV4OP_BINDCONNTOSESS 41
238 1.1.1.1.10.2 tls #define NFSV4OP_EXCHANGEID 42
239 1.1.1.1.10.2 tls #define NFSV4OP_CREATESESSION 43
240 1.1.1.1.10.2 tls #define NFSV4OP_DESTROYSESSION 44
241 1.1.1.1.10.2 tls #define NFSV4OP_FREESTATEID 45
242 1.1.1.1.10.2 tls #define NFSV4OP_GETDIRDELEG 46
243 1.1.1.1.10.2 tls #define NFSV4OP_GETDEVINFO 47
244 1.1.1.1.10.2 tls #define NFSV4OP_GETDEVLIST 48
245 1.1.1.1.10.2 tls #define NFSV4OP_LAYOUTCOMMIT 49
246 1.1.1.1.10.2 tls #define NFSV4OP_LAYOUTGET 50
247 1.1.1.1.10.2 tls #define NFSV4OP_LAYOUTRETURN 51
248 1.1.1.1.10.2 tls #define NFSV4OP_SECINFONONAME 52
249 1.1.1.1.10.2 tls #define NFSV4OP_SEQUENCE 53
250 1.1.1.1.10.2 tls #define NFSV4OP_SETSSV 54
251 1.1.1.1.10.2 tls #define NFSV4OP_TESTSTATEID 55
252 1.1.1.1.10.2 tls #define NFSV4OP_WANTDELEG 56
253 1.1.1.1.10.2 tls #define NFSV4OP_DESTROYCLIENTID 57
254 1.1.1.1.10.2 tls #define NFSV4OP_RECLAIMCOMPL 58
255 1.1.1.1.10.2 tls
256 1.1.1.1.10.2 tls /*
257 1.1.1.1.10.2 tls * Must be one more than last op#.
258 1.1.1.1.10.2 tls */
259 1.1.1.1.10.2 tls #define NFSV41_NOPS 59
260 1.1.1.1.10.2 tls
261 1.1.1.1.10.2 tls /* Quirky case if the illegal op code */
262 1.1.1.1.10.2 tls #define NFSV4OP_OPILLEGAL 10044
263 1.1.1.1.10.2 tls
264 1.1.1.1.10.2 tls /*
265 1.1.1.1.10.2 tls * Fake NFSV4OP_xxx used for nfsstat. Start at NFSV4OP_NOPS.
266 1.1.1.1.10.2 tls */
267 1.1.1.1.10.2 tls #define NFSV4OP_SYMLINK (NFSV4OP_NOPS)
268 1.1.1.1.10.2 tls #define NFSV4OP_MKDIR (NFSV4OP_NOPS + 1)
269 1.1.1.1.10.2 tls #define NFSV4OP_RMDIR (NFSV4OP_NOPS + 2)
270 1.1.1.1.10.2 tls #define NFSV4OP_READDIRPLUS (NFSV4OP_NOPS + 3)
271 1.1.1.1.10.2 tls #define NFSV4OP_MKNOD (NFSV4OP_NOPS + 4)
272 1.1.1.1.10.2 tls #define NFSV4OP_FSSTAT (NFSV4OP_NOPS + 5)
273 1.1.1.1.10.2 tls #define NFSV4OP_FSINFO (NFSV4OP_NOPS + 6)
274 1.1.1.1.10.2 tls #define NFSV4OP_PATHCONF (NFSV4OP_NOPS + 7)
275 1.1.1.1.10.2 tls #define NFSV4OP_V3CREATE (NFSV4OP_NOPS + 8)
276 1.1.1.1.10.2 tls
277 1.1.1.1.10.2 tls /*
278 1.1.1.1.10.2 tls * This is the count of the fake operations listed above.
279 1.1.1.1.10.2 tls */
280 1.1.1.1.10.2 tls #define NFSV4OP_FAKENOPS 9
281 1.1.1.1.10.2 tls
282 1.1.1.1.10.2 tls /*
283 1.1.1.1.10.2 tls * and the Callback OPs
284 1.1.1.1.10.2 tls */
285 1.1.1.1.10.2 tls #define NFSV4OP_CBGETATTR 3
286 1.1.1.1.10.2 tls #define NFSV4OP_CBRECALL 4
287 1.1.1.1.10.2 tls
288 1.1.1.1.10.2 tls /*
289 1.1.1.1.10.2 tls * Must be one greater than the last Callback Operation#.
290 1.1.1.1.10.2 tls */
291 1.1.1.1.10.2 tls #define NFSV4OP_CBNOPS 5
292 1.1.1.1.10.2 tls
293 1.1.1.1.10.2 tls /*
294 1.1.1.1.10.2 tls * Additional Callback Ops for NFSv4.1 only. Not yet in nfsstats.
295 1.1.1.1.10.2 tls */
296 1.1.1.1.10.2 tls #define NFSV4OP_CBLAYOUTRECALL 5
297 1.1.1.1.10.2 tls #define NFSV4OP_CBNOTIFY 6
298 1.1.1.1.10.2 tls #define NFSV4OP_CBPUSHDELEG 7
299 1.1.1.1.10.2 tls #define NFSV4OP_CBRECALLANY 8
300 1.1.1.1.10.2 tls #define NFSV4OP_CBRECALLOBJAVAIL 9
301 1.1.1.1.10.2 tls #define NFSV4OP_CBRECALLSLOT 10
302 1.1.1.1.10.2 tls #define NFSV4OP_CBSEQUENCE 11
303 1.1.1.1.10.2 tls #define NFSV4OP_CBWANTCANCELLED 12
304 1.1.1.1.10.2 tls #define NFSV4OP_CBNOTIFYLOCK 13
305 1.1.1.1.10.2 tls #define NFSV4OP_CBNOTIFYDEVID 14
306 1.1.1.1.10.2 tls
307 1.1.1.1.10.2 tls /*
308 1.1.1.1.10.2 tls * The lower numbers -> 21 are used by NFSv2 and v3. These define higher
309 1.1.1.1.10.2 tls * numbers used by NFSv4.
310 1.1.1.1.10.2 tls * NFS_V3NPROCS is one greater than the last V3 op and NFS_NPROCS is
311 1.1.1.1.10.2 tls * one greater than the last number.
312 1.1.1.1.10.2 tls */
313 1.1.1.1.10.2 tls #ifndef NFS_V3NPROCS
314 1.1.1.1.10.2 tls #define NFS_V3NPROCS 22
315 1.1.1.1.10.2 tls
316 1.1.1.1.10.2 tls #define NFSPROC_LOOKUPP 22
317 1.1.1.1.10.2 tls #define NFSPROC_SETCLIENTID 23
318 1.1.1.1.10.2 tls #define NFSPROC_SETCLIENTIDCFRM 24
319 1.1.1.1.10.2 tls #define NFSPROC_LOCK 25
320 1.1.1.1.10.2 tls #define NFSPROC_LOCKU 26
321 1.1.1.1.10.2 tls #define NFSPROC_OPEN 27
322 1.1.1.1.10.2 tls #define NFSPROC_CLOSE 28
323 1.1.1.1.10.2 tls #define NFSPROC_OPENCONFIRM 29
324 1.1.1.1.10.2 tls #define NFSPROC_LOCKT 30
325 1.1.1.1.10.2 tls #define NFSPROC_OPENDOWNGRADE 31
326 1.1.1.1.10.2 tls #define NFSPROC_RENEW 32
327 1.1.1.1.10.2 tls #define NFSPROC_PUTROOTFH 33
328 1.1.1.1.10.2 tls #define NFSPROC_RELEASELCKOWN 34
329 1.1.1.1.10.2 tls #define NFSPROC_DELEGRETURN 35
330 1.1.1.1.10.2 tls #define NFSPROC_RETDELEGREMOVE 36
331 1.1.1.1.10.2 tls #define NFSPROC_RETDELEGRENAME1 37
332 1.1.1.1.10.2 tls #define NFSPROC_RETDELEGRENAME2 38
333 1.1.1.1.10.2 tls #define NFSPROC_GETACL 39
334 1.1.1.1.10.2 tls #define NFSPROC_SETACL 40
335 1.1.1.1.10.2 tls
336 1.1.1.1.10.2 tls /*
337 1.1.1.1.10.2 tls * Must be defined as one higher than the last Proc# above.
338 1.1.1.1.10.2 tls */
339 1.1.1.1.10.2 tls #define NFSV4_NPROCS 41
340 1.1.1.1.10.2 tls
341 1.1.1.1.10.2 tls /* Additional procedures for NFSv4.1. */
342 1.1.1.1.10.2 tls #define NFSPROC_EXCHANGEID 41
343 1.1.1.1.10.2 tls #define NFSPROC_CREATESESSION 42
344 1.1.1.1.10.2 tls #define NFSPROC_DESTROYSESSION 43
345 1.1.1.1.10.2 tls #define NFSPROC_DESTROYCLIENT 44
346 1.1.1.1.10.2 tls #define NFSPROC_FREESTATEID 45
347 1.1.1.1.10.2 tls #define NFSPROC_LAYOUTGET 46
348 1.1.1.1.10.2 tls #define NFSPROC_GETDEVICEINFO 47
349 1.1.1.1.10.2 tls #define NFSPROC_LAYOUTCOMMIT 48
350 1.1.1.1.10.2 tls #define NFSPROC_LAYOUTRETURN 49
351 1.1.1.1.10.2 tls #define NFSPROC_RECLAIMCOMPL 50
352 1.1.1.1.10.2 tls #define NFSPROC_WRITEDS 51
353 1.1.1.1.10.2 tls #define NFSPROC_READDS 52
354 1.1.1.1.10.2 tls #define NFSPROC_COMMITDS 53
355 1.1.1.1.10.2 tls
356 1.1.1.1.10.2 tls /*
357 1.1.1.1.10.2 tls * Must be defined as one higher than the last NFSv4.1 Proc# above.
358 1.1.1.1.10.2 tls */
359 1.1.1.1.10.2 tls #define NFSV41_NPROCS 54
360 1.1.1.1.10.2 tls
361 1.1.1.1.10.2 tls #endif /* NFS_V3NPROCS */
362 1.1.1.1.10.2 tls
363 1.1.1.1.10.2 tls /*
364 1.1.1.1.10.2 tls * Stats structure
365 1.1.1.1.10.2 tls */
366 1.1.1.1.10.2 tls struct ext_nfsstats {
367 1.1.1.1.10.2 tls int attrcache_hits;
368 1.1.1.1.10.2 tls int attrcache_misses;
369 1.1.1.1.10.2 tls int lookupcache_hits;
370 1.1.1.1.10.2 tls int lookupcache_misses;
371 1.1.1.1.10.2 tls int direofcache_hits;
372 1.1.1.1.10.2 tls int direofcache_misses;
373 1.1.1.1.10.2 tls int accesscache_hits;
374 1.1.1.1.10.2 tls int accesscache_misses;
375 1.1.1.1.10.2 tls int biocache_reads;
376 1.1.1.1.10.2 tls int read_bios;
377 1.1.1.1.10.2 tls int read_physios;
378 1.1.1.1.10.2 tls int biocache_writes;
379 1.1.1.1.10.2 tls int write_bios;
380 1.1.1.1.10.2 tls int write_physios;
381 1.1.1.1.10.2 tls int biocache_readlinks;
382 1.1.1.1.10.2 tls int readlink_bios;
383 1.1.1.1.10.2 tls int biocache_readdirs;
384 1.1.1.1.10.2 tls int readdir_bios;
385 1.1.1.1.10.2 tls int rpccnt[NFSV4_NPROCS];
386 1.1.1.1.10.2 tls int rpcretries;
387 1.1.1.1.10.2 tls int srvrpccnt[NFSV4OP_NOPS + NFSV4OP_FAKENOPS];
388 1.1.1.1.10.2 tls int srvrpc_errs;
389 1.1.1.1.10.2 tls int srv_errs;
390 1.1.1.1.10.2 tls int rpcrequests;
391 1.1.1.1.10.2 tls int rpctimeouts;
392 1.1.1.1.10.2 tls int rpcunexpected;
393 1.1.1.1.10.2 tls int rpcinvalid;
394 1.1.1.1.10.2 tls int srvcache_inproghits;
395 1.1.1.1.10.2 tls int srvcache_idemdonehits;
396 1.1.1.1.10.2 tls int srvcache_nonidemdonehits;
397 1.1.1.1.10.2 tls int srvcache_misses;
398 1.1.1.1.10.2 tls int srvcache_tcppeak;
399 1.1.1.1.10.2 tls int srvcache_size;
400 1.1.1.1.10.2 tls int srvclients;
401 1.1.1.1.10.2 tls int srvopenowners;
402 1.1.1.1.10.2 tls int srvopens;
403 1.1.1.1.10.2 tls int srvlockowners;
404 1.1.1.1.10.2 tls int srvlocks;
405 1.1.1.1.10.2 tls int srvdelegates;
406 1.1.1.1.10.2 tls int cbrpccnt[NFSV4OP_CBNOPS];
407 1.1.1.1.10.2 tls int clopenowners;
408 1.1.1.1.10.2 tls int clopens;
409 1.1.1.1.10.2 tls int cllockowners;
410 1.1.1.1.10.2 tls int cllocks;
411 1.1.1.1.10.2 tls int cldelegates;
412 1.1.1.1.10.2 tls int cllocalopenowners;
413 1.1.1.1.10.2 tls int cllocalopens;
414 1.1.1.1.10.2 tls int cllocallockowners;
415 1.1.1.1.10.2 tls int cllocallocks;
416 1.1.1.1.10.2 tls };
417 1.1.1.1.10.2 tls
418 1.1.1.1.10.2 tls #ifdef _KERNEL
419 1.1.1.1.10.2 tls /*
420 1.1.1.1.10.2 tls * Define the ext_nfsstats as nfsstats for the kernel code.
421 1.1.1.1.10.2 tls */
422 1.1.1.1.10.2 tls #define nfsstats ext_nfsstats
423 1.1.1.1.10.2 tls
424 1.1.1.1.10.2 tls /*
425 1.1.1.1.10.2 tls * Define NFS_NPROCS as NFSV4_NPROCS for the experimental kernel code.
426 1.1.1.1.10.2 tls */
427 1.1.1.1.10.2 tls #ifndef NFS_NPROCS
428 1.1.1.1.10.2 tls #define NFS_NPROCS NFSV4_NPROCS
429 1.1.1.1.10.2 tls #endif
430 1.1.1.1.10.2 tls
431 1.1.1.1.10.2 tls #include <fs/nfs/nfskpiport.h>
432 1.1.1.1.10.2 tls #include <fs/nfs/nfsdport.h>
433 1.1.1.1.10.2 tls #include <fs/nfs/rpcv2.h>
434 1.1.1.1.10.2 tls #include <fs/nfs/nfsproto.h>
435 1.1.1.1.10.2 tls #include <fs/nfs/nfs.h>
436 1.1.1.1.10.2 tls #include <fs/nfs/nfsclstate.h>
437 1.1.1.1.10.2 tls #include <fs/nfs/nfs_var.h>
438 1.1.1.1.10.2 tls #include <fs/nfs/nfsm_subs.h>
439 1.1.1.1.10.2 tls #include <fs/nfs/nfsrvcache.h>
440 1.1.1.1.10.2 tls #include <fs/nfs/nfsrvstate.h>
441 1.1.1.1.10.2 tls #include <fs/nfs/xdr_subs.h>
442 1.1.1.1.10.2 tls #include <fs/nfs/nfscl.h>
443 1.1.1.1.10.2 tls #include <nfsclient/nfsargs.h>
444 1.1.1.1.10.2 tls #include <fs/nfsclient/nfsmount.h>
445 1.1.1.1.10.2 tls
446 1.1.1.1.10.2 tls /*
447 1.1.1.1.10.2 tls * Just to keep nfs_var.h happy.
448 1.1.1.1.10.2 tls */
449 1.1.1.1.10.2 tls struct nfs_vattr {
450 1.1.1.1.10.2 tls int junk;
451 1.1.1.1.10.2 tls };
452 1.1.1.1.10.2 tls
453 1.1.1.1.10.2 tls struct nfsvattr {
454 1.1.1.1.10.2 tls struct vattr na_vattr;
455 1.1.1.1.10.2 tls nfsattrbit_t na_suppattr;
456 1.1.1.1.10.2 tls u_int32_t na_mntonfileno;
457 1.1.1.1.10.2 tls u_int64_t na_filesid[2];
458 1.1.1.1.10.2 tls };
459 1.1.1.1.10.2 tls
460 1.1.1.1.10.2 tls #define na_type na_vattr.va_type
461 1.1.1.1.10.2 tls #define na_mode na_vattr.va_mode
462 1.1.1.1.10.2 tls #define na_nlink na_vattr.va_nlink
463 1.1.1.1.10.2 tls #define na_uid na_vattr.va_uid
464 1.1.1.1.10.2 tls #define na_gid na_vattr.va_gid
465 1.1.1.1.10.2 tls #define na_fsid na_vattr.va_fsid
466 1.1.1.1.10.2 tls #define na_fileid na_vattr.va_fileid
467 1.1.1.1.10.2 tls #define na_size na_vattr.va_size
468 1.1.1.1.10.2 tls #define na_blocksize na_vattr.va_blocksize
469 1.1.1.1.10.2 tls #define na_atime na_vattr.va_atime
470 1.1.1.1.10.2 tls #define na_mtime na_vattr.va_mtime
471 1.1.1.1.10.2 tls #define na_ctime na_vattr.va_ctime
472 1.1.1.1.10.2 tls #define na_gen na_vattr.va_gen
473 1.1.1.1.10.2 tls #define na_flags na_vattr.va_flags
474 1.1.1.1.10.2 tls #define na_rdev na_vattr.va_rdev
475 1.1.1.1.10.2 tls #define na_bytes na_vattr.va_bytes
476 1.1.1.1.10.2 tls #define na_filerev na_vattr.va_filerev
477 1.1.1.1.10.2 tls #define na_vaflags na_vattr.va_vaflags
478 1.1.1.1.10.2 tls
479 1.1.1.1.10.2 tls #include <fs/nfsclient/nfsnode.h>
480 1.1.1.1.10.2 tls
481 1.1.1.1.10.2 tls /*
482 1.1.1.1.10.2 tls * This is the header structure used for the lists, etc. (It has the
483 1.1.1.1.10.2 tls * above record in it.
484 1.1.1.1.10.2 tls */
485 1.1.1.1.10.2 tls struct nfsrv_stablefirst {
486 1.1.1.1.10.2 tls LIST_HEAD(, nfsrv_stable) nsf_head; /* Head of nfsrv_stable list */
487 1.1.1.1.10.2 tls time_t nsf_eograce; /* Time grace period ends */
488 1.1.1.1.10.2 tls time_t *nsf_bootvals; /* Previous boottime values */
489 1.1.1.1.10.2 tls struct file *nsf_fp; /* File table pointer */
490 1.1.1.1.10.2 tls u_char nsf_flags; /* NFSNSF_ flags */
491 1.1.1.1.10.2 tls struct nfsf_rec nsf_rec; /* and above first record */
492 1.1.1.1.10.2 tls };
493 1.1.1.1.10.2 tls #define nsf_lease nsf_rec.lease
494 1.1.1.1.10.2 tls #define nsf_numboots nsf_rec.numboots
495 1.1.1.1.10.2 tls
496 1.1.1.1.10.2 tls /* NFSNSF_xxx flags */
497 1.1.1.1.10.2 tls #define NFSNSF_UPDATEDONE 0x01
498 1.1.1.1.10.2 tls #define NFSNSF_GRACEOVER 0x02
499 1.1.1.1.10.2 tls #define NFSNSF_NEEDLOCK 0x04
500 1.1.1.1.10.2 tls #define NFSNSF_EXPIREDCLIENT 0x08
501 1.1.1.1.10.2 tls #define NFSNSF_NOOPENS 0x10
502 1.1.1.1.10.2 tls #define NFSNSF_OK 0x20
503 1.1.1.1.10.2 tls
504 1.1.1.1.10.2 tls /*
505 1.1.1.1.10.2 tls * Maximum number of boot times allowed in record. Although there is
506 1.1.1.1.10.2 tls * really no need for a fixed upper bound, this serves as a sanity check
507 1.1.1.1.10.2 tls * for a corrupted file.
508 1.1.1.1.10.2 tls */
509 1.1.1.1.10.2 tls #define NFSNSF_MAXNUMBOOTS 10000
510 1.1.1.1.10.2 tls
511 1.1.1.1.10.2 tls /*
512 1.1.1.1.10.2 tls * This structure defines the other records in the file. The
513 1.1.1.1.10.2 tls * nst_client array is actually the size of the client string name.
514 1.1.1.1.10.2 tls */
515 1.1.1.1.10.2 tls struct nfst_rec {
516 1.1.1.1.10.2 tls u_int16_t len;
517 1.1.1.1.10.2 tls u_char flag;
518 1.1.1.1.10.2 tls u_char client[1];
519 1.1.1.1.10.2 tls };
520 1.1.1.1.10.2 tls /* and the values for flag */
521 1.1.1.1.10.2 tls #define NFSNST_NEWSTATE 0x1
522 1.1.1.1.10.2 tls #define NFSNST_REVOKE 0x2
523 1.1.1.1.10.2 tls #define NFSNST_GOTSTATE 0x4
524 1.1.1.1.10.2 tls
525 1.1.1.1.10.2 tls /*
526 1.1.1.1.10.2 tls * This structure is linked onto nfsrv_stablefirst for the duration of
527 1.1.1.1.10.2 tls * reclaim.
528 1.1.1.1.10.2 tls */
529 1.1.1.1.10.2 tls struct nfsrv_stable {
530 1.1.1.1.10.2 tls LIST_ENTRY(nfsrv_stable) nst_list;
531 1.1.1.1.10.2 tls struct nfsclient *nst_clp;
532 1.1.1.1.10.2 tls struct nfst_rec nst_rec;
533 1.1.1.1.10.2 tls };
534 1.1.1.1.10.2 tls #define nst_timestamp nst_rec.timestamp
535 1.1.1.1.10.2 tls #define nst_len nst_rec.len
536 1.1.1.1.10.2 tls #define nst_flag nst_rec.flag
537 1.1.1.1.10.2 tls #define nst_client nst_rec.client
538 1.1.1.1.10.2 tls
539 1.1.1.1.10.2 tls /*
540 1.1.1.1.10.2 tls * At some point the server will run out of kernel storage for
541 1.1.1.1.10.2 tls * state structures. For FreeBSD5.2, this results in a panic
542 1.1.1.1.10.2 tls * kmem_map is full. It happens at well over 1000000 opens plus
543 1.1.1.1.10.2 tls * locks on a PIII-800 with 256Mbytes, so that is where I've set
544 1.1.1.1.10.2 tls * the limit. If your server panics due to too many opens/locks,
545 1.1.1.1.10.2 tls * decrease the size of NFSRV_V4STATELIMIT. If you find the server
546 1.1.1.1.10.2 tls * returning NFS4ERR_RESOURCE a lot and have lots of memory, try
547 1.1.1.1.10.2 tls * increasing it.
548 1.1.1.1.10.2 tls */
549 1.1.1.1.10.2 tls #define NFSRV_V4STATELIMIT 500000 /* Max # of Opens + Locks */
550 1.1.1.1.10.2 tls
551 1.1.1.1.10.2 tls /*
552 1.1.1.1.10.2 tls * The type required differs with BSDen (just the second arg).
553 1.1.1.1.10.2 tls */
554 1.1.1.1.10.2 tls void nfsrvd_rcv(struct socket *, void *, int);
555 1.1.1.1.10.2 tls
556 1.1.1.1.10.2 tls /*
557 1.1.1.1.10.2 tls * Macros for handling socket addresses. (Hopefully this makes the code
558 1.1.1.1.10.2 tls * more portable, since I've noticed some 'BSD don't have sockaddrs in
559 1.1.1.1.10.2 tls * mbufs any more.)
560 1.1.1.1.10.2 tls */
561 1.1.1.1.10.2 tls #define NFSSOCKADDR(a, t) ((t)(a))
562 1.1.1.1.10.2 tls #define NFSSOCKADDRALLOC(a) \
563 1.1.1.1.10.2 tls do { \
564 1.1.1.1.10.2 tls MALLOC((a), struct sockaddr *, sizeof (struct sockaddr), \
565 1.1.1.1.10.2 tls M_SONAME, M_WAITOK); \
566 1.1.1.1.10.2 tls NFSBZERO((a), sizeof (struct sockaddr)); \
567 1.1.1.1.10.2 tls } while (0)
568 1.1.1.1.10.2 tls #define NFSSOCKADDRSIZE(a, s) ((a)->sa_len = (s))
569 1.1.1.1.10.2 tls #define NFSSOCKADDRFREE(a) \
570 1.1.1.1.10.2 tls do { \
571 1.1.1.1.10.2 tls if (a) \
572 1.1.1.1.10.2 tls FREE((caddr_t)(a), M_SONAME); \
573 1.1.1.1.10.2 tls } while (0)
574 1.1.1.1.10.2 tls
575 1.1.1.1.10.2 tls /*
576 1.1.1.1.10.2 tls * These should be defined as a process or thread structure, as required
577 1.1.1.1.10.2 tls * for signal handling, etc.
578 1.1.1.1.10.2 tls */
579 1.1.1.1.10.2 tls #define NFSNEWCRED(c) (crdup(c))
580 1.1.1.1.10.2 tls #define NFSPROCCRED(p) ((p)->td_ucred)
581 1.1.1.1.10.2 tls #define NFSFREECRED(c) (crfree(c))
582 1.1.1.1.10.2 tls #define NFSUIOPROC(u, p) ((u)->uio_td = NULL)
583 1.1.1.1.10.2 tls #define NFSPROCP(p) ((p)->td_proc)
584 1.1.1.1.10.2 tls
585 1.1.1.1.10.2 tls /*
586 1.1.1.1.10.2 tls * Define these so that cn_hash and its length is ignored.
587 1.1.1.1.10.2 tls */
588 1.1.1.1.10.2 tls #define NFSCNHASHZERO(c)
589 1.1.1.1.10.2 tls #define NFSCNHASH(c, v)
590 1.1.1.1.10.2 tls #define NCHNAMLEN 9999999
591 1.1.1.1.10.2 tls
592 1.1.1.1.10.2 tls /*
593 1.1.1.1.10.2 tls * These macros are defined to initialize and set the timer routine.
594 1.1.1.1.10.2 tls */
595 1.1.1.1.10.2 tls #define NFS_TIMERINIT \
596 1.1.1.1.10.2 tls newnfs_timer(NULL)
597 1.1.1.1.10.2 tls
598 1.1.1.1.10.2 tls /*
599 1.1.1.1.10.2 tls * Handle SMP stuff:
600 1.1.1.1.10.2 tls */
601 1.1.1.1.10.2 tls #define NFSSTATESPINLOCK extern struct mtx nfs_state_mutex
602 1.1.1.1.10.2 tls #define NFSLOCKSTATE() mtx_lock(&nfs_state_mutex)
603 1.1.1.1.10.2 tls #define NFSUNLOCKSTATE() mtx_unlock(&nfs_state_mutex)
604 1.1.1.1.10.2 tls #define NFSSTATEMUTEXPTR (&nfs_state_mutex)
605 1.1.1.1.10.2 tls #define NFSREQSPINLOCK extern struct mtx nfs_req_mutex
606 1.1.1.1.10.2 tls #define NFSLOCKREQ() mtx_lock(&nfs_req_mutex)
607 1.1.1.1.10.2 tls #define NFSUNLOCKREQ() mtx_unlock(&nfs_req_mutex)
608 1.1.1.1.10.2 tls #define NFSSOCKMUTEX extern struct mtx nfs_slock_mutex
609 1.1.1.1.10.2 tls #define NFSSOCKMUTEXPTR (&nfs_slock_mutex)
610 1.1.1.1.10.2 tls #define NFSLOCKSOCK() mtx_lock(&nfs_slock_mutex)
611 1.1.1.1.10.2 tls #define NFSUNLOCKSOCK() mtx_unlock(&nfs_slock_mutex)
612 1.1.1.1.10.2 tls #define NFSNAMEIDMUTEX extern struct mtx nfs_nameid_mutex
613 1.1.1.1.10.2 tls #define NFSLOCKNAMEID() mtx_lock(&nfs_nameid_mutex)
614 1.1.1.1.10.2 tls #define NFSUNLOCKNAMEID() mtx_unlock(&nfs_nameid_mutex)
615 1.1.1.1.10.2 tls #define NFSNAMEIDREQUIRED() mtx_assert(&nfs_nameid_mutex, MA_OWNED)
616 1.1.1.1.10.2 tls #define NFSCLSTATEMUTEX extern struct mtx nfs_clstate_mutex
617 1.1.1.1.10.2 tls #define NFSCLSTATEMUTEXPTR (&nfs_clstate_mutex)
618 1.1.1.1.10.2 tls #define NFSLOCKCLSTATE() mtx_lock(&nfs_clstate_mutex)
619 1.1.1.1.10.2 tls #define NFSUNLOCKCLSTATE() mtx_unlock(&nfs_clstate_mutex)
620 1.1.1.1.10.2 tls #define NFSDLOCKMUTEX extern struct mtx newnfsd_mtx
621 1.1.1.1.10.2 tls #define NFSDLOCKMUTEXPTR (&newnfsd_mtx)
622 1.1.1.1.10.2 tls #define NFSD_LOCK() mtx_lock(&newnfsd_mtx)
623 1.1.1.1.10.2 tls #define NFSD_UNLOCK() mtx_unlock(&newnfsd_mtx)
624 1.1.1.1.10.2 tls #define NFSD_LOCK_ASSERT() mtx_assert(&newnfsd_mtx, MA_OWNED)
625 1.1.1.1.10.2 tls #define NFSD_UNLOCK_ASSERT() mtx_assert(&newnfsd_mtx, MA_NOTOWNED)
626 1.1.1.1.10.2 tls #define NFSV4ROOTLOCKMUTEX extern struct mtx nfs_v4root_mutex
627 1.1.1.1.10.2 tls #define NFSV4ROOTLOCKMUTEXPTR (&nfs_v4root_mutex)
628 1.1.1.1.10.2 tls #define NFSLOCKV4ROOTMUTEX() mtx_lock(&nfs_v4root_mutex)
629 1.1.1.1.10.2 tls #define NFSUNLOCKV4ROOTMUTEX() mtx_unlock(&nfs_v4root_mutex)
630 1.1.1.1.10.2 tls #define NFSLOCKNODE(n) mtx_lock(&((n)->n_mtx))
631 1.1.1.1.10.2 tls #define NFSUNLOCKNODE(n) mtx_unlock(&((n)->n_mtx))
632 1.1.1.1.10.2 tls #define NFSLOCKMNT(m) mtx_lock(&((m)->nm_mtx))
633 1.1.1.1.10.2 tls #define NFSUNLOCKMNT(m) mtx_unlock(&((m)->nm_mtx))
634 1.1.1.1.10.2 tls #define NFSLOCKREQUEST(r) mtx_lock(&((r)->r_mtx))
635 1.1.1.1.10.2 tls #define NFSUNLOCKREQUEST(r) mtx_unlock(&((r)->r_mtx))
636 1.1.1.1.10.2 tls #define NFSPROCLISTLOCK() sx_slock(&allproc_lock)
637 1.1.1.1.10.2 tls #define NFSPROCLISTUNLOCK() sx_sunlock(&allproc_lock)
638 1.1.1.1.10.2 tls #define NFSLOCKSOCKREQ(r) mtx_lock(&((r)->nr_mtx))
639 1.1.1.1.10.2 tls #define NFSUNLOCKSOCKREQ(r) mtx_unlock(&((r)->nr_mtx))
640 1.1.1.1.10.2 tls #define NFSLOCKDS(d) mtx_lock(&((d)->nfsclds_mtx))
641 1.1.1.1.10.2 tls #define NFSUNLOCKDS(d) mtx_unlock(&((d)->nfsclds_mtx))
642 1.1.1.1.10.2 tls
643 1.1.1.1.10.2 tls /*
644 1.1.1.1.10.2 tls * Use these macros to initialize/free a mutex.
645 1.1.1.1.10.2 tls */
646 1.1.1.1.10.2 tls #define NFSINITSOCKMUTEX(m) mtx_init((m), "nfssock", NULL, MTX_DEF)
647 1.1.1.1.10.2 tls #define NFSFREEMUTEX(m) mtx_destroy((m))
648 1.1.1.1.10.2 tls
649 1.1.1.1.10.2 tls int nfsmsleep(void *, void *, int, const char *, struct timespec *);
650 1.1.1.1.10.2 tls
651 1.1.1.1.10.2 tls /*
652 1.1.1.1.10.2 tls * And weird vm stuff in the nfs server.
653 1.1.1.1.10.2 tls */
654 1.1.1.1.10.2 tls #define PDIRUNLOCK 0x0
655 1.1.1.1.10.2 tls #define MAX_COMMIT_COUNT (1024 * 1024)
656 1.1.1.1.10.2 tls
657 1.1.1.1.10.2 tls /*
658 1.1.1.1.10.2 tls * Define these to handle the type of va_rdev.
659 1.1.1.1.10.2 tls */
660 1.1.1.1.10.2 tls #define NFSMAKEDEV(m, n) makedev((m), (n))
661 1.1.1.1.10.2 tls #define NFSMAJOR(d) major(d)
662 1.1.1.1.10.2 tls #define NFSMINOR(d) minor(d)
663 1.1.1.1.10.2 tls
664 1.1.1.1.10.2 tls /*
665 1.1.1.1.10.2 tls * Define this to be the macro that returns the minimum size required
666 1.1.1.1.10.2 tls * for a directory entry.
667 1.1.1.1.10.2 tls */
668 1.1.1.1.10.2 tls #define DIRENT_SIZE(dp) GENERIC_DIRSIZ(dp)
669 1.1.1.1.10.2 tls
670 1.1.1.1.10.2 tls /*
671 1.1.1.1.10.2 tls * The vnode tag for nfsv4root.
672 1.1.1.1.10.2 tls */
673 1.1.1.1.10.2 tls #define VT_NFSV4ROOT "nfsv4root"
674 1.1.1.1.10.2 tls
675 1.1.1.1.10.2 tls /*
676 1.1.1.1.10.2 tls * Define whatever it takes to do a vn_rdwr().
677 1.1.1.1.10.2 tls */
678 1.1.1.1.10.2 tls #define NFSD_RDWR(r, v, b, l, o, s, i, c, a, p) \
679 1.1.1.1.10.2 tls vn_rdwr((r), (v), (b), (l), (o), (s), (i), (c), NULL, (a), (p))
680 1.1.1.1.10.2 tls
681 1.1.1.1.10.2 tls /*
682 1.1.1.1.10.2 tls * Macros for handling memory for different BSDen.
683 1.1.1.1.10.2 tls * NFSBCOPY(src, dst, len) - copies len bytes, non-overlapping
684 1.1.1.1.10.2 tls * NFSOVBCOPY(src, dst, len) - ditto, but data areas might overlap
685 1.1.1.1.10.2 tls * NFSBCMP(cp1, cp2, len) - compare len bytes, return 0 if same
686 1.1.1.1.10.2 tls * NFSBZERO(cp, len) - set len bytes to 0x0
687 1.1.1.1.10.2 tls */
688 1.1.1.1.10.2 tls #define NFSBCOPY(s, d, l) bcopy((s), (d), (l))
689 1.1.1.1.10.2 tls #define NFSOVBCOPY(s, d, l) ovbcopy((s), (d), (l))
690 1.1.1.1.10.2 tls #define NFSBCMP(s, d, l) bcmp((s), (d), (l))
691 1.1.1.1.10.2 tls #define NFSBZERO(s, l) bzero((s), (l))
692 1.1.1.1.10.2 tls
693 1.1.1.1.10.2 tls /*
694 1.1.1.1.10.2 tls * Some queue.h files don't have these dfined in them.
695 1.1.1.1.10.2 tls */
696 1.1.1.1.10.2 tls #define LIST_END(head) NULL
697 1.1.1.1.10.2 tls #define SLIST_END(head) NULL
698 1.1.1.1.10.2 tls #define TAILQ_END(head) NULL
699 1.1.1.1.10.2 tls
700 1.1.1.1.10.2 tls /*
701 1.1.1.1.10.2 tls * This must be defined to be a global variable that increments once
702 1.1.1.1.10.2 tls * per second, but never stops or goes backwards, even when a "date"
703 1.1.1.1.10.2 tls * command changes the TOD clock. It is used for delta times for
704 1.1.1.1.10.2 tls * leases, etc.
705 1.1.1.1.10.2 tls */
706 1.1.1.1.10.2 tls #define NFSD_MONOSEC time_uptime
707 1.1.1.1.10.2 tls
708 1.1.1.1.10.2 tls /*
709 1.1.1.1.10.2 tls * Declare the malloc types.
710 1.1.1.1.10.2 tls */
711 1.1.1.1.10.2 tls MALLOC_DECLARE(M_NEWNFSRVCACHE);
712 1.1.1.1.10.2 tls MALLOC_DECLARE(M_NEWNFSDCLIENT);
713 1.1.1.1.10.2 tls MALLOC_DECLARE(M_NEWNFSDSTATE);
714 1.1.1.1.10.2 tls MALLOC_DECLARE(M_NEWNFSDLOCK);
715 1.1.1.1.10.2 tls MALLOC_DECLARE(M_NEWNFSDLOCKFILE);
716 1.1.1.1.10.2 tls MALLOC_DECLARE(M_NEWNFSSTRING);
717 1.1.1.1.10.2 tls MALLOC_DECLARE(M_NEWNFSUSERGROUP);
718 1.1.1.1.10.2 tls MALLOC_DECLARE(M_NEWNFSDREQ);
719 1.1.1.1.10.2 tls MALLOC_DECLARE(M_NEWNFSFH);
720 1.1.1.1.10.2 tls MALLOC_DECLARE(M_NEWNFSCLOWNER);
721 1.1.1.1.10.2 tls MALLOC_DECLARE(M_NEWNFSCLOPEN);
722 1.1.1.1.10.2 tls MALLOC_DECLARE(M_NEWNFSCLDELEG);
723 1.1.1.1.10.2 tls MALLOC_DECLARE(M_NEWNFSCLCLIENT);
724 1.1.1.1.10.2 tls MALLOC_DECLARE(M_NEWNFSCLLOCKOWNER);
725 1.1.1.1.10.2 tls MALLOC_DECLARE(M_NEWNFSCLLOCK);
726 1.1.1.1.10.2 tls MALLOC_DECLARE(M_NEWNFSDIROFF);
727 1.1.1.1.10.2 tls MALLOC_DECLARE(M_NEWNFSV4NODE);
728 1.1.1.1.10.2 tls MALLOC_DECLARE(M_NEWNFSDIRECTIO);
729 1.1.1.1.10.2 tls MALLOC_DECLARE(M_NEWNFSMNT);
730 1.1.1.1.10.2 tls MALLOC_DECLARE(M_NEWNFSDROLLBACK);
731 1.1.1.1.10.2 tls MALLOC_DECLARE(M_NEWNFSLAYOUT);
732 1.1.1.1.10.2 tls MALLOC_DECLARE(M_NEWNFSFLAYOUT);
733 1.1.1.1.10.2 tls MALLOC_DECLARE(M_NEWNFSDEVINFO);
734 1.1.1.1.10.2 tls MALLOC_DECLARE(M_NEWNFSSOCKREQ);
735 1.1.1.1.10.2 tls MALLOC_DECLARE(M_NEWNFSCLDS);
736 1.1.1.1.10.2 tls MALLOC_DECLARE(M_NEWNFSLAYRECALL);
737 1.1.1.1.10.2 tls #define M_NFSRVCACHE M_NEWNFSRVCACHE
738 1.1.1.1.10.2 tls #define M_NFSDCLIENT M_NEWNFSDCLIENT
739 1.1.1.1.10.2 tls #define M_NFSDSTATE M_NEWNFSDSTATE
740 1.1.1.1.10.2 tls #define M_NFSDLOCK M_NEWNFSDLOCK
741 1.1.1.1.10.2 tls #define M_NFSDLOCKFILE M_NEWNFSDLOCKFILE
742 1.1.1.1.10.2 tls #define M_NFSSTRING M_NEWNFSSTRING
743 1.1.1.1.10.2 tls #define M_NFSUSERGROUP M_NEWNFSUSERGROUP
744 1.1.1.1.10.2 tls #define M_NFSDREQ M_NEWNFSDREQ
745 1.1.1.1.10.2 tls #define M_NFSFH M_NEWNFSFH
746 1.1.1.1.10.2 tls #define M_NFSCLOWNER M_NEWNFSCLOWNER
747 1.1.1.1.10.2 tls #define M_NFSCLOPEN M_NEWNFSCLOPEN
748 1.1.1.1.10.2 tls #define M_NFSCLDELEG M_NEWNFSCLDELEG
749 1.1.1.1.10.2 tls #define M_NFSCLCLIENT M_NEWNFSCLCLIENT
750 1.1.1.1.10.2 tls #define M_NFSCLLOCKOWNER M_NEWNFSCLLOCKOWNER
751 1.1.1.1.10.2 tls #define M_NFSCLLOCK M_NEWNFSCLLOCK
752 1.1.1.1.10.2 tls #define M_NFSDIROFF M_NEWNFSDIROFF
753 1.1.1.1.10.2 tls #define M_NFSV4NODE M_NEWNFSV4NODE
754 1.1.1.1.10.2 tls #define M_NFSDIRECTIO M_NEWNFSDIRECTIO
755 1.1.1.1.10.2 tls #define M_NFSDROLLBACK M_NEWNFSDROLLBACK
756 1.1.1.1.10.2 tls #define M_NFSLAYOUT M_NEWNFSLAYOUT
757 1.1.1.1.10.2 tls #define M_NFSFLAYOUT M_NEWNFSFLAYOUT
758 1.1.1.1.10.2 tls #define M_NFSDEVINFO M_NEWNFSDEVINFO
759 1.1.1.1.10.2 tls #define M_NFSSOCKREQ M_NEWNFSSOCKREQ
760 1.1.1.1.10.2 tls #define M_NFSCLDS M_NEWNFSCLDS
761 1.1.1.1.10.2 tls #define M_NFSLAYRECALL M_NEWNFSLAYRECALL
762 1.1.1.1.10.2 tls
763 1.1.1.1.10.2 tls #define NFSINT_SIGMASK(set) \
764 1.1.1.1.10.2 tls (SIGISMEMBER(set, SIGINT) || SIGISMEMBER(set, SIGTERM) || \
765 1.1.1.1.10.2 tls SIGISMEMBER(set, SIGHUP) || SIGISMEMBER(set, SIGKILL) || \
766 1.1.1.1.10.2 tls SIGISMEMBER(set, SIGQUIT))
767 1.1.1.1.10.2 tls
768 1.1.1.1.10.2 tls /*
769 1.1.1.1.10.2 tls * Convert a quota block count to byte count.
770 1.1.1.1.10.2 tls */
771 1.1.1.1.10.2 tls #define NFSQUOTABLKTOBYTE(q, b) (q) *= (b)
772 1.1.1.1.10.2 tls
773 1.1.1.1.10.2 tls /*
774 1.1.1.1.10.2 tls * Define this as the largest file size supported. (It should probably
775 1.1.1.1.10.2 tls * be available via a VFS_xxx Op, but it isn't.
776 1.1.1.1.10.2 tls */
777 1.1.1.1.10.2 tls #define NFSRV_MAXFILESIZE ((u_int64_t)0x800000000000)
778 1.1.1.1.10.2 tls
779 1.1.1.1.10.2 tls /*
780 1.1.1.1.10.2 tls * Set this macro to index() or strchr(), whichever is supported.
781 1.1.1.1.10.2 tls */
782 1.1.1.1.10.2 tls #define STRCHR(s, c) strchr((s), (c))
783 1.1.1.1.10.2 tls
784 1.1.1.1.10.2 tls /*
785 1.1.1.1.10.2 tls * Set the n_time in the client write rpc, as required.
786 1.1.1.1.10.2 tls */
787 1.1.1.1.10.2 tls #define NFSWRITERPC_SETTIME(w, n, v4) \
788 1.1.1.1.10.2 tls do { \
789 1.1.1.1.10.2 tls if (w) { \
790 1.1.1.1.10.2 tls (n)->n_mtime = (n)->n_vattr.na_vattr.va_mtime; \
791 1.1.1.1.10.2 tls if (v4) \
792 1.1.1.1.10.2 tls (n)->n_change = (n)->n_vattr.na_vattr.va_filerev; \
793 1.1.1.1.10.2 tls } \
794 1.1.1.1.10.2 tls } while (0)
795 1.1.1.1.10.2 tls
796 1.1.1.1.10.2 tls /*
797 1.1.1.1.10.2 tls * Fake value, just to make the client work.
798 1.1.1.1.10.2 tls */
799 1.1.1.1.10.2 tls #define NFS_LATTR_NOSHRINK 1
800 1.1.1.1.10.2 tls
801 1.1.1.1.10.2 tls /*
802 1.1.1.1.10.2 tls * Prototypes for functions where the arguments vary for different ports.
803 1.1.1.1.10.2 tls */
804 1.1.1.1.10.2 tls int nfscl_loadattrcache(struct vnode **, struct nfsvattr *, void *, void *,
805 1.1.1.1.10.2 tls int, int);
806 1.1.1.1.10.2 tls int newnfs_realign(struct mbuf **, int);
807 1.1.1.1.10.2 tls
808 1.1.1.1.10.2 tls /*
809 1.1.1.1.10.2 tls * If the port runs on an SMP box that can enforce Atomic ops with low
810 1.1.1.1.10.2 tls * overheads, define these as atomic increments/decrements. If not,
811 1.1.1.1.10.2 tls * don't worry about it, since these are used for stats that can be
812 1.1.1.1.10.2 tls * "out by one" without disastrous consequences.
813 1.1.1.1.10.2 tls */
814 1.1.1.1.10.2 tls #define NFSINCRGLOBAL(a) ((a)++)
815 1.1.1.1.10.2 tls
816 1.1.1.1.10.2 tls /*
817 1.1.1.1.10.2 tls * Assorted funky stuff to make things work under Darwin8.
818 1.1.1.1.10.2 tls */
819 1.1.1.1.10.2 tls /*
820 1.1.1.1.10.2 tls * These macros checks for a field in vattr being set.
821 1.1.1.1.10.2 tls */
822 1.1.1.1.10.2 tls #define NFSATTRISSET(t, v, a) ((v)->a != (t)VNOVAL)
823 1.1.1.1.10.2 tls #define NFSATTRISSETTIME(v, a) ((v)->a.tv_sec != VNOVAL)
824 1.1.1.1.10.2 tls
825 1.1.1.1.10.2 tls /*
826 1.1.1.1.10.2 tls * Manipulate mount flags.
827 1.1.1.1.10.2 tls */
828 1.1.1.1.10.2 tls #define NFSSTA_HASWRITEVERF 0x00040000 /* Has write verifier */
829 1.1.1.1.10.2 tls #define NFSSTA_GOTFSINFO 0x00100000 /* Got the fsinfo */
830 1.1.1.1.10.2 tls #define NFSSTA_NOLAYOUTCOMMIT 0x04000000 /* Don't do LayoutCommit */
831 1.1.1.1.10.2 tls #define NFSSTA_SESSPERSIST 0x08000000 /* Has a persistent session */
832 1.1.1.1.10.2 tls #define NFSSTA_TIMEO 0x10000000 /* Experiencing a timeout */
833 1.1.1.1.10.2 tls #define NFSSTA_LOCKTIMEO 0x20000000 /* Experiencing a lockd timeout */
834 1.1.1.1.10.2 tls #define NFSSTA_HASSETFSID 0x40000000 /* Has set the fsid */
835 1.1.1.1.10.2 tls #define NFSSTA_PNFS 0x80000000 /* pNFS is enabled */
836 1.1.1.1.10.2 tls
837 1.1.1.1.10.2 tls #define NFSHASNFSV3(n) ((n)->nm_flag & NFSMNT_NFSV3)
838 1.1.1.1.10.2 tls #define NFSHASNFSV4(n) ((n)->nm_flag & NFSMNT_NFSV4)
839 1.1.1.1.10.2 tls #define NFSHASNFSV4N(n) ((n)->nm_minorvers > 0)
840 1.1.1.1.10.2 tls #define NFSHASNFSV3OR4(n) ((n)->nm_flag & (NFSMNT_NFSV3 | NFSMNT_NFSV4))
841 1.1.1.1.10.2 tls #define NFSHASGOTFSINFO(n) ((n)->nm_state & NFSSTA_GOTFSINFO)
842 1.1.1.1.10.2 tls #define NFSHASHASSETFSID(n) ((n)->nm_state & NFSSTA_HASSETFSID)
843 1.1.1.1.10.2 tls #define NFSHASSTRICT3530(n) ((n)->nm_flag & NFSMNT_STRICT3530)
844 1.1.1.1.10.2 tls #define NFSHASWRITEVERF(n) ((n)->nm_state & NFSSTA_HASWRITEVERF)
845 1.1.1.1.10.2 tls #define NFSHASINT(n) ((n)->nm_flag & NFSMNT_INT)
846 1.1.1.1.10.2 tls #define NFSHASSOFT(n) ((n)->nm_flag & NFSMNT_SOFT)
847 1.1.1.1.10.2 tls #define NFSHASINTORSOFT(n) ((n)->nm_flag & (NFSMNT_INT | NFSMNT_SOFT))
848 1.1.1.1.10.2 tls #define NFSHASDUMBTIMR(n) ((n)->nm_flag & NFSMNT_DUMBTIMR)
849 1.1.1.1.10.2 tls #define NFSHASNOCONN(n) ((n)->nm_flag & NFSMNT_MNTD)
850 1.1.1.1.10.2 tls #define NFSHASKERB(n) ((n)->nm_flag & NFSMNT_KERB)
851 1.1.1.1.10.2 tls #define NFSHASALLGSSNAME(n) ((n)->nm_flag & NFSMNT_ALLGSSNAME)
852 1.1.1.1.10.2 tls #define NFSHASINTEGRITY(n) ((n)->nm_flag & NFSMNT_INTEGRITY)
853 1.1.1.1.10.2 tls #define NFSHASPRIVACY(n) ((n)->nm_flag & NFSMNT_PRIVACY)
854 1.1.1.1.10.2 tls #define NFSSETWRITEVERF(n) ((n)->nm_state |= NFSSTA_HASWRITEVERF)
855 1.1.1.1.10.2 tls #define NFSSETHASSETFSID(n) ((n)->nm_state |= NFSSTA_HASSETFSID)
856 1.1.1.1.10.2 tls #define NFSHASPNFSOPT(n) ((n)->nm_flag & NFSMNT_PNFS)
857 1.1.1.1.10.2 tls #define NFSHASNOLAYOUTCOMMIT(n) ((n)->nm_state & NFSSTA_NOLAYOUTCOMMIT)
858 1.1.1.1.10.2 tls #define NFSHASSESSPERSIST(n) ((n)->nm_state & NFSSTA_SESSPERSIST)
859 1.1.1.1.10.2 tls #define NFSHASPNFS(n) ((n)->nm_state & NFSSTA_PNFS)
860 1.1.1.1.10.2 tls
861 1.1.1.1.10.2 tls /*
862 1.1.1.1.10.2 tls * Gets the stats field out of the mount structure.
863 1.1.1.1.10.2 tls */
864 1.1.1.1.10.2 tls #define vfs_statfs(m) (&((m)->mnt_stat))
865 1.1.1.1.10.2 tls
866 1.1.1.1.10.2 tls /*
867 1.1.1.1.10.2 tls * Set boottime.
868 1.1.1.1.10.2 tls */
869 1.1.1.1.10.2 tls #define NFSSETBOOTTIME(b) ((b) = boottime)
870 1.1.1.1.10.2 tls
871 1.1.1.1.10.2 tls /*
872 1.1.1.1.10.2 tls * The size of directory blocks in the buffer cache.
873 1.1.1.1.10.2 tls * MUST BE in the range of PAGE_SIZE <= NFS_DIRBLKSIZ <= MAXBSIZE!!
874 1.1.1.1.10.2 tls */
875 1.1.1.1.10.2 tls #define NFS_DIRBLKSIZ (16 * DIRBLKSIZ) /* Must be a multiple of DIRBLKSIZ */
876 1.1.1.1.10.2 tls
877 1.1.1.1.10.2 tls /*
878 1.1.1.1.10.2 tls * Define these macros to access mnt_flag fields.
879 1.1.1.1.10.2 tls */
880 1.1.1.1.10.2 tls #define NFSMNT_RDONLY(m) ((m)->mnt_flag & MNT_RDONLY)
881 1.1.1.1.10.2 tls #endif /* _KERNEL */
882 1.1.1.1.10.2 tls
883 1.1.1.1.10.2 tls /*
884 1.1.1.1.10.2 tls * Define a structure similar to ufs_args for use in exporting the V4 root.
885 1.1.1.1.10.2 tls */
886 1.1.1.1.10.2 tls struct nfsex_args {
887 1.1.1.1.10.2 tls char *fspec;
888 1.1.1.1.10.2 tls struct export_args export;
889 1.1.1.1.10.2 tls };
890 1.1.1.1.10.2 tls
891 1.1.1.1.10.2 tls /*
892 1.1.1.1.10.2 tls * These export flags should be defined, but there are no bits left.
893 1.1.1.1.10.2 tls * Maybe a separate mnt_exflag field could be added or the mnt_flag
894 1.1.1.1.10.2 tls * field increased to 64 bits?
895 1.1.1.1.10.2 tls */
896 1.1.1.1.10.2 tls #ifndef MNT_EXSTRICTACCESS
897 1.1.1.1.10.2 tls #define MNT_EXSTRICTACCESS 0x0
898 1.1.1.1.10.2 tls #endif
899 1.1.1.1.10.2 tls #ifndef MNT_EXV4ONLY
900 1.1.1.1.10.2 tls #define MNT_EXV4ONLY 0x0
901 1.1.1.1.10.2 tls #endif
902 1.1.1.1.10.2 tls
903 1.1.1.1.10.2 tls #ifdef _KERNEL
904 1.1.1.1.10.2 tls /*
905 1.1.1.1.10.2 tls * Define this to invalidate the attribute cache for the nfs node.
906 1.1.1.1.10.2 tls */
907 1.1.1.1.10.2 tls #define NFSINVALATTRCACHE(n) ((n)->n_attrstamp = 0)
908 1.1.1.1.10.2 tls
909 1.1.1.1.10.2 tls /* Used for FreeBSD only */
910 1.1.1.1.10.2 tls void nfsd_mntinit(void);
911 1.1.1.1.10.2 tls
912 1.1.1.1.10.2 tls /*
913 1.1.1.1.10.2 tls * Define these for vnode lock/unlock ops.
914 1.1.1.1.10.2 tls *
915 1.1.1.1.10.2 tls * These are good abstractions to macro out, so that they can be added to
916 1.1.1.1.10.2 tls * later, for debugging or stats, etc.
917 1.1.1.1.10.2 tls */
918 1.1.1.1.10.2 tls #define NFSVOPLOCK(v, f) vn_lock((v), (f))
919 1.1.1.1.10.2 tls #define NFSVOPUNLOCK(v, f) VOP_UNLOCK((v), (f))
920 1.1.1.1.10.2 tls #define NFSVOPISLOCKED(v) VOP_ISLOCKED((v))
921 1.1.1.1.10.2 tls
922 1.1.1.1.10.2 tls /*
923 1.1.1.1.10.2 tls * Define ncl_hash().
924 1.1.1.1.10.2 tls */
925 1.1.1.1.10.2 tls #define ncl_hash(f, l) (fnv_32_buf((f), (l), FNV1_32_INIT))
926 1.1.1.1.10.2 tls
927 1.1.1.1.10.2 tls int newnfs_iosize(struct nfsmount *);
928 1.1.1.1.10.2 tls
929 1.1.1.1.10.2 tls #ifdef NFS_DEBUG
930 1.1.1.1.10.2 tls
931 1.1.1.1.10.2 tls extern int nfs_debug;
932 1.1.1.1.10.2 tls #define NFS_DEBUG_ASYNCIO 1 /* asynchronous i/o */
933 1.1.1.1.10.2 tls #define NFS_DEBUG_WG 2 /* server write gathering */
934 1.1.1.1.10.2 tls #define NFS_DEBUG_RC 4 /* server request caching */
935 1.1.1.1.10.2 tls
936 1.1.1.1.10.2 tls #define NFS_DPF(cat, args) \
937 1.1.1.1.10.2 tls do { \
938 1.1.1.1.10.2 tls if (nfs_debug & NFS_DEBUG_##cat) printf args; \
939 1.1.1.1.10.2 tls } while (0)
940 1.1.1.1.10.2 tls
941 1.1.1.1.10.2 tls #else
942 1.1.1.1.10.2 tls
943 1.1.1.1.10.2 tls #define NFS_DPF(cat, args)
944 1.1.1.1.10.2 tls
945 1.1.1.1.10.2 tls #endif
946 1.1.1.1.10.2 tls
947 1.1.1.1.10.2 tls int newnfs_vncmpf(struct vnode *, void *);
948 1.1.1.1.10.2 tls
949 1.1.1.1.10.2 tls #ifndef NFS_MINDIRATTRTIMO
950 1.1.1.1.10.2 tls #define NFS_MINDIRATTRTIMO 3 /* VDIR attrib cache timeout in sec */
951 1.1.1.1.10.2 tls #endif
952 1.1.1.1.10.2 tls #ifndef NFS_MAXDIRATTRTIMO
953 1.1.1.1.10.2 tls #define NFS_MAXDIRATTRTIMO 60
954 1.1.1.1.10.2 tls #endif
955 1.1.1.1.10.2 tls
956 1.1.1.1.10.2 tls /*
957 1.1.1.1.10.2 tls * Nfs outstanding request list element
958 1.1.1.1.10.2 tls */
959 1.1.1.1.10.2 tls struct nfsreq {
960 1.1.1.1.10.2 tls TAILQ_ENTRY(nfsreq) r_chain;
961 1.1.1.1.10.2 tls u_int32_t r_flags; /* flags on request, see below */
962 1.1.1.1.10.2 tls struct nfsmount *r_nmp; /* Client mnt ptr */
963 1.1.1.1.10.2 tls struct mtx r_mtx; /* Mutex lock for this structure */
964 1.1.1.1.10.2 tls };
965 1.1.1.1.10.2 tls
966 1.1.1.1.10.2 tls #ifndef NFS_MAXBSIZE
967 1.1.1.1.10.2 tls #define NFS_MAXBSIZE MAXBSIZE
968 1.1.1.1.10.2 tls #endif
969 1.1.1.1.10.2 tls
970 1.1.1.1.10.2 tls /*
971 1.1.1.1.10.2 tls * This macro checks to see if issuing of delegations is allowed for this
972 1.1.1.1.10.2 tls * vnode.
973 1.1.1.1.10.2 tls */
974 1.1.1.1.10.2 tls #ifdef VV_DISABLEDELEG
975 1.1.1.1.10.2 tls #define NFSVNO_DELEGOK(v) \
976 1.1.1.1.10.2 tls ((v) == NULL || ((v)->v_vflag & VV_DISABLEDELEG) == 0)
977 1.1.1.1.10.2 tls #else
978 1.1.1.1.10.2 tls #define NFSVNO_DELEGOK(v) (1)
979 1.1.1.1.10.2 tls #endif
980 1.1.1.1.10.2 tls
981 1.1.1.1.10.2 tls #endif /* _KERNEL */
982 1.1.1.1.10.2 tls
983 1.1.1.1.10.2 tls #endif /* _NFS_NFSPORT_H */
984