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