Print this page
NEX-16917 Need to reduce the impact of NFS per-share kstats on failover
Reviewed by: Yuri Pankov <yuri.pankov@nexenta.com>
Reviewed by: Evan Layton <evan.layton@nexenta.com>
Reviewed by: Rick McNeal <rick.mcneal@nexenta.com>
NEX-15279 support NFS server in zone
NEX-15520 online NFS shares cause zoneadm halt to hang in nfs_export_zone_fini
Portions contributed by: Dan Kruchinin dan.kruchinin@nexenta.com
Portions contributed by: Stepan Zastupov stepan.zastupov@gmail.com
Reviewed by: Joyce McIntosh <joyce.mcintosh@nexenta.com>
Reviewed by: Rob Gittins <rob.gittins@nexenta.com>
Reviewed by: Gordon Ross <gordon.ross@nexenta.com>
NEX-6778 NFS kstats leak and cause system to hang
Revert "NEX-4261 Per-client NFS server IOPS, bandwidth, and latency kstats"
This reverts commit 586c3ab1927647487f01c337ddc011c642575a52.
Revert "NEX-5354 Aggregated IOPS, bandwidth, and latency kstats for NFS server"
This reverts commit c91d7614da8618ef48018102b077f60ecbbac8c2.
Revert "NEX-5667 nfssrv_stats_flags does not work for aggregated kstats"
This reverts commit 3dcf42618be7dd5f408c327f429c81e07ca08e74.
Revert "NEX-5750 Time values for aggregated NFS server kstats should be normalized"
This reverts commit 1f4d4f901153b0191027969fa4a8064f9d3b9ee1.
Revert "NEX-5942 Panic in rfs4_minorvers_mismatch() with NFSv4.1 client"
This reverts commit 40766417094a162f5e4cc8786c0fa0a7e5871cd9.
Revert "NEX-5752 NFS server: namespace collision in kstats"
This reverts commit ae81e668db86050da8e483264acb0cce0444a132.
Reviewed by: Rob Gittins <rob.gittins@nexenta.com>
Reviewed by: Yuri Pankov <yuri.pankov@nexenta.com>
NEX-5354 Aggregated IOPS, bandwidth, and latency kstats for NFS server
Reviewed by: Steve Peng <steve.peng@nexenta.com>
NEX-4261 Per-client NFS server IOPS, bandwidth, and latency kstats
Reviewed by: Kevin Crowe <kevin.crowe@nexenta.com>
Reviewed by: Roman Strashkin <roman.strashkin@nexenta.com>
NEX-3097 IOPS, bandwidth, and latency kstats for NFS server
Reviewed by: Josef 'Jeff' Sipek <josef.sipek@nexenta.com>
NEX-3524 CLONE - Port NEX-3505 "wrong authentication" messages with root=@0.0.0.0/0 set, result in loss of client access
Reviewed by: Marcel Telka <marcel.telka@nexenta.com>
NEX-3533 CLONE - Port NEX-3019 NFSv3 writes underneath mounted filesystem to directory
Reviewed by: Dan Fields <dan.fields@nexenta.com>
NEX-1974 Support for more than 16 groups with AUTH_SYS
Reviewed by: Gordon Ross <gordon.ross@nexenta.com>
Reviewed by: Josef 'Jeff' Sipek <josef.sipek@nexenta.com>
NEX-1128 NFS server: Generic uid and gid remapping for AUTH_SYS
Reviewed by: Jan Kryl <jan.kryl@nexenta.com>
OS-20 share_nfs(1m) charset handling is unreliable
OS-22 Page fault at nfscmd_dropped_entrysize+0x1e()
OS-23 NFSv2/3/4: READDIR responses are inconsistent when charset conversion fails
OS-24 rfs3_readdir(): Issues related to nfscmd_convdirent()
Reviewed by: Jan Kryl <jan.kryl@nexenta.com>
Reviewed by: Gordon Ross <gordon.ross@nexenta.com>
re #13613 rb4516 Tunables needs volatile keyword
closes #12112 rb3823 - nfs-nohide: lookup("..") for submount should be correct
re #3541 rb11254 - nfs nohide - "nfssrv: need ability to go to submounts for v3 and v2 protocols"
| Split |
Close |
| Expand all |
| Collapse all |
--- old/usr/src/uts/common/nfs/nfs.h
+++ new/usr/src/uts/common/nfs/nfs.h
1 1 /*
2 2 * CDDL HEADER START
3 3 *
4 4 * The contents of this file are subject to the terms of the
5 5 * Common Development and Distribution License (the "License").
6 6 * You may not use this file except in compliance with the License.
7 7 *
8 8 * You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE
9 9 * or http://www.opensolaris.org/os/licensing.
10 10 * See the License for the specific language governing permissions
11 11 * and limitations under the License.
12 12 *
|
↓ open down ↓ |
12 lines elided |
↑ open up ↑ |
13 13 * When distributing Covered Code, include this CDDL HEADER in each
14 14 * file and include the License file at usr/src/OPENSOLARIS.LICENSE.
15 15 * If applicable, add the following below this CDDL HEADER, with the
16 16 * fields enclosed by brackets "[]" replaced with your own identifying
17 17 * information: Portions Copyright [yyyy] [name of copyright owner]
18 18 *
19 19 * CDDL HEADER END
20 20 */
21 21
22 22 /*
23 - * Copyright 2014 Nexenta Systems, Inc. All rights reserved.
24 23 * Copyright (c) 2010, Oracle and/or its affiliates. All rights reserved.
25 - * Copyright (c) 2013 by Delphix. All rights reserved.
26 24 */
27 25
28 26 /* Copyright (c) 1983, 1984, 1985, 1986, 1987, 1988, 1989 AT&T */
29 27 /* All Rights Reserved */
30 28
29 +/*
30 + * Copyright 2018 Nexenta Systems, Inc.
31 + * Copyright (c) 2013 by Delphix. All rights reserved.
32 + */
33 +
31 34 #ifndef _NFS_NFS_H
32 35 #define _NFS_NFS_H
33 36
34 -/* nfs.h 2.38 88/08/19 SMI */
35 -
36 37 #include <sys/isa_defs.h>
37 38 #include <sys/vfs.h>
38 39 #include <sys/stream.h>
39 40 #include <rpc/types.h>
40 41 #include <sys/types32.h>
41 42 #ifdef _KERNEL
42 43 #include <rpc/rpc_rdma.h>
43 44 #include <rpc/rpc.h>
44 45 #include <sys/fcntl.h>
45 46 #include <sys/kstat.h>
46 47 #include <sys/dirent.h>
47 48 #include <sys/zone.h>
48 49 #include <sys/tsol/label.h>
49 50 #include <sys/nvpair.h>
50 51 #include <nfs/mount.h>
51 52 #include <sys/vfs_opreg.h>
52 53 #endif
53 54 #include <vm/page.h>
54 55 #include <rpc/rpc_sztypes.h>
55 56 #include <sys/sysmacros.h>
56 57 #ifdef __cplusplus
57 58 extern "C" {
58 59 #endif
59 60
60 61 /*
61 62 * remote file service numbers
62 63 */
63 64 #define NFS_PROGRAM ((rpcprog_t)100003)
64 65 #define NFS_VERSMIN ((rpcvers_t)2)
|
↓ open down ↓ |
19 lines elided |
↑ open up ↑ |
65 66 #define NFS_VERSMAX ((rpcvers_t)4)
66 67 #define NFS_VERSION ((rpcvers_t)2)
67 68 #define NFS_PORT 2049
68 69
69 70 /*
70 71 * Used to determine registration and service handling of versions
71 72 */
72 73 #define NFS_VERSMIN_DEFAULT ((rpcvers_t)2)
73 74 #define NFS_VERSMAX_DEFAULT ((rpcvers_t)4)
74 75
75 -extern rpcvers_t nfs_versmin;
76 -extern rpcvers_t nfs_versmax;
76 +/*
77 + * Used to track the state of the server so that initialization
78 + * can be done properly.
79 + */
80 +typedef enum {
81 + NFS_SERVER_STOPPED, /* server state destroyed */
82 + NFS_SERVER_STOPPING, /* server state being destroyed */
83 + NFS_SERVER_RUNNING,
84 + NFS_SERVER_QUIESCED, /* server state preserved */
85 + NFS_SERVER_OFFLINE /* server pool offline */
86 +} nfs_server_running_t;
77 87
78 88 /*
89 + * Zone globals variables of NFS server
90 + */
91 +typedef struct nfs_globals {
92 + rpcvers_t nfs_versmin;
93 + rpcvers_t nfs_versmax;
94 +
95 + /* NFS server locks and state */
96 + nfs_server_running_t nfs_server_upordown;
97 + kmutex_t nfs_server_upordown_lock;
98 + kcondvar_t nfs_server_upordown_cv;
99 +
100 + /* RDMA wait variables */
101 + kcondvar_t rdma_wait_cv;
102 + kmutex_t rdma_wait_mutex;
103 +} nfs_globals_t;
104 +
105 +/*
79 106 * Default delegation setting for the server ==> "on"
80 107 */
81 108 #define NFS_SERVER_DELEGATION_DEFAULT (TRUE)
82 109
83 110 /* Maximum size of data portion of a remote request */
84 111 #define NFS_MAXDATA 8192
85 112 #define NFS_MAXNAMLEN 255
86 113 #define NFS_MAXPATHLEN 1024
87 114
88 115 /*
89 116 * Rpc retransmission parameters
90 117 */
91 118 #define NFS_TIMEO 11 /* initial timeout for clts in 10th of a sec */
92 119 #define NFS_RETRIES 5 /* times to retry request */
93 120 #define NFS_COTS_TIMEO 600 /* initial timeout for cots in 10th of a sec */
94 121
95 122 /*
96 123 * The value of UID_NOBODY/GID_NOBODY presented to the world via NFS.
97 124 * UID_NOBODY/GID_NOBODY is translated to NFS_UID_NOBODY/NFS_GID_NOBODY
98 125 * when being sent out over the network and NFS_UID_NOBODY/NFS_GID_NOBODY
99 126 * is translated to UID_NOBODY/GID_NOBODY when received.
100 127 */
101 128 #define NFS_UID_NOBODY -2
102 129 #define NFS_GID_NOBODY -2
103 130
104 131 /*
105 132 * maximum transfer size for different interfaces
106 133 */
107 134 #define ECTSIZE 2048
108 135 #define IETSIZE 8192
109 136
110 137 /*
111 138 * WebNFS error status
112 139 */
113 140 enum wnfsstat {
114 141 WNFSERR_CLNT_FLAVOR = 20001 /* invalid client sec flavor */
115 142 };
116 143
117 144 /*
118 145 * Error status
119 146 * Should include all possible net errors.
120 147 * For now we just cast errno into an enum nfsstat.
121 148 */
122 149 enum nfsstat {
123 150 NFS_OK = 0, /* no error */
124 151 NFSERR_PERM = 1, /* Not owner */
125 152 NFSERR_NOENT = 2, /* No such file or directory */
126 153 NFSERR_IO = 5, /* I/O error */
127 154 NFSERR_NXIO = 6, /* No such device or address */
128 155 NFSERR_ACCES = 13, /* Permission denied */
129 156 NFSERR_EXIST = 17, /* File exists */
130 157 NFSERR_XDEV = 18, /* Cross-device link */
131 158 NFSERR_NODEV = 19, /* No such device */
132 159 NFSERR_NOTDIR = 20, /* Not a directory */
133 160 NFSERR_ISDIR = 21, /* Is a directory */
134 161 NFSERR_INVAL = 22, /* Invalid argument */
135 162 NFSERR_FBIG = 27, /* File too large */
136 163 NFSERR_NOSPC = 28, /* No space left on device */
137 164 NFSERR_ROFS = 30, /* Read-only file system */
138 165 NFSERR_OPNOTSUPP = 45, /* Operation not supported */
139 166 NFSERR_NAMETOOLONG = 63, /* File name too long */
140 167 NFSERR_NOTEMPTY = 66, /* Directory not empty */
141 168 NFSERR_DQUOT = 69, /* Disc quota exceeded */
142 169 NFSERR_STALE = 70, /* Stale NFS file handle */
143 170 NFSERR_REMOTE = 71, /* Object is remote */
144 171 NFSERR_WFLUSH = 99 /* write cache flushed */
145 172 };
146 173
147 174 typedef enum nfsstat nfsstat;
148 175
149 176 /*
150 177 * File types
151 178 */
152 179 enum nfsftype {
153 180 NFNON,
154 181 NFREG, /* regular file */
155 182 NFDIR, /* directory */
156 183 NFBLK, /* block special */
157 184 NFCHR, /* character special */
158 185 NFLNK, /* symbolic link */
159 186 NFSOC /* socket */
160 187 };
161 188
162 189 /*
163 190 * Macros for converting device numbers to and from the format
164 191 * SunOS 4.x used. SVR4 uses 14 bit majors and 18 bits minors,
165 192 * SunOS 4.x used 8 bit majors and 8 bit minors. It isn't sufficient
166 193 * to use the cmpdev() and expdev() macros because they only compress
167 194 * 7 bit (and smaller) majors. We must compress 8 bit majors too.
168 195 * If the major or minor exceeds 8 bits, then we send it out in
169 196 * full 32 bit format and hope that the peer can deal with it.
170 197 */
171 198
172 199 #define SO4_BITSMAJOR 8 /* # of SunOS 4.x major device bits */
173 200 #define SO4_BITSMINOR 8 /* # of SunOS 4.x minor device bits */
174 201 #define SO4_MAXMAJ 0xff /* SunOS 4.x max major value */
175 202 #define SO4_MAXMIN 0xff /* SunOS 4.x max minor value */
176 203
177 204 /*
178 205 * Convert to over-the-wire device number format
179 206 */
180 207 #define nfsv2_cmpdev(x) \
181 208 ((uint32_t) \
182 209 ((getmajor(x) > SO4_MAXMAJ || getminor(x) > SO4_MAXMIN) ? NODEV : \
183 210 ((getmajor(x) << SO4_BITSMINOR) | (getminor(x) & SO4_MAXMIN))))
184 211
185 212 /*
186 213 * Convert from over-the-wire format to SVR4 device number format
187 214 */
188 215 #define nfsv2_expdev(x) \
189 216 makedevice((((x) >> SO4_BITSMINOR) & SO4_MAXMAJ), (x) & SO4_MAXMIN)
190 217
191 218 /*
192 219 * Special kludge for fifos (named pipes) [to adhere to NFS Protocol Spec]
193 220 *
194 221 * VFIFO is not in the protocol spec (VNON will be replaced by VFIFO)
195 222 * so the over-the-wire representation is VCHR with a '-1' device number.
196 223 *
197 224 * NOTE: This kludge becomes unnecessary with the Protocol Revision,
198 225 * but it may be necessary to support it (backwards compatibility).
199 226 */
200 227 #define NFS_FIFO_TYPE NFCHR
201 228 #define NFS_FIFO_MODE S_IFCHR
202 229 #define NFS_FIFO_DEV ((uint32_t)-1)
203 230
204 231 /* identify fifo in nfs attributes */
205 232 #define NA_ISFIFO(NA) (((NA)->na_type == NFS_FIFO_TYPE) && \
206 233 ((NA)->na_rdev == NFS_FIFO_DEV))
207 234
208 235 /* set fifo in nfs attributes */
209 236 #define NA_SETFIFO(NA) { \
210 237 (NA)->na_type = NFS_FIFO_TYPE; \
211 238 (NA)->na_rdev = NFS_FIFO_DEV; \
212 239 (NA)->na_mode = ((NA)->na_mode & ~S_IFMT) | NFS_FIFO_MODE; \
213 240 }
214 241
215 242 /*
216 243 * Check for time overflow using a kernel tunable to determine whether
217 244 * we should accept or reject an unsigned 32-bit time value. Time value in NFS
218 245 * v2/3 protocol is unsigned 32 bit, but ILP32 kernel only allows 31 bits.
219 246 * In nfsv4, time value is a signed 64 bit, so needs to be checked for
220 247 * overflow as well (e.g. for setattr). So define the tunable as follows:
221 248 * nfs_allow_preepoch_time is TRUE if pre-epoch (negative) times are allowed
222 249 * and is FALSE (the default) otherwise. For nfsv2/3 this means that
223 250 * if negative times are allowed, the uint32_t time value is interpreted
224 251 * as a signed int, otherwise as a large positive number. For nfsv4,
225 252 * we use the value as is - except that if negative times are not allowed,
226 253 * we will not accept a negative value otw.
227 254 *
228 255 * So for nfsv2/3 (uint32_t):
229 256 *
230 257 * If nfs_allow_preepoch_time is
231 258 * FALSE, the maximum time value is INT32_MAX for 32-bit kernels and
232 259 * UINT32_MAX for 64-bit kernels (to allow times larger than 2038)
233 260 * and the minimum is zero. Note that in that case, a 32-bit application
234 261 * running on a 64-bit kernel will not be able to access files with
235 262 * the larger time values.
|
↓ open down ↓ |
147 lines elided |
↑ open up ↑ |
236 263 * If nfs_allow_preepoch_time is TRUE, the maximum time value is INT32_MAX
237 264 * for both kernel configurations and the minimum is INT32_MIN.
238 265 *
239 266 * And for nfsv4 (int64_t):
240 267 *
241 268 * nfsv4 allows for negative values in the protocol, and has a 64-bit
242 269 * time field, so nfs_allow_preepoch_time can be ignored.
243 270 */
244 271 #ifdef _KERNEL
245 272
246 -extern bool_t nfs_allow_preepoch_time;
273 +extern volatile bool_t nfs_allow_preepoch_time;
247 274
248 275 #ifdef _LP64
249 276
250 277 /*
251 278 * If no negative otw values are allowed, may use the full 32-bits of the
252 279 * time to represent time later than 2038, by presenting the value as an
253 280 * unsigned (but this can only be used by 64-bit apps due to cstat32
254 281 * restrictions). If negative values are allowed, cannot represent times
255 282 * after 2038. Either way, all 32 bits have a valid representation.
256 283 */
257 284
258 285 /* Check if nfstime4 seconds (int64_t) can be stored in the system time */
259 286 #define NFS4_TIME_OK(tt) TRUE
260 287
261 288
262 289 #define NFS3_TIME_OVERFLOW(tt) (FALSE)
263 290 #define NFS2_TIME_OVERFLOW(tt) (FALSE)
264 291
265 292 /*
266 293 * check if a time_t (int64_t) is ok when preepoch times are allowed -
267 294 * nfsv2/3: every 32-bit value is accepted, but can't overflow 64->32.
268 295 * nfsv4: every value is valid.
269 296 */
270 297 #define NFS_PREEPOCH_TIME_T_OK(tt) \
271 298 (((tt) >= (time_t)INT32_MIN) && ((tt) <= (time_t)INT32_MAX))
272 299
273 300 /*
274 301 * check if a time_t (int64_t) is ok when preepoch times are not allowed -
275 302 * nfsv2/3: every positive 32-bit value is accepted, but can't overflow 64->32.
276 303 * nfsv4: every value is valid.
277 304 */
278 305 #define NFS_NO_PREEPOCH_TIME_T_OK(tt) \
279 306 (((tt) >= 0) && ((tt) <= (time_t)(ulong_t)UINT32_MAX))
280 307
281 308 #else /* not _LP64 */
282 309
283 310 /*
284 311 * Cannot represent times after 2038 in a 32-bit kernel, but we may wish to
285 312 * restrict the use of negative values (which violate the protocol).
286 313 * So if negative times allowed, all uint32 time values are valid. Otherwise
287 314 * only those which are less than INT32_MAX (msb=0).
288 315 *
289 316 * NFSv4 uses int64_t for the time, so in a 32-bit kernel the nfsv4 value
290 317 * must fit in an int32_t.
291 318 */
292 319
293 320 /* Only allow signed 32-bit time values */
294 321
295 322 /* Check if an nfstime4 (int64_t) can be stored in the system time */
296 323 #define NFS4_TIME_OK(tt) \
297 324 (((tt) <= INT32_MAX) && ((tt) >= INT32_MIN))
298 325
299 326 #define NFS3_TIME_OVERFLOW(tt) ((tt) > INT32_MAX)
300 327 #define NFS2_TIME_OVERFLOW(tt) ((tt) > INT32_MAX)
301 328
302 329 /*
303 330 * check if a time_t (int32_t) is ok when preepoch times are allowed -
304 331 * every 32-bit value is accepted
305 332 */
306 333 #define NFS_PREEPOCH_TIME_T_OK(tt) TRUE
307 334
308 335 /*
309 336 * check if a time_t (int32_t) is ok when preepoch times are not allowed -
310 337 * only positive values are accepted.
311 338 */
312 339 #define NFS_NO_PREEPOCH_TIME_T_OK(tt) ((tt) >= 0)
313 340
314 341 #endif /* _LP64 */
315 342
316 343 /* Check if an nfstime3 (uint32_t) can be stored in the system time */
317 344 #define NFS3_TIME_OK(tt) \
318 345 (nfs_allow_preepoch_time || (!NFS3_TIME_OVERFLOW(tt)))
319 346
320 347 /* Check if an nfs2_timeval (uint32_t) can be stored in the system time. */
321 348 #define NFS2_TIME_OK(tt) \
322 349 (nfs_allow_preepoch_time || (!NFS2_TIME_OVERFLOW(tt)))
323 350
324 351 /*
325 352 * Test if time_t (signed long) can be sent over the wire - for v2/3 only if:
326 353 * 1. The time value can fit in a uint32_t; and
327 354 * 2. Either the time value is positive or allow preepoch times.
328 355 * No restrictions for nfsv4.
329 356 */
330 357 #define NFS_TIME_T_OK(tt) \
331 358 (nfs_allow_preepoch_time ? \
332 359 NFS_PREEPOCH_TIME_T_OK(tt) : NFS_NO_PREEPOCH_TIME_T_OK(tt))
333 360
334 361 #define NFS4_TIME_T_OK(tt) TRUE
335 362
336 363 /* Test if all attr times are valid */
337 364 #define NFS_VAP_TIME_OK(vap) \
338 365 (nfs_allow_preepoch_time ? \
339 366 (NFS_PREEPOCH_TIME_T_OK((vap)->va_atime.tv_sec) && \
340 367 NFS_PREEPOCH_TIME_T_OK((vap)->va_mtime.tv_sec) && \
341 368 NFS_PREEPOCH_TIME_T_OK((vap)->va_ctime.tv_sec)) : \
342 369 (NFS_NO_PREEPOCH_TIME_T_OK((vap)->va_atime.tv_sec) && \
343 370 NFS_NO_PREEPOCH_TIME_T_OK((vap)->va_mtime.tv_sec) && \
344 371 NFS_NO_PREEPOCH_TIME_T_OK((vap)->va_ctime.tv_sec)))
345 372
346 373 #define NFS4_VAP_TIME_OK(vap) TRUE
347 374
348 375 /*
349 376 * To extend the sign or not extend the sign, that is the question.
350 377 * Note: The correct way is to code a macro:
351 378 * #define NFS_TIME_T_CONVERT(tt) \
352 379 * (nfs_allow_preepoch_time ? (int32_t)(tt) : (uint32_t)(tt))
353 380 * But the 64-bit compiler does not extend the sign in that case (why?)
354 381 * so we'll do it the ugly way...
355 382 */
356 383 #define NFS_TIME_T_CONVERT(systt, tt) \
357 384 if (nfs_allow_preepoch_time) { \
358 385 systt = (int32_t)(tt); \
359 386 } else { \
360 387 systt = (uint32_t)(tt); \
361 388 }
362 389
363 390 /* macro to check for overflowed time attribute fields - version 3 */
364 391 #define NFS3_FATTR_TIME_OK(attrs) \
365 392 (NFS3_TIME_OK((attrs)->atime.seconds) && \
366 393 NFS3_TIME_OK((attrs)->mtime.seconds) && \
367 394 NFS3_TIME_OK((attrs)->ctime.seconds))
368 395
369 396 /* macro to check for overflowed time attribute fields - version 2 */
370 397 #define NFS2_FATTR_TIME_OK(attrs) \
371 398 (NFS2_TIME_OK((attrs)->na_atime.tv_sec) && \
372 399 NFS2_TIME_OK((attrs)->na_mtime.tv_sec) && \
373 400 NFS2_TIME_OK((attrs)->na_ctime.tv_sec))
374 401
375 402 /* Check that a size3 value is not overflowed */
376 403 #define NFS3_SIZE_OK(size) ((size) <= MAXOFFSET_T)
377 404
378 405 #endif /* _KERNEL */
379 406
380 407 /*
381 408 * Size of an fhandle in bytes
382 409 */
383 410 #define NFS_FHSIZE 32
384 411
385 412 struct nfs_fid {
386 413 ushort_t nf_len;
387 414 ushort_t nf_pad;
388 415 char nf_data[NFS_FHSIZE];
389 416 };
390 417
391 418 /*
392 419 * "Legacy" filehandles use NFS_FHMAXDATA (10) byte fids. Filesystems that
393 420 * return a larger fid than NFS_FHMAXDATA, such as ZFS's .zfs snapshot
394 421 * directory, can use up to (((64 - 8) / 2) - 2) bytes for their fid.
395 422 * This currently holds for both NFSv3 and NFSv4.
396 423 */
397 424 #define NFS_FHMAXDATA 10
398 425 #define NFS_FH3MAXDATA 26
399 426 #define NFS_FH4MAXDATA 26
400 427
401 428 /*
402 429 * The original nfs file handle size for version 3 was 32 which was
403 430 * the same in version 2; now we're making it bigger to to deal with
404 431 * ZFS snapshot FIDs.
405 432 *
406 433 * If the size of fhandle3_t changes or if Version 3 uses some other
407 434 * filehandle format, this constant may need to change.
408 435 */
409 436
410 437 #define NFS3_OLDFHSIZE 32
411 438 #define NFS3_MAXFHSIZE 64
412 439
413 440 /*
414 441 * This is the actual definition of a legacy filehandle. There is some
415 442 * dependence on this layout in NFS-related code, particularly in the
416 443 * user-level lock manager, so be careful about changing it.
417 444 *
418 445 * Currently only NFSv2 uses this structure.
419 446 */
420 447
421 448 typedef struct svcfh {
422 449 fsid_t fh_fsid; /* filesystem id */
423 450 ushort_t fh_len; /* file number length */
424 451 char fh_data[NFS_FHMAXDATA]; /* and data */
425 452 ushort_t fh_xlen; /* export file number length */
426 453 char fh_xdata[NFS_FHMAXDATA]; /* and data */
427 454 } fhandle_t;
428 455
429 456 /*
430 457 * This is the in-memory structure for an NFSv3 extended filehandle.
431 458 */
432 459 typedef struct {
433 460 fsid_t _fh3_fsid; /* filesystem id */
434 461 ushort_t _fh3_len; /* file number length */
435 462 char _fh3_data[NFS_FH3MAXDATA]; /* and data */
436 463 ushort_t _fh3_xlen; /* export file number length */
437 464 char _fh3_xdata[NFS_FH3MAXDATA]; /* and data */
438 465 } fhandle3_t;
439 466
440 467 /*
441 468 * This is the in-memory structure for an NFSv4 extended filehandle.
442 469 */
443 470 typedef struct {
444 471 fsid_t fhx_fsid; /* filesystem id */
445 472 ushort_t fhx_len; /* file number length */
446 473 char fhx_data[NFS_FH4MAXDATA]; /* and data */
447 474 ushort_t fhx_xlen; /* export file number length */
448 475 char fhx_xdata[NFS_FH4MAXDATA]; /* and data */
449 476 } fhandle4_t;
450 477
451 478 /*
452 479 * Arguments to remote write and writecache
453 480 */
454 481 /*
455 482 * The `over the wire' representation of the first four arguments.
456 483 */
457 484 struct otw_nfswriteargs {
458 485 fhandle_t otw_wa_fhandle;
459 486 uint32_t otw_wa_begoff;
460 487 uint32_t otw_wa_offset;
461 488 uint32_t otw_wa_totcount;
462 489 };
463 490
464 491 struct nfswriteargs {
465 492 struct otw_nfswriteargs *wa_args; /* ptr to the otw arguments */
466 493 struct otw_nfswriteargs wa_args_buf; /* space for otw arguments */
467 494 uint32_t wa_count;
468 495 char *wa_data; /* data to write (up to NFS_MAXDATA) */
469 496 mblk_t *wa_mblk; /* pointer to mblks containing data */
470 497 #ifdef _KERNEL
471 498 /* rdma related info */
472 499 struct clist *wa_rlist;
473 500 CONN *wa_conn;
474 501 #endif /* _KERNEL */
475 502 };
476 503 #define wa_fhandle wa_args->otw_wa_fhandle
477 504 #define wa_begoff wa_args->otw_wa_begoff
478 505 #define wa_offset wa_args->otw_wa_offset
479 506 #define wa_totcount wa_args->otw_wa_totcount
480 507
481 508 /*
482 509 * NFS timeval struct using unsigned int as specified in V2 protocol.
483 510 * tv_sec and tv_usec used to match existing code.
484 511 */
485 512 struct nfs2_timeval {
486 513 uint32_t tv_sec;
487 514 uint32_t tv_usec;
488 515 };
489 516 typedef struct nfs2_timeval nfs2_timeval;
490 517
491 518 /*
492 519 * File attributes
493 520 */
494 521 struct nfsfattr {
495 522 enum nfsftype na_type; /* file type */
496 523 uint32_t na_mode; /* protection mode bits */
497 524 uint32_t na_nlink; /* # hard links */
498 525 uint32_t na_uid; /* owner user id */
499 526 uint32_t na_gid; /* owner group id */
500 527 uint32_t na_size; /* file size in bytes */
501 528 uint32_t na_blocksize; /* preferred block size */
502 529 uint32_t na_rdev; /* special device # */
503 530 uint32_t na_blocks; /* Kb of disk used by file */
504 531 uint32_t na_fsid; /* device # */
505 532 uint32_t na_nodeid; /* inode # */
506 533 struct nfs2_timeval na_atime; /* time of last access */
507 534 struct nfs2_timeval na_mtime; /* time of last modification */
508 535 struct nfs2_timeval na_ctime; /* time of last change */
509 536 };
510 537
511 538 #define n2v_type(x) (NA_ISFIFO(x) ? VFIFO : nf_to_vt[(x)->na_type])
512 539 #define n2v_rdev(x) (NA_ISFIFO(x) ? 0 : (x)->na_rdev)
513 540
514 541 /*
515 542 * Arguments to remote read
516 543 */
517 544 struct nfsreadargs {
518 545 fhandle_t ra_fhandle; /* handle for file */
519 546 uint32_t ra_offset; /* byte offset in file */
520 547 uint32_t ra_count; /* immediate read count */
521 548 uint32_t ra_totcount; /* total read cnt (from this offset) */
522 549 #ifdef _KERNEL
523 550 /* used in rdma transports */
524 551 caddr_t ra_data; /* destination for read data */
525 552 struct clist *ra_wlist;
526 553 CONN *ra_conn;
527 554 #endif
528 555 };
529 556
530 557 /*
531 558 * Status OK portion of remote read reply
532 559 */
533 560 struct nfsrrok {
534 561 struct nfsfattr rrok_attr; /* attributes, need for pagin */
535 562 uint32_t rrok_count; /* bytes of data */
536 563 char *rrok_data; /* data (up to NFS_MAXDATA bytes) */
537 564 uint_t rrok_bufsize; /* size of kmem_alloc'd buffer */
538 565 mblk_t *rrok_mp; /* mblk_t contains data for reply */
539 566 #ifdef _KERNEL
540 567 uint_t rrok_wlist_len;
541 568 struct clist *rrok_wlist;
542 569 #endif
543 570 };
544 571
545 572 /*
546 573 * Reply from remote read
547 574 */
548 575 struct nfsrdresult {
549 576 nfsstat rr_status; /* status of read */
550 577 union {
551 578 struct nfsrrok rr_ok_u; /* attributes, need for pagin */
552 579 } rr_u;
553 580 };
554 581 #define rr_ok rr_u.rr_ok_u
555 582 #define rr_attr rr_u.rr_ok_u.rrok_attr
556 583 #define rr_count rr_u.rr_ok_u.rrok_count
557 584 #define rr_bufsize rr_u.rr_ok_u.rrok_bufsize
558 585 #define rr_data rr_u.rr_ok_u.rrok_data
559 586 #define rr_mp rr_u.rr_ok_u.rrok_mp
560 587
561 588 /*
562 589 * File attributes which can be set
563 590 */
564 591 struct nfssattr {
565 592 uint32_t sa_mode; /* protection mode bits */
566 593 uint32_t sa_uid; /* owner user id */
567 594 uint32_t sa_gid; /* owner group id */
568 595 uint32_t sa_size; /* file size in bytes */
569 596 struct nfs2_timeval sa_atime; /* time of last access */
570 597 struct nfs2_timeval sa_mtime; /* time of last modification */
571 598 };
572 599
573 600
574 601 /*
575 602 * Reply status with file attributes
576 603 */
577 604 struct nfsattrstat {
578 605 nfsstat ns_status; /* reply status */
579 606 union {
580 607 struct nfsfattr ns_attr_u; /* NFS_OK: file attributes */
581 608 } ns_u;
582 609 };
583 610 #define ns_attr ns_u.ns_attr_u
584 611
585 612
586 613 /*
587 614 * NFS_OK part of read sym link reply union
588 615 */
589 616 struct nfssrok {
590 617 uint32_t srok_count; /* size of string */
591 618 char *srok_data; /* string (up to NFS_MAXPATHLEN bytes) */
592 619 };
593 620
594 621 /*
595 622 * Result of reading symbolic link
596 623 */
597 624 struct nfsrdlnres {
598 625 nfsstat rl_status; /* status of symlink read */
599 626 union {
600 627 struct nfssrok rl_srok_u; /* name of linked to */
601 628 } rl_u;
602 629 };
603 630 #define rl_srok rl_u.rl_srok_u
604 631 #define rl_count rl_u.rl_srok_u.srok_count
605 632 #define rl_data rl_u.rl_srok_u.srok_data
606 633
607 634
|
↓ open down ↓ |
351 lines elided |
↑ open up ↑ |
608 635 /*
609 636 * Arguments to readdir
610 637 */
611 638 struct nfsrddirargs {
612 639 fhandle_t rda_fh; /* directory handle */
613 640 uint32_t rda_offset; /* offset in directory (opaque) */
614 641 uint32_t rda_count; /* number of directory bytes to read */
615 642 };
616 643
617 644 /*
645 + * Entry structure
646 + */
647 +struct nfsentry {
648 + uint32_t fileid;
649 + char *name;
650 + uint32_t cookie;
651 + struct nfsentry *nextentry;
652 +};
653 +
654 +/*
618 655 * NFS_OK part of readdir result
619 656 */
620 657 struct nfsrdok {
658 + struct nfsentry *rdok_entries; /* variable number of entries */
659 + bool_t rdok_eof; /* true if last entry is in result */
660 +
621 661 uint32_t rdok_offset; /* next offset (opaque) */
622 662 uint32_t rdok_size; /* size in bytes of entries */
623 - bool_t rdok_eof; /* true if last entry is in result */
624 - struct dirent64 *rdok_entries; /* variable number of entries */
663 + struct dirent64 *rdok_dirents; /* variable number of entries */
625 664 };
626 665
627 666 /*
628 667 * Readdir result
629 668 */
630 669 struct nfsrddirres {
631 670 nfsstat rd_status;
632 - uint_t rd_bufsize; /* client request size (not xdr'ed) */
633 671 union {
634 672 struct nfsrdok rd_rdok_u;
635 673 } rd_u;
636 674 };
637 675 #define rd_rdok rd_u.rd_rdok_u
676 +#define rd_entries rd_u.rd_rdok_u.rdok_entries
677 +#define rd_eof rd_u.rd_rdok_u.rdok_eof
678 +
638 679 #define rd_offset rd_u.rd_rdok_u.rdok_offset
639 680 #define rd_size rd_u.rd_rdok_u.rdok_size
640 -#define rd_eof rd_u.rd_rdok_u.rdok_eof
641 -#define rd_entries rd_u.rd_rdok_u.rdok_entries
681 +#define rd_dirents rd_u.rd_rdok_u.rdok_dirents
642 682
643 683
644 684 /*
645 685 * Arguments for directory operations
646 686 */
647 687 struct nfsdiropargs {
648 688 fhandle_t *da_fhandle; /* pointer to directory file handle */
649 689 char *da_name; /* name (up to NFS_MAXNAMLEN bytes) */
650 690 fhandle_t da_fhandle_buf; /* directory file handle */
651 691 int da_flags; /* flags, see below */
652 692 };
653 693 #define DA_FREENAME 1
654 694
655 695 /*
656 696 * NFS_OK part of directory operation result
657 697 */
658 698 struct nfsdrok {
659 699 fhandle_t drok_fhandle; /* result file handle */
660 700 struct nfsfattr drok_attr; /* result file attributes */
661 701 };
662 702
663 703 /*
664 704 * Results from directory operation
665 705 */
666 706 struct nfsdiropres {
667 707 nfsstat dr_status; /* result status */
668 708 union {
669 709 struct nfsdrok dr_drok_u; /* NFS_OK result */
670 710 } dr_u;
671 711 };
672 712 #define dr_drok dr_u.dr_drok_u
673 713 #define dr_fhandle dr_u.dr_drok_u.drok_fhandle
674 714 #define dr_attr dr_u.dr_drok_u.drok_attr
675 715
676 716 /*
677 717 * arguments to setattr
678 718 */
679 719 struct nfssaargs {
680 720 fhandle_t saa_fh; /* fhandle of file to be set */
681 721 struct nfssattr saa_sa; /* new attributes */
682 722 };
683 723
684 724 /*
685 725 * arguments to create and mkdir
686 726 */
687 727 struct nfscreatargs {
688 728 struct nfsdiropargs ca_da; /* file name to create and parent dir */
689 729 struct nfssattr *ca_sa; /* initial attributes */
690 730 struct nfssattr ca_sa_buf; /* space to store attributes */
691 731 };
692 732
693 733 /*
694 734 * arguments to link
695 735 */
696 736 struct nfslinkargs {
697 737 fhandle_t *la_from; /* old file */
698 738 fhandle_t la_from_buf; /* old file */
699 739 struct nfsdiropargs la_to; /* new file and parent dir */
700 740 };
701 741
702 742 /*
703 743 * arguments to rename
704 744 */
705 745 struct nfsrnmargs {
706 746 struct nfsdiropargs rna_from; /* old file and parent dir */
707 747 struct nfsdiropargs rna_to; /* new file and parent dir */
708 748 };
709 749
710 750 /*
711 751 * arguments to symlink
712 752 */
713 753 struct nfsslargs {
714 754 struct nfsdiropargs sla_from; /* old file and parent dir */
715 755 char *sla_tnm; /* new name */
716 756 int sla_tnm_flags; /* flags for name */
717 757 struct nfssattr *sla_sa; /* attributes */
718 758 struct nfssattr sla_sa_buf; /* attributes buffer */
719 759 };
720 760 #define SLA_FREETNM 1
721 761
722 762 /*
723 763 * NFS_OK part of statfs operation
724 764 */
725 765 struct nfsstatfsok {
726 766 uint32_t fsok_tsize; /* preferred transfer size in bytes */
727 767 uint32_t fsok_bsize; /* fundamental file system block size */
728 768 uint32_t fsok_blocks; /* total blocks in file system */
729 769 uint32_t fsok_bfree; /* free blocks in fs */
730 770 uint32_t fsok_bavail; /* free blocks avail to non-superuser */
731 771 };
732 772
733 773 /*
734 774 * Results of statfs operation
735 775 */
736 776 struct nfsstatfs {
737 777 nfsstat fs_status; /* result status */
738 778 union {
739 779 struct nfsstatfsok fs_fsok_u; /* NFS_OK result */
740 780 } fs_u;
741 781 };
742 782 #define fs_fsok fs_u.fs_fsok_u
743 783 #define fs_tsize fs_u.fs_fsok_u.fsok_tsize
744 784 #define fs_bsize fs_u.fs_fsok_u.fsok_bsize
745 785 #define fs_blocks fs_u.fs_fsok_u.fsok_blocks
746 786 #define fs_bfree fs_u.fs_fsok_u.fsok_bfree
747 787 #define fs_bavail fs_u.fs_fsok_u.fsok_bavail
748 788
749 789 #ifdef _KERNEL
750 790 /*
751 791 * XDR routines for handling structures defined above
752 792 */
753 793 extern bool_t xdr_attrstat(XDR *, struct nfsattrstat *);
754 794 extern bool_t xdr_fastattrstat(XDR *, struct nfsattrstat *);
755 795 extern bool_t xdr_creatargs(XDR *, struct nfscreatargs *);
756 796 extern bool_t xdr_diropargs(XDR *, struct nfsdiropargs *);
757 797 extern bool_t xdr_diropres(XDR *, struct nfsdiropres *);
758 798 extern bool_t xdr_fastdiropres(XDR *, struct nfsdiropres *);
759 799 extern bool_t xdr_drok(XDR *, struct nfsdrok *);
760 800 #ifdef _LITTLE_ENDIAN
761 801 extern bool_t xdr_fastdrok(XDR *, struct nfsdrok *);
762 802 extern bool_t xdr_fastfattr(XDR *, struct nfsfattr *);
763 803 #endif
764 804 extern bool_t xdr_fattr(XDR *, struct nfsfattr *);
765 805 extern bool_t xdr_fhandle(XDR *, fhandle_t *);
766 806 extern bool_t xdr_fastfhandle(XDR *, fhandle_t **);
767 807 extern bool_t xdr_linkargs(XDR *, struct nfslinkargs *);
768 808 extern bool_t xdr_rddirargs(XDR *, struct nfsrddirargs *);
769 809 extern bool_t xdr_putrddirres(XDR *, struct nfsrddirres *);
770 810 extern bool_t xdr_getrddirres(XDR *, struct nfsrddirres *);
771 811 extern bool_t xdr_rdlnres(XDR *, struct nfsrdlnres *);
772 812 extern bool_t xdr_rdresult(XDR *, struct nfsrdresult *);
773 813 extern bool_t xdr_readargs(XDR *, struct nfsreadargs *);
774 814 extern bool_t xdr_readlink(XDR *, fhandle_t *);
775 815 extern bool_t xdr_rnmargs(XDR *, struct nfsrnmargs *);
776 816 extern bool_t xdr_rrok(XDR *, struct nfsrrok *);
777 817 extern bool_t xdr_saargs(XDR *, struct nfssaargs *);
778 818 extern bool_t xdr_sattr(XDR *, struct nfssattr *);
779 819 extern bool_t xdr_slargs(XDR *, struct nfsslargs *);
780 820 extern bool_t xdr_srok(XDR *, struct nfssrok *);
781 821 extern bool_t xdr_nfs2_timeval(XDR *, struct nfs2_timeval *);
782 822 extern bool_t xdr_writeargs(XDR *, struct nfswriteargs *);
783 823 extern bool_t xdr_fsok(XDR *, struct nfsstatfsok *);
784 824 #ifdef _LITTLE_ENDIAN
785 825 extern bool_t xdr_fastfsok(XDR *, struct nfsstatfsok *);
786 826 extern bool_t xdr_fastenum(XDR *, enum_t *);
787 827 #endif
788 828 extern bool_t xdr_statfs(XDR *, struct nfsstatfs *);
789 829 extern bool_t xdr_faststatfs(XDR *, struct nfsstatfs *);
790 830 #endif
791 831
792 832 /*
793 833 * Remote file service routines
794 834 */
795 835 #define RFS_NULL 0
796 836 #define RFS_GETATTR 1
797 837 #define RFS_SETATTR 2
798 838 #define RFS_ROOT 3
799 839 #define RFS_LOOKUP 4
800 840 #define RFS_READLINK 5
801 841 #define RFS_READ 6
802 842 #define RFS_WRITECACHE 7
803 843 #define RFS_WRITE 8
804 844 #define RFS_CREATE 9
805 845 #define RFS_REMOVE 10
806 846 #define RFS_RENAME 11
807 847 #define RFS_LINK 12
808 848 #define RFS_SYMLINK 13
809 849 #define RFS_MKDIR 14
810 850 #define RFS_RMDIR 15
811 851 #define RFS_READDIR 16
812 852 #define RFS_STATFS 17
813 853 #define RFS_NPROC 18
814 854
815 855 #ifdef _KERNEL
816 856 /*
817 857 * The NFS Version 2 service procedures
818 858 */
819 859 struct exportinfo; /* defined in nfs/export.h */
820 860 struct servinfo; /* defined in nfs/nfs_clnt.h */
821 861 struct mntinfo; /* defined in nfs/nfs_clnt.h */
822 862
823 863 extern void rfs_getattr(fhandle_t *, struct nfsattrstat *,
824 864 struct exportinfo *, struct svc_req *, cred_t *, bool_t);
825 865 extern void *rfs_getattr_getfh(fhandle_t *);
826 866 extern void rfs_setattr(struct nfssaargs *, struct nfsattrstat *,
827 867 struct exportinfo *, struct svc_req *, cred_t *, bool_t);
828 868 extern void *rfs_setattr_getfh(struct nfssaargs *);
829 869 extern void rfs_lookup(struct nfsdiropargs *, struct nfsdiropres *,
830 870 struct exportinfo *, struct svc_req *, cred_t *, bool_t);
831 871 extern void *rfs_lookup_getfh(struct nfsdiropargs *);
832 872 extern void rfs_readlink(fhandle_t *, struct nfsrdlnres *,
833 873 struct exportinfo *, struct svc_req *, cred_t *, bool_t);
834 874 extern void *rfs_readlink_getfh(fhandle_t *);
835 875 extern void rfs_rlfree(struct nfsrdlnres *);
836 876 extern void rfs_read(struct nfsreadargs *, struct nfsrdresult *,
837 877 struct exportinfo *, struct svc_req *, cred_t *, bool_t);
838 878 extern void *rfs_read_getfh(struct nfsreadargs *);
839 879 extern void rfs_rdfree(struct nfsrdresult *);
840 880 extern void rfs_write_sync(struct nfswriteargs *, struct nfsattrstat *,
841 881 struct exportinfo *, struct svc_req *, cred_t *, bool_t);
842 882 extern void rfs_write(struct nfswriteargs *, struct nfsattrstat *,
843 883 struct exportinfo *, struct svc_req *, cred_t *, bool_t);
844 884 extern void *rfs_write_getfh(struct nfswriteargs *);
845 885 extern void rfs_create(struct nfscreatargs *, struct nfsdiropres *,
846 886 struct exportinfo *, struct svc_req *, cred_t *, bool_t);
847 887 extern void *rfs_create_getfh(struct nfscreatargs *);
848 888 extern void rfs_remove(struct nfsdiropargs *, enum nfsstat *,
849 889 struct exportinfo *, struct svc_req *, cred_t *, bool_t);
850 890 extern void *rfs_remove_getfh(struct nfsdiropargs *);
851 891 extern void rfs_rename(struct nfsrnmargs *, enum nfsstat *,
852 892 struct exportinfo *, struct svc_req *, cred_t *, bool_t);
853 893 extern void *rfs_rename_getfh(struct nfsrnmargs *);
854 894 extern void rfs_link(struct nfslinkargs *, enum nfsstat *,
855 895 struct exportinfo *, struct svc_req *, cred_t *, bool_t);
856 896 extern void *rfs_link_getfh(struct nfslinkargs *);
857 897 extern void rfs_symlink(struct nfsslargs *, enum nfsstat *,
858 898 struct exportinfo *, struct svc_req *, cred_t *, bool_t);
859 899 extern void *rfs_symlink_getfh(struct nfsslargs *);
860 900 extern void rfs_mkdir(struct nfscreatargs *, struct nfsdiropres *,
861 901 struct exportinfo *, struct svc_req *, cred_t *, bool_t);
862 902 extern void *rfs_mkdir_getfh(struct nfscreatargs *);
863 903 extern void rfs_rmdir(struct nfsdiropargs *, enum nfsstat *,
864 904 struct exportinfo *, struct svc_req *, cred_t *, bool_t);
865 905 extern void *rfs_rmdir_getfh(struct nfsdiropargs *);
866 906 extern void rfs_readdir(struct nfsrddirargs *, struct nfsrddirres *,
867 907 struct exportinfo *, struct svc_req *, cred_t *, bool_t);
868 908 extern void *rfs_readdir_getfh(struct nfsrddirargs *);
869 909 extern void rfs_rddirfree(struct nfsrddirres *);
870 910 extern void rfs_statfs(fhandle_t *, struct nfsstatfs *, struct exportinfo *,
871 911 struct svc_req *, cred_t *, bool_t);
872 912 extern void *rfs_statfs_getfh(fhandle_t *);
873 913 extern void rfs_srvrinit(void);
874 914 extern void rfs_srvrfini(void);
875 915
876 916 /*
877 917 * flags to define path types during Multi Component Lookups
878 918 * using the public filehandle
879 919 */
880 920 #define URLPATH 0x01 /* Universal Resource Locator path */
881 921 #define NATIVEPATH 0x02 /* Native path, i.e., via mount protocol */
882 922 #define SECURITY_QUERY 0x04 /* Security query */
883 923
884 924 /* index for svstat_ptr */
885 925 enum nfs_svccounts {NFS_CALLS, NFS_BADCALLS, NFS_REFERRALS, NFS_REFERLINKS};
886 926
887 927 /* function defs for NFS kernel */
888 928 extern int nfs_waitfor_purge_complete(vnode_t *);
889 929 extern int nfs_validate_caches(vnode_t *, cred_t *);
890 930 extern void nfs_purge_caches(vnode_t *, int, cred_t *);
891 931 extern void nfs_purge_rddir_cache(vnode_t *);
892 932 extern void nfs_attrcache(vnode_t *, struct nfsfattr *, hrtime_t);
893 933 extern int nfs_cache_fattr(vnode_t *, struct nfsfattr *, vattr_t *,
894 934 hrtime_t, cred_t *);
895 935 extern void nfs_attr_cache(vnode_t *, vattr_t *, hrtime_t, cred_t *);
896 936 extern void nfs_attrcache_va(vnode_t *, struct vattr *);
|
↓ open down ↓ |
245 lines elided |
↑ open up ↑ |
897 937 extern int nfs_getattr_otw(vnode_t *, struct vattr *, cred_t *);
898 938 extern int nfsgetattr(vnode_t *, struct vattr *, cred_t *);
899 939 extern int nattr_to_vattr(vnode_t *, struct nfsfattr *, struct vattr *);
900 940 extern void nfs_async_manager(struct vfs *);
901 941 extern void nfs_async_manager_stop(struct vfs *);
902 942 extern void nfs_async_stop(struct vfs *);
903 943 extern int nfs_async_stop_sig(struct vfs *);
904 944 extern int nfs_clntinit(void);
905 945 extern void nfs_clntfini(void);
906 946 extern int nfstsize(void);
907 -extern int nfs_srvinit(void);
947 +extern void nfs_srvinit(void);
908 948 extern void nfs_srvfini(void);
909 949 extern int vattr_to_sattr(struct vattr *, struct nfssattr *);
910 950 extern void setdiropargs(struct nfsdiropargs *, char *, vnode_t *);
911 951 extern int setdirgid(vnode_t *, gid_t *, cred_t *);
912 952 extern int setdirmode(vnode_t *, mode_t *, cred_t *);
913 953 extern int newnum(void);
914 954 extern char *newname(void);
915 955 extern int nfs_subrinit(void);
916 956 extern void nfs_subrfini(void);
917 957 extern enum nfsstat puterrno(int);
918 958 extern int geterrno(enum nfsstat);
919 959 extern int nfsinit(int, char *);
920 960 extern void nfsfini(void);
921 961 extern int nfs_vfsinit(void);
922 962 extern void nfs_vfsfini(void);
923 963 extern int nfs_dump(vnode_t *, caddr_t, offset_t, offset_t,
924 964 caller_context_t *);
925 965 extern void nfs_perror(int, char *, ...);
926 966 extern void nfs_cmn_err(int, int, char *, ...);
927 967 extern int nfs_addcllock(vnode_t *, struct flock64 *);
928 968 extern void nfs_rmcllock(vnode_t *, struct flock64 *);
929 969 extern void nfs_lockrelease(vnode_t *, int, offset_t, cred_t *);
930 970 extern int vattr_to_nattr(struct vattr *, struct nfsfattr *);
931 971 extern int mount_root(char *, char *, int, struct nfs_args *, int *);
932 972 extern void nfs_lockcompletion(vnode_t *, int);
933 973 extern void nfs_add_locking_id(vnode_t *, pid_t, int, char *, int);
934 974 extern void nfs3copyfh(caddr_t, vnode_t *);
935 975 extern void nfscopyfh(caddr_t, vnode_t *);
936 976 extern int nfs3lookup(vnode_t *, char *, vnode_t **, struct pathname *,
937 977 int, vnode_t *, cred_t *, int);
938 978 extern int nfslookup(vnode_t *, char *, vnode_t **, struct pathname *, int,
939 979 vnode_t *, cred_t *, int);
940 980 extern void sv_free(struct servinfo *);
941 981 extern int nfsauth_access(struct exportinfo *, struct svc_req *, cred_t *,
942 982 uid_t *, gid_t *, uint_t *, gid_t **);
943 983 extern void nfsauth_init(void);
944 984 extern void nfsauth_fini(void);
945 985 extern int nfs_setopts(vnode_t *, model_t, struct nfs_args *);
946 986 extern int nfs_mount_label_policy(vfs_t *, struct netbuf *,
947 987 struct knetconfig *, cred_t *);
948 988 extern boolean_t nfs_has_ctty(void);
949 989 extern void nfs_srv_stop_all(void);
|
↓ open down ↓ |
32 lines elided |
↑ open up ↑ |
950 990 extern void nfs_srv_quiesce_all(void);
951 991 extern int rfs4_dss_setpaths(char *, size_t);
952 992 extern int nfs_setmod_check(page_t *);
953 993
954 994 extern time_t rfs4_lease_time;
955 995 extern time_t rfs4_grace_period;
956 996 extern nvlist_t *rfs4_dss_paths, *rfs4_dss_oldpaths;
957 997
958 998 extern kstat_named_t *global_svstat_ptr[];
959 999
1000 +extern zone_key_t rfs4_zone_key;
1001 +extern zone_key_t nfssrv_zone_key;
960 1002 extern krwlock_t rroklock;
961 1003 extern vtype_t nf_to_vt[];
962 1004 extern kstat_named_t *rfsproccnt_v2_ptr;
1005 +extern kstat_t **rfsprocio_v2_ptr;
963 1006 extern kmutex_t nfs_minor_lock;
964 1007 extern int nfs_major;
965 1008 extern int nfs_minor;
966 1009 extern vfsops_t *nfs_vfsops;
967 1010 extern struct vnodeops *nfs_vnodeops;
968 1011 extern const struct fs_operation_def nfs_vnodeops_template[];
969 1012 extern int nfsfstyp;
970 1013 extern void (*nfs_srv_quiesce_func)(void);
971 1014 extern int (*nfs_srv_dss_func)(char *, size_t);
972 1015
973 1016 /*
974 - * Per-zone stats as consumed by nfsstat(1m)
1017 + * Per-zone stats
975 1018 */
976 1019 struct nfs_version_stats {
977 1020 kstat_named_t *aclreqcnt_ptr; /* nfs_acl:0:aclreqcnt_v? */
978 1021 kstat_named_t *aclproccnt_ptr; /* nfs_acl:0:aclproccnt_v? */
1022 + kstat_t **aclprocio_ptr; /* nfs_acl:0:aclprocio_v?_* */
1023 + kmutex_t aclprocio_lock; /* protects aclprocio */
979 1024 kstat_named_t *rfsreqcnt_ptr; /* nfs:0:rfsreqcnt_v? */
980 1025 kstat_named_t *rfsproccnt_ptr; /* nfs:0:rfsproccnt_v? */
1026 + kstat_t **rfsprocio_ptr; /* nfs:0:rfsprocio_v?_* */
1027 + kmutex_t rfsprocio_lock; /* protects rfsprocio */
981 1028 };
982 1029
983 1030 /*
984 1031 * A bit of asymmetry: nfs:0:nfs_client isn't part of this structure.
985 1032 */
986 1033 struct nfs_stats {
987 1034 kstat_named_t *nfs_stats_svstat_ptr[NFS_VERSMAX + 1];
988 1035 struct nfs_version_stats nfs_stats_v2;
989 1036 struct nfs_version_stats nfs_stats_v3;
990 1037 struct nfs_version_stats nfs_stats_v4;
991 1038 };
992 1039
993 1040 /*
|
↓ open down ↓ |
3 lines elided |
↑ open up ↑ |
994 1041 * Key used to retrieve counters.
995 1042 */
996 1043 extern zone_key_t nfsstat_zone_key;
997 1044
998 1045 /*
999 1046 * Zone callback functions.
1000 1047 */
1001 1048 extern void *nfsstat_zone_init(zoneid_t);
1002 1049 extern void nfsstat_zone_fini(zoneid_t, void *);
1003 1050
1051 +/*
1052 + * Per-exportinfo stats
1053 + */
1054 +struct exp_kstats {
1055 + kstat_t *share_kstat; /* Generic share kstat */
1056 + struct {
1057 + kstat_named_t path; /* Shared path */
1058 + kstat_named_t filesystem; /* pseudo|real */
1059 + } share_kstat_data; /* Generic share kstat data */
1060 + char *share_path; /* Shared path string */
1061 + kstat_t **rfsshr_v3_ptr; /* NFS v3 per share stats */
1062 + kstat_t **rfsshr_v4_ptr; /* NFS v4 per share stats */
1063 + kmutex_t procio_lock; /* protects all exp_kstats */
1064 +};
1065 +
1066 +extern struct exp_kstats *exp_kstats_init(zoneid_t, int, const char *, size_t,
1067 + bool_t);
1068 +extern void exp_kstats_delete(struct exp_kstats *);
1069 +extern void exp_kstats_fini(struct exp_kstats *);
1070 +extern void exp_kstats_reset(struct exp_kstats *, const char *, size_t, bool_t);
1071 +
1072 +extern kstat_t *exp_kstats_v2(struct exp_kstats *, uint_t);
1073 +extern kstat_t *exp_kstats_v3(struct exp_kstats *, uint_t);
1074 +extern kstat_t *exp_kstats_v4(struct exp_kstats *, uint_t);
1075 +
1004 1076 #endif /* _KERNEL */
1005 1077
1006 1078 /*
1007 1079 * Version 3 declarations and definitions.
1008 1080 */
1009 1081
1010 1082 #define NFS3_FHSIZE 64
1011 1083 #define NFS3_COOKIEVERFSIZE 8
1012 1084 #define NFS3_CREATEVERFSIZE 8
1013 1085 #define NFS3_WRITEVERFSIZE 8
1014 1086
1015 1087 typedef char *filename3;
1016 1088
1017 1089 typedef char *nfspath3;
1018 1090
1019 1091 #define nfs3nametoolong ((char *)-1)
1020 1092
1021 1093 typedef uint64 fileid3;
1022 1094
1023 1095 typedef uint64 cookie3;
1024 1096
1025 1097 typedef uint32 uid3;
1026 1098
1027 1099 typedef uint32 gid3;
1028 1100
1029 1101 typedef uint64 size3;
1030 1102
1031 1103 typedef uint64 offset3;
1032 1104
1033 1105 typedef uint32 mode3;
1034 1106
1035 1107 typedef uint32 count3;
1036 1108
1037 1109 /*
1038 1110 * These three are really opaque arrays, but we treat them as
1039 1111 * uint64 for efficiency sake
1040 1112 */
1041 1113 typedef uint64 cookieverf3;
1042 1114
1043 1115 typedef uint64 createverf3;
1044 1116
1045 1117 typedef uint64 writeverf3;
1046 1118
1047 1119 typedef struct nfs_fh3 {
1048 1120 uint_t fh3_length;
1049 1121 union nfs_fh3_u {
1050 1122 struct nfs_fh3_i {
1051 1123 fhandle3_t fh3_i;
1052 1124 } nfs_fh3_i;
1053 1125 char data[NFS3_FHSIZE];
1054 1126 } fh3_u;
1055 1127 uint_t fh3_flags;
1056 1128 } nfs_fh3;
1057 1129 #define fh3_fsid fh3_u.nfs_fh3_i.fh3_i._fh3_fsid
1058 1130 #define fh3_len fh3_u.nfs_fh3_i.fh3_i._fh3_len
1059 1131 #define fh3_data fh3_u.nfs_fh3_i.fh3_i._fh3_data
1060 1132 #define fh3_xlen fh3_u.nfs_fh3_i.fh3_i._fh3_xlen
1061 1133 #define fh3_xdata fh3_u.nfs_fh3_i.fh3_i._fh3_xdata
1062 1134 #define FH3TOFIDP(fh) ((fid_t *)&((fh)->fh3_len))
1063 1135 #define FH3TOXFIDP(fh) ((fid_t *)&((fh)->fh3_xlen))
1064 1136
1065 1137 /*
1066 1138 * nfs_fh3.fh3_flags values
1067 1139 */
1068 1140 #define FH_WEBNFS 0x1 /* fh is WebNFS overloaded - see makefh3_ol() */
1069 1141
1070 1142 /*
1071 1143 * Two elements were added to the
1072 1144 * diropargs3 structure for performance (xdr-inlining).
1073 1145 * They are not included as part of the args
1074 1146 * that are encoded or decoded:
1075 1147 * dirp - ptr to the nfs_fh3
1076 1148 * flag indicating when to free the name that was
1077 1149 * allocated during decode.
1078 1150 */
1079 1151 struct diropargs3 {
1080 1152 nfs_fh3 *dirp;
1081 1153 nfs_fh3 dir;
1082 1154 filename3 name;
1083 1155 int flags;
1084 1156 };
1085 1157 typedef struct diropargs3 diropargs3;
1086 1158
1087 1159 struct nfstime3 {
1088 1160 uint32 seconds;
1089 1161 uint32 nseconds;
1090 1162 };
1091 1163 typedef struct nfstime3 nfstime3;
1092 1164
1093 1165 struct specdata3 {
1094 1166 uint32 specdata1;
1095 1167 uint32 specdata2;
1096 1168 };
1097 1169 typedef struct specdata3 specdata3;
1098 1170
1099 1171 enum nfsstat3 {
1100 1172 NFS3_OK = 0,
1101 1173 NFS3ERR_PERM = 1,
1102 1174 NFS3ERR_NOENT = 2,
1103 1175 NFS3ERR_IO = 5,
1104 1176 NFS3ERR_NXIO = 6,
1105 1177 NFS3ERR_ACCES = 13,
1106 1178 NFS3ERR_EXIST = 17,
1107 1179 NFS3ERR_XDEV = 18,
1108 1180 NFS3ERR_NODEV = 19,
1109 1181 NFS3ERR_NOTDIR = 20,
1110 1182 NFS3ERR_ISDIR = 21,
1111 1183 NFS3ERR_INVAL = 22,
1112 1184 NFS3ERR_FBIG = 27,
1113 1185 NFS3ERR_NOSPC = 28,
1114 1186 NFS3ERR_ROFS = 30,
1115 1187 NFS3ERR_MLINK = 31,
1116 1188 NFS3ERR_NAMETOOLONG = 63,
1117 1189 NFS3ERR_NOTEMPTY = 66,
1118 1190 NFS3ERR_DQUOT = 69,
1119 1191 NFS3ERR_STALE = 70,
1120 1192 NFS3ERR_REMOTE = 71,
1121 1193 NFS3ERR_BADHANDLE = 10001,
1122 1194 NFS3ERR_NOT_SYNC = 10002,
1123 1195 NFS3ERR_BAD_COOKIE = 10003,
1124 1196 NFS3ERR_NOTSUPP = 10004,
1125 1197 NFS3ERR_TOOSMALL = 10005,
1126 1198 NFS3ERR_SERVERFAULT = 10006,
1127 1199 NFS3ERR_BADTYPE = 10007,
1128 1200 NFS3ERR_JUKEBOX = 10008
1129 1201 };
1130 1202 typedef enum nfsstat3 nfsstat3;
1131 1203
1132 1204 enum ftype3 {
1133 1205 NF3REG = 1,
1134 1206 NF3DIR = 2,
1135 1207 NF3BLK = 3,
1136 1208 NF3CHR = 4,
1137 1209 NF3LNK = 5,
1138 1210 NF3SOCK = 6,
1139 1211 NF3FIFO = 7
1140 1212 };
1141 1213 typedef enum ftype3 ftype3;
1142 1214
1143 1215 struct fattr3 {
1144 1216 ftype3 type;
1145 1217 mode3 mode;
1146 1218 uint32 nlink;
1147 1219 uid3 uid;
1148 1220 gid3 gid;
1149 1221 size3 size;
1150 1222 size3 used;
1151 1223 specdata3 rdev;
1152 1224 uint64 fsid;
1153 1225 fileid3 fileid;
1154 1226 nfstime3 atime;
1155 1227 nfstime3 mtime;
1156 1228 nfstime3 ctime;
1157 1229 };
1158 1230 typedef struct fattr3 fattr3;
1159 1231
1160 1232 #define NFS3_SIZEOF_FATTR3 (21)
1161 1233
1162 1234 #ifdef _KERNEL
1163 1235 struct fattr3_res {
1164 1236 nfsstat3 status;
1165 1237 vattr_t *vap;
1166 1238 vnode_t *vp;
1167 1239 };
1168 1240 typedef struct fattr3_res fattr3_res;
1169 1241 #endif /* _KERNEL */
1170 1242
1171 1243 struct post_op_attr {
1172 1244 bool_t attributes;
1173 1245 fattr3 attr;
1174 1246 };
1175 1247 typedef struct post_op_attr post_op_attr;
1176 1248
1177 1249 #ifdef _KERNEL
1178 1250 struct post_op_vattr {
1179 1251 bool_t attributes;
1180 1252 fattr3_res fres;
1181 1253 };
1182 1254 typedef struct post_op_vattr post_op_vattr;
1183 1255 #endif /* _KERNEL */
1184 1256
1185 1257 struct wcc_attr {
1186 1258 size3 size;
1187 1259 nfstime3 mtime;
1188 1260 nfstime3 ctime;
1189 1261 };
1190 1262 typedef struct wcc_attr wcc_attr;
1191 1263
1192 1264 struct pre_op_attr {
1193 1265 bool_t attributes;
1194 1266 wcc_attr attr;
1195 1267 };
1196 1268 typedef struct pre_op_attr pre_op_attr;
1197 1269
1198 1270 struct wcc_data {
1199 1271 pre_op_attr before;
1200 1272 post_op_attr after;
1201 1273 };
1202 1274 typedef struct wcc_data wcc_data;
1203 1275
1204 1276 struct post_op_fh3 {
1205 1277 bool_t handle_follows;
1206 1278 nfs_fh3 handle;
1207 1279 };
1208 1280 typedef struct post_op_fh3 post_op_fh3;
1209 1281
1210 1282 enum time_how {
1211 1283 DONT_CHANGE = 0,
1212 1284 SET_TO_SERVER_TIME = 1,
1213 1285 SET_TO_CLIENT_TIME = 2
1214 1286 };
1215 1287 typedef enum time_how time_how;
1216 1288
1217 1289 struct set_mode3 {
1218 1290 bool_t set_it;
1219 1291 mode3 mode;
1220 1292 };
1221 1293 typedef struct set_mode3 set_mode3;
1222 1294
1223 1295 struct set_uid3 {
1224 1296 bool_t set_it;
1225 1297 uid3 uid;
1226 1298 };
1227 1299 typedef struct set_uid3 set_uid3;
1228 1300
1229 1301 struct set_gid3 {
1230 1302 bool_t set_it;
1231 1303 gid3 gid;
1232 1304 };
1233 1305 typedef struct set_gid3 set_gid3;
1234 1306
1235 1307 struct set_size3 {
1236 1308 bool_t set_it;
1237 1309 size3 size;
1238 1310 };
1239 1311 typedef struct set_size3 set_size3;
1240 1312
1241 1313 struct set_atime {
1242 1314 time_how set_it;
1243 1315 nfstime3 atime;
1244 1316 };
1245 1317 typedef struct set_atime set_atime;
1246 1318
1247 1319 struct set_mtime {
1248 1320 time_how set_it;
1249 1321 nfstime3 mtime;
1250 1322 };
1251 1323 typedef struct set_mtime set_mtime;
1252 1324
1253 1325 struct sattr3 {
1254 1326 set_mode3 mode;
1255 1327 set_uid3 uid;
1256 1328 set_gid3 gid;
1257 1329 set_size3 size;
1258 1330 set_atime atime;
1259 1331 set_mtime mtime;
1260 1332 };
1261 1333 typedef struct sattr3 sattr3;
1262 1334
1263 1335 /*
1264 1336 * A couple of defines to make resok and resfail look like the
1265 1337 * correct things in a response type independent manner.
1266 1338 */
1267 1339 #define resok res_u.ok
1268 1340 #define resfail res_u.fail
1269 1341
1270 1342 struct GETATTR3args {
1271 1343 nfs_fh3 object;
1272 1344 };
1273 1345 typedef struct GETATTR3args GETATTR3args;
1274 1346
1275 1347 struct GETATTR3resok {
1276 1348 fattr3 obj_attributes;
1277 1349 };
1278 1350 typedef struct GETATTR3resok GETATTR3resok;
1279 1351
1280 1352 struct GETATTR3res {
1281 1353 nfsstat3 status;
1282 1354 union {
1283 1355 GETATTR3resok ok;
1284 1356 } res_u;
1285 1357 };
1286 1358 typedef struct GETATTR3res GETATTR3res;
1287 1359
1288 1360 #ifdef _KERNEL
1289 1361 struct GETATTR3vres {
1290 1362 nfsstat3 status;
1291 1363 fattr3_res fres;
1292 1364 };
1293 1365 typedef struct GETATTR3vres GETATTR3vres;
1294 1366 #endif /* _KERNEL */
1295 1367
1296 1368 struct sattrguard3 {
1297 1369 bool_t check;
1298 1370 nfstime3 obj_ctime;
1299 1371 };
1300 1372 typedef struct sattrguard3 sattrguard3;
1301 1373
1302 1374 struct SETATTR3args {
1303 1375 nfs_fh3 object;
1304 1376 sattr3 new_attributes;
1305 1377 sattrguard3 guard;
1306 1378 };
1307 1379 typedef struct SETATTR3args SETATTR3args;
1308 1380
1309 1381 struct SETATTR3resok {
1310 1382 wcc_data obj_wcc;
1311 1383 };
1312 1384 typedef struct SETATTR3resok SETATTR3resok;
1313 1385
1314 1386 struct SETATTR3resfail {
1315 1387 wcc_data obj_wcc;
1316 1388 };
1317 1389 typedef struct SETATTR3resfail SETATTR3resfail;
1318 1390
1319 1391 struct SETATTR3res {
1320 1392 nfsstat3 status;
1321 1393 union {
1322 1394 SETATTR3resok ok;
1323 1395 SETATTR3resfail fail;
1324 1396 } res_u;
1325 1397 };
1326 1398 typedef struct SETATTR3res SETATTR3res;
1327 1399
1328 1400 struct LOOKUP3args {
1329 1401 diropargs3 what;
1330 1402 };
1331 1403 typedef struct LOOKUP3args LOOKUP3args;
1332 1404
1333 1405 struct LOOKUP3resok {
1334 1406 nfs_fh3 object;
1335 1407 post_op_attr obj_attributes;
1336 1408 post_op_attr dir_attributes;
1337 1409 };
1338 1410 typedef struct LOOKUP3resok LOOKUP3resok;
1339 1411
1340 1412 struct LOOKUP3resfail {
1341 1413 post_op_attr dir_attributes;
1342 1414 };
1343 1415 typedef struct LOOKUP3resfail LOOKUP3resfail;
1344 1416
1345 1417 struct LOOKUP3res {
1346 1418 nfsstat3 status;
1347 1419 union {
1348 1420 LOOKUP3resok ok;
1349 1421 LOOKUP3resfail fail;
1350 1422 } res_u;
1351 1423 };
1352 1424 typedef struct LOOKUP3res LOOKUP3res;
1353 1425
1354 1426 #ifdef _KERNEL
1355 1427 struct LOOKUP3vres {
1356 1428 nfsstat3 status;
1357 1429 nfs_fh3 object;
1358 1430 post_op_vattr dir_attributes;
1359 1431 post_op_vattr obj_attributes;
1360 1432 };
1361 1433 typedef struct LOOKUP3vres LOOKUP3vres;
1362 1434 #endif /* _KERNEL */
1363 1435
1364 1436 struct ACCESS3args {
1365 1437 nfs_fh3 object;
1366 1438 uint32 access;
1367 1439 };
1368 1440 typedef struct ACCESS3args ACCESS3args;
1369 1441 #define ACCESS3_READ 0x1
1370 1442 #define ACCESS3_LOOKUP 0x2
1371 1443 #define ACCESS3_MODIFY 0x4
1372 1444 #define ACCESS3_EXTEND 0x8
1373 1445 #define ACCESS3_DELETE 0x10
1374 1446 #define ACCESS3_EXECUTE 0x20
1375 1447
1376 1448 struct ACCESS3resok {
1377 1449 post_op_attr obj_attributes;
1378 1450 uint32 access;
1379 1451 };
1380 1452 typedef struct ACCESS3resok ACCESS3resok;
1381 1453
1382 1454 struct ACCESS3resfail {
1383 1455 post_op_attr obj_attributes;
1384 1456 };
1385 1457 typedef struct ACCESS3resfail ACCESS3resfail;
1386 1458
1387 1459 struct ACCESS3res {
1388 1460 nfsstat3 status;
1389 1461 union {
1390 1462 ACCESS3resok ok;
1391 1463 ACCESS3resfail fail;
1392 1464 } res_u;
1393 1465 };
1394 1466 typedef struct ACCESS3res ACCESS3res;
1395 1467
1396 1468 struct READLINK3args {
1397 1469 nfs_fh3 symlink;
1398 1470 };
1399 1471 typedef struct READLINK3args READLINK3args;
1400 1472
1401 1473 struct READLINK3resok {
1402 1474 post_op_attr symlink_attributes;
1403 1475 nfspath3 data;
1404 1476 };
1405 1477 typedef struct READLINK3resok READLINK3resok;
1406 1478
1407 1479 struct READLINK3resfail {
1408 1480 post_op_attr symlink_attributes;
1409 1481 };
1410 1482 typedef struct READLINK3resfail READLINK3resfail;
1411 1483
1412 1484 struct READLINK3res {
1413 1485 nfsstat3 status;
1414 1486 union {
1415 1487 READLINK3resok ok;
1416 1488 READLINK3resfail fail;
1417 1489 } res_u;
1418 1490 };
1419 1491 typedef struct READLINK3res READLINK3res;
1420 1492
1421 1493 struct READ3args {
1422 1494 nfs_fh3 file;
1423 1495 offset3 offset;
1424 1496 count3 count;
1425 1497 #ifdef _KERNEL
1426 1498 /* for read using rdma */
1427 1499 char *res_data_val_alt;
1428 1500 struct uio *res_uiop;
1429 1501 struct clist *wlist;
1430 1502 CONN *conn;
1431 1503 #endif
1432 1504 };
1433 1505 typedef struct READ3args READ3args;
1434 1506
1435 1507 struct READ3resok {
1436 1508 post_op_attr file_attributes;
1437 1509 count3 count;
1438 1510 bool_t eof;
1439 1511 struct {
1440 1512 uint_t data_len;
1441 1513 char *data_val;
1442 1514 mblk_t *mp;
1443 1515 } data;
1444 1516 uint_t size;
1445 1517 #ifdef _KERNEL
1446 1518 uint_t wlist_len;
1447 1519 struct clist *wlist;
1448 1520 frtn_t zcopy;
1449 1521 #endif
1450 1522 };
1451 1523 typedef struct READ3resok READ3resok;
1452 1524
1453 1525 struct READ3resfail {
1454 1526 post_op_attr file_attributes;
1455 1527 };
1456 1528 typedef struct READ3resfail READ3resfail;
1457 1529
1458 1530 struct READ3res {
1459 1531 nfsstat3 status;
1460 1532 union {
1461 1533 READ3resok ok;
1462 1534 READ3resfail fail;
1463 1535 } res_u;
1464 1536 };
1465 1537 typedef struct READ3res READ3res;
1466 1538
1467 1539 #ifdef _KERNEL
1468 1540 /*
1469 1541 * READ3 reply that directly decodes fattr3 directly into vattr
1470 1542 */
1471 1543 struct READ3vres {
1472 1544 nfsstat3 status;
1473 1545 struct post_op_vattr pov;
1474 1546 count3 count;
1475 1547 bool_t eof;
1476 1548 struct {
1477 1549 uint_t data_len;
1478 1550 char *data_val;
1479 1551 } data;
1480 1552 uint_t size;
1481 1553
1482 1554 uint_t wlist_len;
1483 1555 struct clist *wlist;
1484 1556 };
1485 1557 typedef struct READ3vres READ3vres;
1486 1558 #endif /* _KERNEL */
1487 1559
1488 1560 /*
1489 1561 * READ3 reply that uiomoves data directly into a struct uio
1490 1562 * ignores any attributes returned
1491 1563 */
1492 1564 struct READ3uiores {
1493 1565 nfsstat3 status;
1494 1566 count3 count;
1495 1567 bool_t eof;
1496 1568 struct uio *uiop;
1497 1569 uint_t size; /* maximum reply size */
1498 1570 #ifdef _KERNEL
1499 1571 uint_t wlist_len;
1500 1572 struct clist *wlist;
1501 1573 #endif
1502 1574 };
1503 1575 typedef struct READ3uiores READ3uiores;
1504 1576
1505 1577 enum stable_how {
1506 1578 UNSTABLE = 0,
1507 1579 DATA_SYNC = 1,
1508 1580 FILE_SYNC = 2
1509 1581 };
1510 1582 typedef enum stable_how stable_how;
1511 1583
1512 1584 struct WRITE3args {
1513 1585 nfs_fh3 file;
1514 1586 offset3 offset;
1515 1587 count3 count;
1516 1588 stable_how stable;
1517 1589 struct {
1518 1590 uint_t data_len;
1519 1591 char *data_val;
1520 1592 } data;
1521 1593 mblk_t *mblk;
1522 1594 #ifdef _KERNEL
1523 1595 struct clist *rlist;
1524 1596 CONN *conn;
1525 1597 #endif
1526 1598 };
1527 1599 typedef struct WRITE3args WRITE3args;
1528 1600
1529 1601 struct WRITE3resok {
1530 1602 wcc_data file_wcc;
1531 1603 count3 count;
1532 1604 stable_how committed;
1533 1605 writeverf3 verf;
1534 1606 };
1535 1607 typedef struct WRITE3resok WRITE3resok;
1536 1608
1537 1609 struct WRITE3resfail {
1538 1610 wcc_data file_wcc;
1539 1611 };
1540 1612 typedef struct WRITE3resfail WRITE3resfail;
1541 1613
1542 1614 struct WRITE3res {
1543 1615 nfsstat3 status;
1544 1616 union {
1545 1617 WRITE3resok ok;
1546 1618 WRITE3resfail fail;
1547 1619 } res_u;
1548 1620 };
1549 1621 typedef struct WRITE3res WRITE3res;
1550 1622
1551 1623 enum createmode3 {
1552 1624 UNCHECKED = 0,
1553 1625 GUARDED = 1,
1554 1626 EXCLUSIVE = 2
1555 1627 };
1556 1628 typedef enum createmode3 createmode3;
1557 1629
1558 1630 struct createhow3 {
1559 1631 createmode3 mode;
1560 1632 union {
1561 1633 sattr3 obj_attributes;
1562 1634 createverf3 verf;
1563 1635 } createhow3_u;
1564 1636 };
1565 1637 typedef struct createhow3 createhow3;
1566 1638
1567 1639 struct CREATE3args {
1568 1640 diropargs3 where;
1569 1641 createhow3 how;
1570 1642 };
1571 1643 typedef struct CREATE3args CREATE3args;
1572 1644
1573 1645 struct CREATE3resok {
1574 1646 post_op_fh3 obj;
1575 1647 post_op_attr obj_attributes;
1576 1648 wcc_data dir_wcc;
1577 1649 };
1578 1650 typedef struct CREATE3resok CREATE3resok;
1579 1651
1580 1652 struct CREATE3resfail {
1581 1653 wcc_data dir_wcc;
1582 1654 };
1583 1655 typedef struct CREATE3resfail CREATE3resfail;
1584 1656
1585 1657 struct CREATE3res {
1586 1658 nfsstat3 status;
1587 1659 union {
1588 1660 CREATE3resok ok;
1589 1661 CREATE3resfail fail;
1590 1662 } res_u;
1591 1663 };
1592 1664 typedef struct CREATE3res CREATE3res;
1593 1665
1594 1666 struct MKDIR3args {
1595 1667 diropargs3 where;
1596 1668 sattr3 attributes;
1597 1669 };
1598 1670 typedef struct MKDIR3args MKDIR3args;
1599 1671
1600 1672 struct MKDIR3resok {
1601 1673 post_op_fh3 obj;
1602 1674 post_op_attr obj_attributes;
1603 1675 wcc_data dir_wcc;
1604 1676 };
1605 1677 typedef struct MKDIR3resok MKDIR3resok;
1606 1678
1607 1679 struct MKDIR3resfail {
1608 1680 wcc_data dir_wcc;
1609 1681 };
1610 1682 typedef struct MKDIR3resfail MKDIR3resfail;
1611 1683
1612 1684 struct MKDIR3res {
1613 1685 nfsstat3 status;
1614 1686 union {
1615 1687 MKDIR3resok ok;
1616 1688 MKDIR3resfail fail;
1617 1689 } res_u;
1618 1690 };
1619 1691 typedef struct MKDIR3res MKDIR3res;
1620 1692
1621 1693 struct symlinkdata3 {
1622 1694 sattr3 symlink_attributes;
1623 1695 nfspath3 symlink_data;
1624 1696 };
1625 1697 typedef struct symlinkdata3 symlinkdata3;
1626 1698
1627 1699 struct SYMLINK3args {
1628 1700 diropargs3 where;
1629 1701 symlinkdata3 symlink;
1630 1702 };
1631 1703 typedef struct SYMLINK3args SYMLINK3args;
1632 1704
1633 1705 struct SYMLINK3resok {
1634 1706 post_op_fh3 obj;
1635 1707 post_op_attr obj_attributes;
1636 1708 wcc_data dir_wcc;
1637 1709 };
1638 1710 typedef struct SYMLINK3resok SYMLINK3resok;
1639 1711
1640 1712 struct SYMLINK3resfail {
1641 1713 wcc_data dir_wcc;
1642 1714 };
1643 1715 typedef struct SYMLINK3resfail SYMLINK3resfail;
1644 1716
1645 1717 struct SYMLINK3res {
1646 1718 nfsstat3 status;
1647 1719 union {
1648 1720 SYMLINK3resok ok;
1649 1721 SYMLINK3resfail fail;
1650 1722 } res_u;
1651 1723 };
1652 1724 typedef struct SYMLINK3res SYMLINK3res;
1653 1725
1654 1726 struct devicedata3 {
1655 1727 sattr3 dev_attributes;
1656 1728 specdata3 spec;
1657 1729 };
1658 1730 typedef struct devicedata3 devicedata3;
1659 1731
1660 1732 struct mknoddata3 {
1661 1733 ftype3 type;
1662 1734 union {
1663 1735 devicedata3 device;
1664 1736 sattr3 pipe_attributes;
1665 1737 } mknoddata3_u;
1666 1738 };
1667 1739 typedef struct mknoddata3 mknoddata3;
1668 1740
1669 1741 struct MKNOD3args {
1670 1742 diropargs3 where;
1671 1743 mknoddata3 what;
1672 1744 };
1673 1745 typedef struct MKNOD3args MKNOD3args;
1674 1746
1675 1747 struct MKNOD3resok {
1676 1748 post_op_fh3 obj;
1677 1749 post_op_attr obj_attributes;
1678 1750 wcc_data dir_wcc;
1679 1751 };
1680 1752 typedef struct MKNOD3resok MKNOD3resok;
1681 1753
1682 1754 struct MKNOD3resfail {
1683 1755 wcc_data dir_wcc;
1684 1756 };
1685 1757 typedef struct MKNOD3resfail MKNOD3resfail;
1686 1758
1687 1759 struct MKNOD3res {
1688 1760 nfsstat3 status;
1689 1761 union {
1690 1762 MKNOD3resok ok;
1691 1763 MKNOD3resfail fail;
1692 1764 } res_u;
1693 1765 };
1694 1766 typedef struct MKNOD3res MKNOD3res;
1695 1767
1696 1768 struct REMOVE3args {
1697 1769 diropargs3 object;
1698 1770 };
1699 1771 typedef struct REMOVE3args REMOVE3args;
1700 1772
1701 1773 struct REMOVE3resok {
1702 1774 wcc_data dir_wcc;
1703 1775 };
1704 1776 typedef struct REMOVE3resok REMOVE3resok;
1705 1777
1706 1778 struct REMOVE3resfail {
1707 1779 wcc_data dir_wcc;
1708 1780 };
1709 1781 typedef struct REMOVE3resfail REMOVE3resfail;
1710 1782
1711 1783 struct REMOVE3res {
1712 1784 nfsstat3 status;
1713 1785 union {
1714 1786 REMOVE3resok ok;
1715 1787 REMOVE3resfail fail;
1716 1788 } res_u;
1717 1789 };
1718 1790 typedef struct REMOVE3res REMOVE3res;
1719 1791
1720 1792 struct RMDIR3args {
1721 1793 diropargs3 object;
1722 1794 };
1723 1795 typedef struct RMDIR3args RMDIR3args;
1724 1796
1725 1797 struct RMDIR3resok {
1726 1798 wcc_data dir_wcc;
1727 1799 };
1728 1800 typedef struct RMDIR3resok RMDIR3resok;
1729 1801
1730 1802 struct RMDIR3resfail {
1731 1803 wcc_data dir_wcc;
1732 1804 };
1733 1805 typedef struct RMDIR3resfail RMDIR3resfail;
1734 1806
1735 1807 struct RMDIR3res {
1736 1808 nfsstat3 status;
1737 1809 union {
1738 1810 RMDIR3resok ok;
1739 1811 RMDIR3resfail fail;
1740 1812 } res_u;
1741 1813 };
1742 1814 typedef struct RMDIR3res RMDIR3res;
1743 1815
1744 1816 struct RENAME3args {
1745 1817 diropargs3 from;
1746 1818 diropargs3 to;
1747 1819 };
1748 1820 typedef struct RENAME3args RENAME3args;
1749 1821
1750 1822 struct RENAME3resok {
1751 1823 wcc_data fromdir_wcc;
1752 1824 wcc_data todir_wcc;
1753 1825 };
1754 1826 typedef struct RENAME3resok RENAME3resok;
1755 1827
1756 1828 struct RENAME3resfail {
1757 1829 wcc_data fromdir_wcc;
1758 1830 wcc_data todir_wcc;
1759 1831 };
1760 1832 typedef struct RENAME3resfail RENAME3resfail;
1761 1833
1762 1834 struct RENAME3res {
1763 1835 nfsstat3 status;
1764 1836 union {
1765 1837 RENAME3resok ok;
1766 1838 RENAME3resfail fail;
1767 1839 } res_u;
1768 1840 };
1769 1841 typedef struct RENAME3res RENAME3res;
1770 1842
1771 1843 struct LINK3args {
1772 1844 nfs_fh3 file;
1773 1845 diropargs3 link;
1774 1846 };
1775 1847 typedef struct LINK3args LINK3args;
1776 1848
1777 1849 struct LINK3resok {
1778 1850 post_op_attr file_attributes;
1779 1851 wcc_data linkdir_wcc;
1780 1852 };
1781 1853 typedef struct LINK3resok LINK3resok;
1782 1854
1783 1855 struct LINK3resfail {
1784 1856 post_op_attr file_attributes;
1785 1857 wcc_data linkdir_wcc;
1786 1858 };
1787 1859 typedef struct LINK3resfail LINK3resfail;
1788 1860
1789 1861 struct LINK3res {
1790 1862 nfsstat3 status;
1791 1863 union {
1792 1864 LINK3resok ok;
1793 1865 LINK3resfail fail;
1794 1866 } res_u;
1795 1867 };
1796 1868 typedef struct LINK3res LINK3res;
1797 1869
1798 1870 struct READDIR3args {
1799 1871 nfs_fh3 dir;
1800 1872 cookie3 cookie;
1801 1873 cookieverf3 cookieverf;
1802 1874 count3 count;
1803 1875 };
1804 1876 typedef struct READDIR3args READDIR3args;
1805 1877
1806 1878 struct entry3 {
1807 1879 fileid3 fileid;
1808 1880 filename3 name;
1809 1881 cookie3 cookie;
1810 1882 struct entry3 *nextentry;
1811 1883 };
1812 1884 typedef struct entry3 entry3;
1813 1885
|
↓ open down ↓ |
800 lines elided |
↑ open up ↑ |
1814 1886 struct dirlist3 {
1815 1887 entry3 *entries;
1816 1888 bool_t eof;
1817 1889 };
1818 1890 typedef struct dirlist3 dirlist3;
1819 1891
1820 1892 struct READDIR3resok {
1821 1893 post_op_attr dir_attributes;
1822 1894 cookieverf3 cookieverf;
1823 1895 dirlist3 reply;
1824 - uint_t size;
1825 - uint_t count;
1826 - uint_t freecount;
1827 - cookie3 cookie;
1828 1896 };
1829 1897 typedef struct READDIR3resok READDIR3resok;
1830 1898
1831 1899 struct READDIR3resfail {
1832 1900 post_op_attr dir_attributes;
1833 1901 };
1834 1902 typedef struct READDIR3resfail READDIR3resfail;
1835 1903
1836 1904 struct READDIR3res {
1837 1905 nfsstat3 status;
1838 1906 union {
1839 1907 READDIR3resok ok;
1840 1908 READDIR3resfail fail;
1841 1909 } res_u;
1842 1910 };
1843 1911 typedef struct READDIR3res READDIR3res;
1844 1912
1845 1913 #ifdef _KERNEL
1846 1914 struct READDIR3vres {
1847 1915 nfsstat3 status;
1848 1916 post_op_vattr dir_attributes;
1849 1917 cookieverf3 cookieverf;
1850 1918 dirent64_t *entries; /* decoded dirent64s */
1851 1919 uint_t size; /* actual size of entries */
1852 1920 uint_t entries_size; /* max size of entries */
1853 1921 off64_t loff; /* last offset/cookie */
1854 1922 bool_t eof; /* End of directory */
1855 1923 };
1856 1924 typedef struct READDIR3vres READDIR3vres;
1857 1925 #endif /* _KERNEL */
1858 1926
1859 1927 struct READDIRPLUS3args {
1860 1928 nfs_fh3 dir;
1861 1929 cookie3 cookie;
1862 1930 cookieverf3 cookieverf;
1863 1931 count3 dircount;
1864 1932 count3 maxcount;
1865 1933 };
1866 1934 typedef struct READDIRPLUS3args READDIRPLUS3args;
1867 1935
1868 1936 struct entryplus3 {
1869 1937 fileid3 fileid;
1870 1938 filename3 name;
1871 1939 cookie3 cookie;
1872 1940 post_op_attr name_attributes;
1873 1941 post_op_fh3 name_handle;
|
↓ open down ↓ |
36 lines elided |
↑ open up ↑ |
1874 1942 struct entryplus3 *nextentry;
1875 1943 };
1876 1944 typedef struct entryplus3 entryplus3;
1877 1945
1878 1946 struct dirlistplus3 {
1879 1947 entryplus3 *entries;
1880 1948 bool_t eof;
1881 1949 };
1882 1950 typedef struct dirlistplus3 dirlistplus3;
1883 1951
1884 -struct entryplus3_info {
1885 - post_op_attr attr;
1886 - post_op_fh3 fh;
1887 - uint_t namelen;
1888 -};
1889 -typedef struct entryplus3_info entryplus3_info;
1890 -
1891 1952 struct READDIRPLUS3resok {
1892 1953 post_op_attr dir_attributes;
1893 1954 cookieverf3 cookieverf;
1894 1955 dirlistplus3 reply;
1895 - uint_t size;
1896 - uint_t count;
1897 - uint_t maxcount;
1898 - entryplus3_info *infop;
1899 1956 };
1900 1957 typedef struct READDIRPLUS3resok READDIRPLUS3resok;
1901 1958
1902 1959 struct READDIRPLUS3resfail {
1903 1960 post_op_attr dir_attributes;
1904 1961 };
1905 1962 typedef struct READDIRPLUS3resfail READDIRPLUS3resfail;
1906 1963
1907 1964 struct READDIRPLUS3res {
1908 1965 nfsstat3 status;
1909 1966 union {
1910 1967 READDIRPLUS3resok ok;
1911 1968 READDIRPLUS3resfail fail;
1912 1969 } res_u;
1913 1970 };
1914 1971 typedef struct READDIRPLUS3res READDIRPLUS3res;
1915 1972
1916 1973 #ifdef _KERNEL
1917 1974 struct entryplus3_va_fh {
1918 1975 int va_valid;
1919 1976 int fh_valid;
1920 1977 vattr_t va;
1921 1978 nfs_fh3 fh;
1922 1979 char *d_name; /* back pointer into entries */
1923 1980 };
1924 1981
1925 1982 struct READDIRPLUS3vres {
1926 1983 nfsstat3 status;
1927 1984 post_op_vattr dir_attributes;
1928 1985 cookieverf3 cookieverf;
1929 1986 dirent64_t *entries; /* decoded dirent64s */
1930 1987 uint_t size; /* actual size of entries */
1931 1988 uint_t entries_size; /* max size of entries */
1932 1989 bool_t eof; /* End of directory */
1933 1990 off64_t loff; /* last offset/cookie */
1934 1991 cred_t *credentials; /* caller's credentials */
1935 1992 hrtime_t time; /* time of READDIRPLUS call */
1936 1993 };
1937 1994 typedef struct READDIRPLUS3vres READDIRPLUS3vres;
1938 1995 #endif /* _KERNEL */
1939 1996
1940 1997 struct FSSTAT3args {
1941 1998 nfs_fh3 fsroot;
1942 1999 };
1943 2000 typedef struct FSSTAT3args FSSTAT3args;
1944 2001
1945 2002 struct FSSTAT3resok {
1946 2003 post_op_attr obj_attributes;
1947 2004 size3 tbytes;
1948 2005 size3 fbytes;
1949 2006 size3 abytes;
1950 2007 size3 tfiles;
1951 2008 size3 ffiles;
1952 2009 size3 afiles;
1953 2010 uint32 invarsec;
1954 2011 };
1955 2012 typedef struct FSSTAT3resok FSSTAT3resok;
1956 2013
1957 2014 struct FSSTAT3resfail {
1958 2015 post_op_attr obj_attributes;
1959 2016 };
1960 2017 typedef struct FSSTAT3resfail FSSTAT3resfail;
1961 2018
1962 2019 struct FSSTAT3res {
1963 2020 nfsstat3 status;
1964 2021 union {
1965 2022 FSSTAT3resok ok;
1966 2023 FSSTAT3resfail fail;
1967 2024 } res_u;
1968 2025 };
1969 2026 typedef struct FSSTAT3res FSSTAT3res;
1970 2027
1971 2028 struct FSINFO3args {
1972 2029 nfs_fh3 fsroot;
1973 2030 };
1974 2031 typedef struct FSINFO3args FSINFO3args;
1975 2032
1976 2033 struct FSINFO3resok {
1977 2034 post_op_attr obj_attributes;
1978 2035 uint32 rtmax;
1979 2036 uint32 rtpref;
1980 2037 uint32 rtmult;
1981 2038 uint32 wtmax;
1982 2039 uint32 wtpref;
1983 2040 uint32 wtmult;
1984 2041 uint32 dtpref;
1985 2042 size3 maxfilesize;
1986 2043 nfstime3 time_delta;
1987 2044 uint32 properties;
1988 2045 };
1989 2046 typedef struct FSINFO3resok FSINFO3resok;
1990 2047
1991 2048 struct FSINFO3resfail {
1992 2049 post_op_attr obj_attributes;
1993 2050 };
1994 2051 typedef struct FSINFO3resfail FSINFO3resfail;
1995 2052 #define FSF3_LINK 0x1
1996 2053 #define FSF3_SYMLINK 0x2
1997 2054 #define FSF3_HOMOGENEOUS 0x8
1998 2055 #define FSF3_CANSETTIME 0x10
1999 2056
2000 2057 struct FSINFO3res {
2001 2058 nfsstat3 status;
2002 2059 union {
2003 2060 FSINFO3resok ok;
2004 2061 FSINFO3resfail fail;
2005 2062 } res_u;
2006 2063 };
2007 2064 typedef struct FSINFO3res FSINFO3res;
2008 2065
2009 2066 struct PATHCONF3args {
2010 2067 nfs_fh3 object;
2011 2068 };
2012 2069 typedef struct PATHCONF3args PATHCONF3args;
2013 2070
2014 2071 struct nfs3_pathconf_info {
2015 2072 uint32 link_max;
2016 2073 uint32 name_max;
2017 2074 bool_t no_trunc;
2018 2075 bool_t chown_restricted;
2019 2076 bool_t case_insensitive;
2020 2077 bool_t case_preserving;
2021 2078 };
2022 2079 typedef struct nfs3_pathconf_info nfs3_pathconf_info;
2023 2080
2024 2081 struct PATHCONF3resok {
2025 2082 post_op_attr obj_attributes;
2026 2083 nfs3_pathconf_info info;
2027 2084 };
2028 2085 typedef struct PATHCONF3resok PATHCONF3resok;
2029 2086
2030 2087 struct PATHCONF3resfail {
2031 2088 post_op_attr obj_attributes;
2032 2089 };
2033 2090 typedef struct PATHCONF3resfail PATHCONF3resfail;
2034 2091
2035 2092 struct PATHCONF3res {
2036 2093 nfsstat3 status;
2037 2094 union {
2038 2095 PATHCONF3resok ok;
2039 2096 PATHCONF3resfail fail;
2040 2097 } res_u;
2041 2098 };
2042 2099 typedef struct PATHCONF3res PATHCONF3res;
2043 2100
2044 2101 struct COMMIT3args {
2045 2102 nfs_fh3 file;
2046 2103 offset3 offset;
2047 2104 count3 count;
2048 2105 };
2049 2106 typedef struct COMMIT3args COMMIT3args;
2050 2107
2051 2108 struct COMMIT3resok {
2052 2109 wcc_data file_wcc;
2053 2110 writeverf3 verf;
2054 2111 };
2055 2112 typedef struct COMMIT3resok COMMIT3resok;
2056 2113
2057 2114 struct COMMIT3resfail {
2058 2115 wcc_data file_wcc;
2059 2116 };
2060 2117 typedef struct COMMIT3resfail COMMIT3resfail;
2061 2118
2062 2119 struct COMMIT3res {
2063 2120 nfsstat3 status;
2064 2121 union {
2065 2122 COMMIT3resok ok;
2066 2123 COMMIT3resfail fail;
2067 2124 } res_u;
2068 2125 };
2069 2126 typedef struct COMMIT3res COMMIT3res;
2070 2127
2071 2128 #define NFS3_PROGRAM ((rpcprog_t)100003)
2072 2129 #define NFS_V3 ((rpcvers_t)3)
2073 2130 #define NFSPROC3_NULL ((rpcproc_t)0)
2074 2131 #define NFSPROC3_GETATTR ((rpcproc_t)1)
2075 2132 #define NFSPROC3_SETATTR ((rpcproc_t)2)
2076 2133 #define NFSPROC3_LOOKUP ((rpcproc_t)3)
2077 2134 #define NFSPROC3_ACCESS ((rpcproc_t)4)
2078 2135 #define NFSPROC3_READLINK ((rpcproc_t)5)
2079 2136 #define NFSPROC3_READ ((rpcproc_t)6)
2080 2137 #define NFSPROC3_WRITE ((rpcproc_t)7)
2081 2138 #define NFSPROC3_CREATE ((rpcproc_t)8)
2082 2139 #define NFSPROC3_MKDIR ((rpcproc_t)9)
2083 2140 #define NFSPROC3_SYMLINK ((rpcproc_t)10)
2084 2141 #define NFSPROC3_MKNOD ((rpcproc_t)11)
2085 2142 #define NFSPROC3_REMOVE ((rpcproc_t)12)
2086 2143 #define NFSPROC3_RMDIR ((rpcproc_t)13)
2087 2144 #define NFSPROC3_RENAME ((rpcproc_t)14)
2088 2145 #define NFSPROC3_LINK ((rpcproc_t)15)
2089 2146 #define NFSPROC3_READDIR ((rpcproc_t)16)
2090 2147 #define NFSPROC3_READDIRPLUS ((rpcproc_t)17)
2091 2148 #define NFSPROC3_FSSTAT ((rpcproc_t)18)
2092 2149 #define NFSPROC3_FSINFO ((rpcproc_t)19)
2093 2150 #define NFSPROC3_PATHCONF ((rpcproc_t)20)
2094 2151 #define NFSPROC3_COMMIT ((rpcproc_t)21)
2095 2152
2096 2153 #ifndef _KERNEL
2097 2154 extern void *nfsproc3_null_3();
2098 2155 extern GETATTR3res *nfsproc3_getattr_3();
2099 2156 extern SETATTR3res *nfsproc3_setattr_3();
2100 2157 extern LOOKUP3res *nfsproc3_lookup_3();
2101 2158 extern ACCESS3res *nfsproc3_access_3();
2102 2159 extern READLINK3res *nfsproc3_readlink_3();
2103 2160 extern READ3res *nfsproc3_read_3();
2104 2161 extern WRITE3res *nfsproc3_write_3();
2105 2162 extern CREATE3res *nfsproc3_create_3();
2106 2163 extern MKDIR3res *nfsproc3_mkdir_3();
2107 2164 extern SYMLINK3res *nfsproc3_symlink_3();
2108 2165 extern MKNOD3res *nfsproc3_mknod_3();
2109 2166 extern REMOVE3res *nfsproc3_remove_3();
2110 2167 extern RMDIR3res *nfsproc3_rmdir_3();
2111 2168 extern RENAME3res *nfsproc3_rename_3();
2112 2169 extern LINK3res *nfsproc3_link_3();
2113 2170 extern READDIR3res *nfsproc3_readdir_3();
2114 2171 extern READDIRPLUS3res *nfsproc3_readdirplus_3();
2115 2172 extern FSSTAT3res *nfsproc3_fsstat_3();
2116 2173 extern FSINFO3res *nfsproc3_fsinfo_3();
2117 2174 extern PATHCONF3res *nfsproc3_pathconf_3();
2118 2175 extern COMMIT3res *nfsproc3_commit_3();
2119 2176 #endif /* !_KERNEL */
2120 2177
2121 2178 #ifdef _KERNEL
2122 2179 /* the NFS Version 3 XDR functions */
2123 2180
2124 2181 extern bool_t xdr_nfs_fh3(XDR *, nfs_fh3 *);
2125 2182 extern bool_t xdr_nfslog_nfs_fh3(XDR *, nfs_fh3 *);
2126 2183 extern bool_t xdr_nfs_fh3_server(XDR *, nfs_fh3 *);
2127 2184 extern bool_t xdr_diropargs3(XDR *, diropargs3 *);
2128 2185 extern bool_t xdr_post_op_attr(XDR *, post_op_attr *);
2129 2186 extern bool_t xdr_post_op_fh3(XDR *, post_op_fh3 *);
2130 2187 extern bool_t xdr_GETATTR3res(XDR *, GETATTR3res *);
2131 2188 extern bool_t xdr_GETATTR3vres(XDR *, GETATTR3vres *);
2132 2189 extern bool_t xdr_SETATTR3args(XDR *, SETATTR3args *);
2133 2190 extern bool_t xdr_SETATTR3res(XDR *, SETATTR3res *);
2134 2191 extern bool_t xdr_LOOKUP3res(XDR *, LOOKUP3res *);
2135 2192 extern bool_t xdr_LOOKUP3vres(XDR *, LOOKUP3vres *);
2136 2193 extern bool_t xdr_ACCESS3args(XDR *, ACCESS3args *);
2137 2194 extern bool_t xdr_ACCESS3res(XDR *, ACCESS3res *);
2138 2195 extern bool_t xdr_READLINK3args(XDR *, READLINK3args *);
2139 2196 extern bool_t xdr_READLINK3res(XDR *, READLINK3res *);
2140 2197 extern bool_t xdr_READ3args(XDR *, READ3args *);
2141 2198 extern bool_t xdr_READ3res(XDR *, READ3res *);
2142 2199 extern bool_t xdr_READ3vres(XDR *, READ3vres *);
2143 2200 extern bool_t xdr_READ3uiores(XDR *, READ3uiores *);
2144 2201 extern bool_t xdr_WRITE3args(XDR *, WRITE3args *);
2145 2202 extern bool_t xdr_WRITE3res(XDR *, WRITE3res *);
2146 2203 extern bool_t xdr_CREATE3args(XDR *, CREATE3args *);
2147 2204 extern bool_t xdr_CREATE3res(XDR *, CREATE3res *);
2148 2205 extern bool_t xdr_MKDIR3args(XDR *, MKDIR3args *);
2149 2206 extern bool_t xdr_MKDIR3res(XDR *, MKDIR3res *);
2150 2207 extern bool_t xdr_SYMLINK3args(XDR *, SYMLINK3args *);
2151 2208 extern bool_t xdr_SYMLINK3res(XDR *, SYMLINK3res *);
2152 2209 extern bool_t xdr_MKNOD3args(XDR *, MKNOD3args *);
2153 2210 extern bool_t xdr_MKNOD3res(XDR *, MKNOD3res *);
2154 2211 extern bool_t xdr_REMOVE3res(XDR *, REMOVE3res *);
2155 2212 extern bool_t xdr_RMDIR3resfail(XDR *, RMDIR3resfail *);
2156 2213 extern bool_t xdr_RMDIR3res(XDR *, RMDIR3res *);
2157 2214 extern bool_t xdr_RENAME3args(XDR *, RENAME3args *);
2158 2215 extern bool_t xdr_RENAME3res(XDR *, RENAME3res *);
2159 2216 extern bool_t xdr_LINK3args(XDR *, LINK3args *);
2160 2217 extern bool_t xdr_LINK3res(XDR *, LINK3res *);
2161 2218 extern bool_t xdr_READDIR3args(XDR *, READDIR3args *);
2162 2219 extern bool_t xdr_READDIR3res(XDR *, READDIR3res *);
2163 2220 extern bool_t xdr_READDIR3vres(XDR *, READDIR3vres *);
2164 2221 extern bool_t xdr_READDIRPLUS3args(XDR *, READDIRPLUS3args *);
2165 2222 extern bool_t xdr_READDIRPLUS3res(XDR *, READDIRPLUS3res *);
2166 2223 extern bool_t xdr_READDIRPLUS3vres(XDR *, READDIRPLUS3vres *);
2167 2224 extern bool_t xdr_FSSTAT3res(XDR *, FSSTAT3res *);
2168 2225 extern bool_t xdr_FSINFO3res(XDR *, FSINFO3res *);
2169 2226 extern bool_t xdr_PATHCONF3res(XDR *, PATHCONF3res *);
2170 2227 extern bool_t xdr_COMMIT3args(XDR *, COMMIT3args *);
2171 2228 extern bool_t xdr_COMMIT3res(XDR *, COMMIT3res *);
2172 2229 extern bool_t xdr_fastnfs_fh3(XDR *, nfs_fh3 **);
2173 2230
2174 2231 /*
2175 2232 * The NFS Version 3 service procedures.
2176 2233 */
2177 2234 struct exportinfo; /* defined in nfs/export.h */
2178 2235 struct servinfo; /* defined in nfs/nfs_clnt.h */
2179 2236 struct mntinfo; /* defined in nfs/nfs_clnt.h */
2180 2237 struct sec_ol; /* defined in nfs/export.h */
2181 2238
2182 2239 extern void rfs3_getattr(GETATTR3args *, GETATTR3res *, struct exportinfo *,
2183 2240 struct svc_req *, cred_t *, bool_t);
2184 2241 extern void *rfs3_getattr_getfh(GETATTR3args *);
2185 2242 extern void rfs3_setattr(SETATTR3args *, SETATTR3res *, struct exportinfo *,
2186 2243 struct svc_req *, cred_t *, bool_t);
2187 2244 extern void *rfs3_setattr_getfh(SETATTR3args *);
2188 2245 extern void rfs3_lookup(LOOKUP3args *, LOOKUP3res *, struct exportinfo *,
2189 2246 struct svc_req *, cred_t *, bool_t);
2190 2247 extern void *rfs3_lookup_getfh(LOOKUP3args *);
2191 2248 extern void rfs3_access(ACCESS3args *, ACCESS3res *, struct exportinfo *,
2192 2249 struct svc_req *, cred_t *, bool_t);
2193 2250 extern void *rfs3_access_getfh(ACCESS3args *);
2194 2251 extern void rfs3_readlink(READLINK3args *, READLINK3res *,
2195 2252 struct exportinfo *, struct svc_req *, cred_t *, bool_t);
2196 2253 extern void *rfs3_readlink_getfh(READLINK3args *);
2197 2254 extern void rfs3_readlink_free(READLINK3res *);
2198 2255 extern void rfs3_read(READ3args *, READ3res *, struct exportinfo *,
2199 2256 struct svc_req *, cred_t *, bool_t);
2200 2257 extern void *rfs3_read_getfh(READ3args *);
2201 2258 extern void rfs3_read_free(READ3res *);
2202 2259 extern void rfs3_write(WRITE3args *, WRITE3res *, struct exportinfo *,
2203 2260 struct svc_req *, cred_t *, bool_t);
2204 2261 extern void *rfs3_write_getfh(WRITE3args *);
2205 2262 extern void rfs3_create(CREATE3args *, CREATE3res *, struct exportinfo *,
2206 2263 struct svc_req *, cred_t *, bool_t);
2207 2264 extern void *rfs3_create_getfh(CREATE3args *);
2208 2265 extern void rfs3_mkdir(MKDIR3args *, MKDIR3res *, struct exportinfo *,
2209 2266 struct svc_req *, cred_t *, bool_t);
2210 2267 extern void *rfs3_mkdir_getfh(MKDIR3args *);
2211 2268 extern void rfs3_symlink(SYMLINK3args *, SYMLINK3res *, struct exportinfo *,
2212 2269 struct svc_req *, cred_t *, bool_t);
2213 2270 extern void *rfs3_symlink_getfh(SYMLINK3args *);
2214 2271 extern void rfs3_mknod(MKNOD3args *, MKNOD3res *, struct exportinfo *,
2215 2272 struct svc_req *, cred_t *, bool_t);
2216 2273 extern void *rfs3_mknod_getfh(MKNOD3args *);
2217 2274 extern void rfs3_remove(REMOVE3args *, REMOVE3res *, struct exportinfo *,
2218 2275 struct svc_req *, cred_t *, bool_t);
2219 2276 extern void *rfs3_remove_getfh(REMOVE3args *);
2220 2277 extern void rfs3_rmdir(RMDIR3args *, RMDIR3res *, struct exportinfo *,
2221 2278 struct svc_req *, cred_t *, bool_t);
2222 2279 extern void *rfs3_rmdir_getfh(RMDIR3args *);
2223 2280 extern void rfs3_rename(RENAME3args *, RENAME3res *, struct exportinfo *,
2224 2281 struct svc_req *, cred_t *, bool_t);
2225 2282 extern void *rfs3_rename_getfh(RENAME3args *);
2226 2283 extern void rfs3_link(LINK3args *, LINK3res *, struct exportinfo *,
2227 2284 struct svc_req *, cred_t *, bool_t);
2228 2285 extern void *rfs3_link_getfh(LINK3args *);
2229 2286 extern void rfs3_readdir(READDIR3args *, READDIR3res *, struct exportinfo *,
2230 2287 struct svc_req *, cred_t *, bool_t);
2231 2288 extern void *rfs3_readdir_getfh(READDIR3args *);
2232 2289 extern void rfs3_readdir_free(READDIR3res *);
2233 2290 extern void rfs3_readdirplus(READDIRPLUS3args *, READDIRPLUS3res *,
2234 2291 struct exportinfo *, struct svc_req *, cred_t *, bool_t);
2235 2292 extern void *rfs3_readdirplus_getfh(READDIRPLUS3args *);
2236 2293 extern void rfs3_readdirplus_free(READDIRPLUS3res *);
2237 2294 extern void rfs3_fsstat(FSSTAT3args *, FSSTAT3res *, struct exportinfo *,
2238 2295 struct svc_req *, cred_t *, bool_t);
2239 2296 extern void *rfs3_fsstat_getfh(FSSTAT3args *);
2240 2297 extern void rfs3_fsinfo(FSINFO3args *, FSINFO3res *, struct exportinfo *,
2241 2298 struct svc_req *, cred_t *, bool_t);
2242 2299 extern void *rfs3_fsinfo_getfh(FSINFO3args *);
2243 2300 extern void rfs3_pathconf(PATHCONF3args *, PATHCONF3res *,
2244 2301 struct exportinfo *, struct svc_req *, cred_t *, bool_t);
2245 2302 extern void *rfs3_pathconf_getfh(PATHCONF3args *);
2246 2303 extern void rfs3_commit(COMMIT3args *, COMMIT3res *, struct exportinfo *,
2247 2304 struct svc_req *, cred_t *, bool_t);
2248 2305 extern void *rfs3_commit_getfh(COMMIT3args *);
2249 2306 extern void rfs3_srvrinit(void);
2250 2307 extern void rfs3_srvrfini(void);
2251 2308
2252 2309 extern int nfs3_validate_caches(vnode_t *, cred_t *);
2253 2310 extern void nfs3_cache_post_op_attr(vnode_t *, post_op_attr *, hrtime_t,
2254 2311 cred_t *);
2255 2312 extern void nfs3_cache_post_op_vattr(vnode_t *, post_op_vattr *, hrtime_t,
2256 2313 cred_t *);
2257 2314 extern void nfs3_cache_wcc_data(vnode_t *, wcc_data *, hrtime_t, cred_t *);
2258 2315 extern void nfs3_attrcache(vnode_t *, fattr3 *, hrtime_t);
2259 2316 extern int nfs3_cache_fattr3(vnode_t *, fattr3 *, vattr_t *, hrtime_t,
2260 2317 cred_t *);
2261 2318 extern int nfs3_getattr_otw(vnode_t *, struct vattr *, cred_t *);
2262 2319 extern int nfs3getattr(vnode_t *, struct vattr *, cred_t *);
2263 2320 extern int fattr3_to_vattr(vnode_t *, fattr3 *, struct vattr *);
2264 2321 extern int nfs3tsize(void);
2265 2322 extern uint_t nfs3_tsize(struct knetconfig *);
2266 2323 extern uint_t rfs3_tsize(struct svc_req *);
2267 2324 extern int vattr_to_sattr3(struct vattr *, sattr3 *);
2268 2325 extern void setdiropargs3(diropargs3 *, char *, vnode_t *);
2269 2326 extern enum nfsstat3 puterrno3(int);
2270 2327 extern int geterrno3(enum nfsstat3);
|
↓ open down ↓ |
362 lines elided |
↑ open up ↑ |
2271 2328 extern int nfs3init(int, char *);
2272 2329 extern void nfs3fini(void);
2273 2330 extern int nfs3_vfsinit(void);
2274 2331 extern void nfs3_vfsfini(void);
2275 2332 extern void vattr_to_post_op_attr(struct vattr *, post_op_attr *);
2276 2333 extern void mblk_to_iov(mblk_t *, int, struct iovec *);
2277 2334 extern int rfs_publicfh_mclookup(char *, vnode_t *, cred_t *, vnode_t **,
2278 2335 struct exportinfo **, struct sec_ol *);
2279 2336 extern int rfs_pathname(char *, vnode_t **, vnode_t **, vnode_t *,
2280 2337 cred_t *, int);
2338 +extern int rfs_cross_mnt(vnode_t **, struct exportinfo **);
2339 +extern int rfs_climb_crossmnt(vnode_t **, struct exportinfo **, cred_t *);
2281 2340
2282 2341 extern vtype_t nf3_to_vt[];
2283 2342 extern kstat_named_t *rfsproccnt_v3_ptr;
2343 +extern kstat_t **rfsprocio_v3_ptr;
2284 2344 extern vfsops_t *nfs3_vfsops;
2285 2345 extern struct vnodeops *nfs3_vnodeops;
2286 2346 extern const struct fs_operation_def nfs3_vnodeops_template[];
2287 2347
2288 2348 /*
2289 2349 * Some servers do not properly update the attributes of the
2290 2350 * directory when changes are made. To allow interoperability
2291 2351 * with these broken servers, the nfs_disable_rddir_cache
2292 2352 * parameter can be used to disable readdir response caching.
2293 2353 */
2294 -extern int nfs_disable_rddir_cache;
2354 +extern volatile int nfs_disable_rddir_cache;
2295 2355
2296 2356 /*
2297 2357 * External functions called by the v2/v3 code into the v4 code
2298 2358 */
2299 2359 extern void nfs4_clnt_init(void);
2300 2360 extern void nfs4_clnt_fini(void);
2301 2361
2302 2362 /*
2303 2363 * Does NFS4 server have a vnode delegated? TRUE if so, FALSE if not.
2304 2364 */
2305 2365 extern bool_t rfs4_check_delegated(int mode, vnode_t *, bool_t trunc);
2306 2366 /*
2307 2367 * VOP_GETATTR call. If a NFS4 delegation is present on the supplied vnode
2308 2368 * call back to the delegated client to get attributes for AT_MTIME and
2309 2369 * AT_SIZE. Invoke VOP_GETATTR to get all other attributes or all attributes
2310 2370 * if no delegation is present.
2311 2371 */
2312 2372 extern int rfs4_delegated_getattr(vnode_t *, vattr_t *, int, cred_t *);
2313 -extern void rfs4_hold_deleg_policy(void);
2314 -extern void rfs4_rele_deleg_policy(void);
2315 2373
2316 2374 extern int do_xattr_exists_check(vnode_t *, ulong_t *, cred_t *);
2317 2375
2376 +extern int protect_zfs_mntpt(vnode_t *);
2377 +
2318 2378 extern ts_label_t *nfs_getflabel(vnode_t *, struct exportinfo *);
2319 2379 extern boolean_t do_rfs_label_check(bslabel_t *, vnode_t *, int,
2320 2380 struct exportinfo *);
2321 2381
2322 2382 /*
2323 2383 * Copy Reduction support.
2324 2384 * xuio_t wrapper with additional private data.
2325 2385 */
2326 2386
2327 2387 typedef struct nfs_xuio {
2328 2388 xuio_t nu_uio;
2329 2389 vnode_t *nu_vp;
2330 2390 uint_t nu_ref;
2331 2391 frtn_t nu_frtn;
2332 2392 } nfs_xuio_t;
2333 2393
2334 2394 extern xuio_t *rfs_setup_xuio(vnode_t *);
2335 2395 extern mblk_t *uio_to_mblk(uio_t *);
2336 2396 extern mblk_t *rfs_read_alloc(uint_t, struct iovec **, int *);
2337 2397 extern void rfs_rndup_mblks(mblk_t *, uint_t, int);
2338 2398 extern void rfs_free_xuio(void *);
2339 2399
2340 2400 #endif /* _KERNEL */
2341 2401
2342 2402 #ifdef __cplusplus
2343 2403 }
2344 2404 #endif
2345 2405
2346 2406 #endif /* _NFS_NFS_H */
|
↓ open down ↓ |
19 lines elided |
↑ open up ↑ |
XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX