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