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