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