Home | History | Annotate | Line # | Download | only in nfs
nfsproto.h revision 1.11
      1  1.11  christos /*	$NetBSD: nfsproto.h,v 1.11 2005/09/25 02:48:40 christos Exp $	*/
      2   1.1      fvdl 
      3   1.1      fvdl /*
      4   1.1      fvdl  * Copyright (c) 1989, 1993
      5   1.1      fvdl  *	The Regents of the University of California.  All rights reserved.
      6   1.1      fvdl  *
      7   1.1      fvdl  * This code is derived from software contributed to Berkeley by
      8   1.1      fvdl  * Rick Macklem at The University of Guelph.
      9   1.1      fvdl  *
     10   1.1      fvdl  * Redistribution and use in source and binary forms, with or without
     11   1.1      fvdl  * modification, are permitted provided that the following conditions
     12   1.1      fvdl  * are met:
     13   1.1      fvdl  * 1. Redistributions of source code must retain the above copyright
     14   1.1      fvdl  *    notice, this list of conditions and the following disclaimer.
     15   1.1      fvdl  * 2. Redistributions in binary form must reproduce the above copyright
     16   1.1      fvdl  *    notice, this list of conditions and the following disclaimer in the
     17   1.1      fvdl  *    documentation and/or other materials provided with the distribution.
     18  1.10       agc  * 3. Neither the name of the University nor the names of its contributors
     19   1.1      fvdl  *    may be used to endorse or promote products derived from this software
     20   1.1      fvdl  *    without specific prior written permission.
     21   1.1      fvdl  *
     22   1.1      fvdl  * THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND
     23   1.1      fvdl  * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
     24   1.1      fvdl  * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
     25   1.1      fvdl  * ARE DISCLAIMED.  IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE
     26   1.1      fvdl  * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
     27   1.1      fvdl  * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
     28   1.1      fvdl  * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
     29   1.1      fvdl  * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
     30   1.1      fvdl  * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
     31   1.1      fvdl  * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
     32   1.1      fvdl  * SUCH DAMAGE.
     33   1.1      fvdl  *
     34   1.1      fvdl  *	@(#)nfsproto.h	8.2 (Berkeley) 3/30/95
     35   1.1      fvdl  */
     36   1.1      fvdl 
     37   1.1      fvdl #ifndef _NFS_NFSPROTO_H_
     38   1.1      fvdl #define _NFS_NFSPROTO_H_
     39   1.1      fvdl 
     40   1.1      fvdl 
     41   1.1      fvdl /*
     42   1.1      fvdl  * nfs definitions as per the Version 2 and 3 specs
     43   1.1      fvdl  */
     44   1.1      fvdl 
     45   1.1      fvdl /*
     46   1.1      fvdl  * Constants as defined in the Sun NFS Version 2 and 3 specs.
     47   1.1      fvdl  * "NFS: Network File System Protocol Specification" RFC1094
     48   1.1      fvdl  * and in the "NFS: Network File System Version 3 Protocol
     49   1.8    kleink  * Specification" RFC1813.
     50   1.1      fvdl  */
     51   1.1      fvdl 
     52   1.1      fvdl #define NFS_PORT	2049
     53   1.1      fvdl #define	NFS_PROG	100003
     54   1.1      fvdl #define NFS_VER2	2
     55   1.1      fvdl #define	NFS_VER3	3
     56   1.1      fvdl #define NFS_V2MAXDATA	8192
     57   1.9      fvdl #define	NFS_MAXDGRAMDATA 32768
     58   1.9      fvdl #define	NFS_MAXDATA	MAXBSIZE
     59   1.1      fvdl #define	NFS_MAXPATHLEN	1024
     60   1.1      fvdl #define	NFS_MAXNAMLEN	255
     61   1.1      fvdl #define	NFS_MAXPKTHDR	404
     62   1.1      fvdl #define NFS_MAXPACKET	(NFS_MAXPKTHDR + NFS_MAXDATA)
     63   1.1      fvdl #define	NFS_MINPACKET	20
     64   1.1      fvdl #define	NFS_FABLKSIZE	512	/* Size in bytes of a block wrt fa_blocks */
     65   1.1      fvdl 
     66   1.1      fvdl /* Stat numbers for rpc returns (version 2 and 3) */
     67   1.1      fvdl #define	NFS_OK			0
     68   1.1      fvdl #define	NFSERR_PERM		1
     69   1.1      fvdl #define	NFSERR_NOENT		2
     70   1.1      fvdl #define	NFSERR_IO		5
     71   1.1      fvdl #define	NFSERR_NXIO		6
     72   1.1      fvdl #define	NFSERR_ACCES		13
     73   1.1      fvdl #define	NFSERR_EXIST		17
     74   1.1      fvdl #define	NFSERR_XDEV		18	/* Version 3 only */
     75   1.1      fvdl #define	NFSERR_NODEV		19
     76   1.1      fvdl #define	NFSERR_NOTDIR		20
     77   1.1      fvdl #define	NFSERR_ISDIR		21
     78   1.1      fvdl #define	NFSERR_INVAL		22	/* Version 3 only */
     79   1.1      fvdl #define	NFSERR_FBIG		27
     80   1.1      fvdl #define	NFSERR_NOSPC		28
     81   1.1      fvdl #define	NFSERR_ROFS		30
     82   1.1      fvdl #define	NFSERR_MLINK		31	/* Version 3 only */
     83  1.11  christos #define	NFSERR_TIMEDOUT		60	/* XXX */
     84   1.1      fvdl #define	NFSERR_NAMETOL		63
     85   1.1      fvdl #define	NFSERR_NOTEMPTY		66
     86   1.1      fvdl #define	NFSERR_DQUOT		69
     87   1.1      fvdl #define	NFSERR_STALE		70
     88   1.1      fvdl #define	NFSERR_REMOTE		71	/* Version 3 only */
     89   1.1      fvdl #define	NFSERR_WFLUSH		99	/* Version 2 only */
     90   1.1      fvdl #define	NFSERR_BADHANDLE	10001	/* The rest Version 3 only */
     91   1.1      fvdl #define	NFSERR_NOT_SYNC		10002
     92   1.1      fvdl #define	NFSERR_BAD_COOKIE	10003
     93   1.1      fvdl #define	NFSERR_NOTSUPP		10004
     94   1.1      fvdl #define	NFSERR_TOOSMALL		10005
     95   1.1      fvdl #define	NFSERR_SERVERFAULT	10006
     96   1.1      fvdl #define	NFSERR_BADTYPE		10007
     97   1.1      fvdl #define	NFSERR_JUKEBOX		10008
     98  1.11  christos #define	NFSERR_TRYLATER		NFSERR_JUKEBOX
     99   1.1      fvdl #define	NFSERR_STALEWRITEVERF	30001	/* Fake return for nfs_commit() */
    100   1.1      fvdl 
    101   1.1      fvdl #define NFSERR_RETVOID		0x20000000 /* Return void, not error */
    102   1.1      fvdl #define NFSERR_AUTHERR		0x40000000 /* Mark an authentication error */
    103   1.1      fvdl #define NFSERR_RETERR		0x80000000 /* Mark an error return for V3 */
    104   1.1      fvdl 
    105   1.1      fvdl /* Sizes in bytes of various nfs rpc components */
    106   1.1      fvdl #define	NFSX_UNSIGNED	4
    107   1.1      fvdl 
    108   1.1      fvdl /* specific to NFS Version 2 */
    109   1.1      fvdl #define	NFSX_V2FH	32
    110   1.1      fvdl #define	NFSX_V2FATTR	68
    111   1.1      fvdl #define	NFSX_V2SATTR	32
    112   1.1      fvdl #define	NFSX_V2COOKIE	4
    113   1.1      fvdl #define NFSX_V2STATFS	20
    114   1.1      fvdl 
    115   1.1      fvdl /* specific to NFS Version 3 */
    116   1.1      fvdl #define NFSX_V3FH		(sizeof (fhandle_t)) /* size this server uses */
    117   1.1      fvdl #define	NFSX_V3FHMAX		64	/* max. allowed by protocol */
    118   1.1      fvdl #define NFSX_V3FATTR		84
    119   1.1      fvdl #define NFSX_V3SATTR		60	/* max. all fields filled in */
    120   1.1      fvdl #define NFSX_V3SRVSATTR		(sizeof (struct nfsv3_sattr))
    121   1.1      fvdl #define NFSX_V3POSTOPATTR	(NFSX_V3FATTR + NFSX_UNSIGNED)
    122   1.1      fvdl #define NFSX_V3WCCDATA		(NFSX_V3POSTOPATTR + 8 * NFSX_UNSIGNED)
    123   1.1      fvdl #define NFSX_V3COOKIEVERF 	8
    124   1.1      fvdl #define NFSX_V3WRITEVERF 	8
    125   1.1      fvdl #define NFSX_V3CREATEVERF	8
    126   1.1      fvdl #define NFSX_V3STATFS		52
    127   1.1      fvdl #define NFSX_V3FSINFO		48
    128   1.1      fvdl #define NFSX_V3PATHCONF		24
    129   1.1      fvdl 
    130   1.1      fvdl /* variants for both versions */
    131   1.1      fvdl #define NFSX_FH(v3)		((v3) ? (NFSX_V3FHMAX + NFSX_UNSIGNED) : \
    132   1.1      fvdl 					NFSX_V2FH)
    133   1.1      fvdl #define NFSX_SRVFH(v3)		((v3) ? NFSX_V3FH : NFSX_V2FH)
    134   1.1      fvdl #define	NFSX_FATTR(v3)		((v3) ? NFSX_V3FATTR : NFSX_V2FATTR)
    135   1.1      fvdl #define NFSX_PREOPATTR(v3)	((v3) ? (7 * NFSX_UNSIGNED) : 0)
    136   1.1      fvdl #define NFSX_POSTOPATTR(v3)	((v3) ? (NFSX_V3FATTR + NFSX_UNSIGNED) : 0)
    137   1.1      fvdl #define NFSX_POSTOPORFATTR(v3)	((v3) ? (NFSX_V3FATTR + NFSX_UNSIGNED) : \
    138   1.1      fvdl 					NFSX_V2FATTR)
    139   1.1      fvdl #define NFSX_WCCDATA(v3)	((v3) ? NFSX_V3WCCDATA : 0)
    140   1.1      fvdl #define NFSX_WCCORFATTR(v3)	((v3) ? NFSX_V3WCCDATA : NFSX_V2FATTR)
    141   1.1      fvdl #define	NFSX_SATTR(v3)		((v3) ? NFSX_V3SATTR : NFSX_V2SATTR)
    142   1.1      fvdl #define	NFSX_COOKIEVERF(v3)	((v3) ? NFSX_V3COOKIEVERF : 0)
    143   1.1      fvdl #define	NFSX_WRITEVERF(v3)	((v3) ? NFSX_V3WRITEVERF : 0)
    144   1.1      fvdl #define NFSX_READDIR(v3)	((v3) ? (5 * NFSX_UNSIGNED) : \
    145   1.1      fvdl 					(2 * NFSX_UNSIGNED))
    146   1.1      fvdl #define	NFSX_STATFS(v3)		((v3) ? NFSX_V3STATFS : NFSX_V2STATFS)
    147   1.1      fvdl 
    148   1.1      fvdl /* nfs rpc procedure numbers (before version mapping) */
    149   1.1      fvdl #define	NFSPROC_NULL		0
    150   1.1      fvdl #define	NFSPROC_GETATTR		1
    151   1.1      fvdl #define	NFSPROC_SETATTR		2
    152   1.1      fvdl #define	NFSPROC_LOOKUP		3
    153   1.1      fvdl #define	NFSPROC_ACCESS		4
    154   1.1      fvdl #define	NFSPROC_READLINK	5
    155   1.1      fvdl #define	NFSPROC_READ		6
    156   1.1      fvdl #define	NFSPROC_WRITE		7
    157   1.1      fvdl #define	NFSPROC_CREATE		8
    158   1.1      fvdl #define	NFSPROC_MKDIR		9
    159   1.1      fvdl #define	NFSPROC_SYMLINK		10
    160   1.1      fvdl #define	NFSPROC_MKNOD		11
    161   1.1      fvdl #define	NFSPROC_REMOVE		12
    162   1.1      fvdl #define	NFSPROC_RMDIR		13
    163   1.1      fvdl #define	NFSPROC_RENAME		14
    164   1.1      fvdl #define	NFSPROC_LINK		15
    165   1.1      fvdl #define	NFSPROC_READDIR		16
    166   1.1      fvdl #define	NFSPROC_READDIRPLUS	17
    167   1.1      fvdl #define	NFSPROC_FSSTAT		18
    168   1.1      fvdl #define	NFSPROC_FSINFO		19
    169   1.1      fvdl #define	NFSPROC_PATHCONF	20
    170   1.1      fvdl #define	NFSPROC_COMMIT		21
    171   1.1      fvdl 
    172   1.1      fvdl /* And leasing (nqnfs) procedure numbers (must be last) */
    173   1.1      fvdl #define	NQNFSPROC_GETLEASE	22
    174   1.1      fvdl #define	NQNFSPROC_VACATED	23
    175   1.1      fvdl #define	NQNFSPROC_EVICTED	24
    176   1.1      fvdl 
    177   1.1      fvdl #define NFSPROC_NOOP		25
    178   1.1      fvdl #define	NFS_NPROCS		26
    179   1.1      fvdl 
    180   1.1      fvdl /* Actual Version 2 procedure numbers */
    181   1.1      fvdl #define	NFSV2PROC_NULL		0
    182   1.1      fvdl #define	NFSV2PROC_GETATTR	1
    183   1.1      fvdl #define	NFSV2PROC_SETATTR	2
    184   1.1      fvdl #define	NFSV2PROC_NOOP		3
    185   1.1      fvdl #define	NFSV2PROC_ROOT		NFSV2PROC_NOOP	/* Obsolete */
    186   1.1      fvdl #define	NFSV2PROC_LOOKUP	4
    187   1.1      fvdl #define	NFSV2PROC_READLINK	5
    188   1.1      fvdl #define	NFSV2PROC_READ		6
    189   1.1      fvdl #define	NFSV2PROC_WRITECACHE	NFSV2PROC_NOOP	/* Obsolete */
    190   1.1      fvdl #define	NFSV2PROC_WRITE		8
    191   1.1      fvdl #define	NFSV2PROC_CREATE	9
    192   1.1      fvdl #define	NFSV2PROC_REMOVE	10
    193   1.1      fvdl #define	NFSV2PROC_RENAME	11
    194   1.1      fvdl #define	NFSV2PROC_LINK		12
    195   1.1      fvdl #define	NFSV2PROC_SYMLINK	13
    196   1.1      fvdl #define	NFSV2PROC_MKDIR		14
    197   1.1      fvdl #define	NFSV2PROC_RMDIR		15
    198   1.1      fvdl #define	NFSV2PROC_READDIR	16
    199   1.1      fvdl #define	NFSV2PROC_STATFS	17
    200   1.1      fvdl 
    201   1.1      fvdl /*
    202   1.1      fvdl  * Constants used by the Version 3 protocol for various RPCs
    203   1.1      fvdl  */
    204   1.1      fvdl #define NFSV3SATTRTIME_DONTCHANGE	0
    205   1.1      fvdl #define NFSV3SATTRTIME_TOSERVER		1
    206   1.1      fvdl #define NFSV3SATTRTIME_TOCLIENT		2
    207   1.1      fvdl 
    208   1.1      fvdl #define NFSV3ACCESS_READ		0x01
    209   1.1      fvdl #define NFSV3ACCESS_LOOKUP		0x02
    210   1.1      fvdl #define NFSV3ACCESS_MODIFY		0x04
    211   1.1      fvdl #define NFSV3ACCESS_EXTEND		0x08
    212   1.1      fvdl #define NFSV3ACCESS_DELETE		0x10
    213   1.1      fvdl #define NFSV3ACCESS_EXECUTE		0x20
    214   1.1      fvdl 
    215   1.1      fvdl #define NFSV3WRITE_UNSTABLE		0
    216   1.1      fvdl #define NFSV3WRITE_DATASYNC		1
    217   1.1      fvdl #define NFSV3WRITE_FILESYNC		2
    218   1.1      fvdl 
    219   1.1      fvdl #define NFSV3CREATE_UNCHECKED		0
    220   1.1      fvdl #define NFSV3CREATE_GUARDED		1
    221   1.1      fvdl #define NFSV3CREATE_EXCLUSIVE		2
    222   1.1      fvdl 
    223   1.1      fvdl #define NFSV3FSINFO_LINK		0x01
    224   1.1      fvdl #define NFSV3FSINFO_SYMLINK		0x02
    225   1.1      fvdl #define NFSV3FSINFO_HOMOGENEOUS		0x08
    226   1.1      fvdl #define NFSV3FSINFO_CANSETTIME		0x10
    227   1.1      fvdl 
    228   1.1      fvdl /* Conversion macros */
    229   1.1      fvdl #define	vtonfsv2_mode(t,m) \
    230   1.1      fvdl 		txdr_unsigned(((t) == VFIFO) ? MAKEIMODE(VCHR, (m)) : \
    231   1.1      fvdl 				MAKEIMODE((t), (m)))
    232   1.2   mycroft #define vtonfsv3_mode(m)	txdr_unsigned((m) & ALLPERMS)
    233   1.5  christos #define	nfstov_mode(a)		(fxdr_unsigned(u_int32_t, (a)) & ALLPERMS)
    234   1.1      fvdl #define	vtonfsv2_type(a)	txdr_unsigned(nfsv2_type[((int32_t)(a))])
    235   1.1      fvdl #define	vtonfsv3_type(a)	txdr_unsigned(nfsv3_type[((int32_t)(a))])
    236   1.1      fvdl #define	nfsv2tov_type(a)	nv2tov_type[fxdr_unsigned(u_int32_t,(a))&0x7]
    237   1.1      fvdl #define	nfsv3tov_type(a)	nv3tov_type[fxdr_unsigned(u_int32_t,(a))&0x7]
    238   1.1      fvdl 
    239   1.1      fvdl /* File types */
    240   1.1      fvdl typedef enum { NFNON=0, NFREG=1, NFDIR=2, NFBLK=3, NFCHR=4, NFLNK=5,
    241   1.1      fvdl 	NFSOCK=6, NFFIFO=7 } nfstype;
    242   1.1      fvdl 
    243   1.1      fvdl /* Structs for common parts of the rpc's */
    244   1.1      fvdl /*
    245   1.1      fvdl  * File Handle (32 bytes for version 2), variable up to 64 for version 3.
    246   1.1      fvdl  * File Handles of up to NFS_SMALLFH in size are stored directly in the
    247   1.1      fvdl  * nfs node, whereas larger ones are malloc'd. (This never happens when
    248   1.1      fvdl  * NFS_SMALLFH is set to 64.)
    249   1.1      fvdl  * NFS_SMALLFH should be in the range of 32 to 64 and be divisible by 4.
    250   1.1      fvdl  */
    251   1.1      fvdl #ifndef NFS_SMALLFH
    252   1.7      fvdl #define NFS_SMALLFH	64
    253   1.1      fvdl #endif
    254   1.1      fvdl union nfsfh {
    255   1.1      fvdl 	fhandle_t fh_generic;
    256   1.1      fvdl 	u_char    fh_bytes[NFS_SMALLFH];
    257   1.1      fvdl };
    258   1.1      fvdl typedef union nfsfh nfsfh_t;
    259   1.1      fvdl 
    260   1.1      fvdl struct nfsv2_time {
    261   1.1      fvdl 	u_int32_t nfsv2_sec;
    262   1.1      fvdl 	u_int32_t nfsv2_usec;
    263   1.1      fvdl };
    264   1.1      fvdl typedef struct nfsv2_time	nfstime2;
    265   1.1      fvdl 
    266   1.1      fvdl struct nfsv3_time {
    267   1.1      fvdl 	u_int32_t nfsv3_sec;
    268   1.1      fvdl 	u_int32_t nfsv3_nsec;
    269   1.1      fvdl };
    270   1.1      fvdl typedef struct nfsv3_time	nfstime3;
    271   1.1      fvdl 
    272   1.1      fvdl /*
    273   1.1      fvdl  * Quads are defined as arrays of 2 longs to ensure dense packing for the
    274   1.1      fvdl  * protocol and to facilitate xdr conversion.
    275   1.1      fvdl  */
    276   1.1      fvdl struct nfs_uquad {
    277   1.1      fvdl 	u_int32_t nfsuquad[2];
    278   1.1      fvdl };
    279   1.1      fvdl typedef	struct nfs_uquad	nfsuint64;
    280   1.1      fvdl 
    281   1.1      fvdl /*
    282   1.1      fvdl  * Used to convert between two u_longs and a u_quad_t.
    283   1.1      fvdl  */
    284   1.1      fvdl union nfs_quadconvert {
    285   1.1      fvdl 	u_int32_t lval[2];
    286   1.1      fvdl 	u_quad_t  qval;
    287   1.1      fvdl };
    288   1.1      fvdl typedef union nfs_quadconvert	nfsquad_t;
    289   1.1      fvdl 
    290   1.1      fvdl /*
    291   1.1      fvdl  * NFS Version 3 special file number.
    292   1.1      fvdl  */
    293   1.1      fvdl struct nfsv3_spec {
    294   1.1      fvdl 	u_int32_t specdata1;
    295   1.1      fvdl 	u_int32_t specdata2;
    296   1.1      fvdl };
    297   1.1      fvdl typedef	struct nfsv3_spec	nfsv3spec;
    298   1.1      fvdl 
    299   1.1      fvdl /*
    300   1.1      fvdl  * File attributes and setable attributes. These structures cover both
    301   1.1      fvdl  * NFS version 2 and the version 3 protocol. Note that the union is only
    302   1.1      fvdl  * used so that one pointer can refer to both variants. These structures
    303   1.1      fvdl  * go out on the wire and must be densely packed, so no quad data types
    304   1.1      fvdl  * are used. (all fields are longs or u_longs or structures of same)
    305   1.1      fvdl  * NB: You can't do sizeof(struct nfs_fattr), you must use the
    306   1.1      fvdl  *     NFSX_FATTR(v3) macro.
    307   1.1      fvdl  */
    308   1.1      fvdl struct nfs_fattr {
    309   1.1      fvdl 	u_int32_t fa_type;
    310   1.1      fvdl 	u_int32_t fa_mode;
    311   1.1      fvdl 	u_int32_t fa_nlink;
    312   1.1      fvdl 	u_int32_t fa_uid;
    313   1.1      fvdl 	u_int32_t fa_gid;
    314   1.1      fvdl 	union {
    315   1.1      fvdl 		struct {
    316   1.1      fvdl 			u_int32_t nfsv2fa_size;
    317   1.1      fvdl 			u_int32_t nfsv2fa_blocksize;
    318   1.1      fvdl 			u_int32_t nfsv2fa_rdev;
    319   1.1      fvdl 			u_int32_t nfsv2fa_blocks;
    320   1.1      fvdl 			u_int32_t nfsv2fa_fsid;
    321   1.1      fvdl 			u_int32_t nfsv2fa_fileid;
    322   1.1      fvdl 			nfstime2  nfsv2fa_atime;
    323   1.1      fvdl 			nfstime2  nfsv2fa_mtime;
    324   1.1      fvdl 			nfstime2  nfsv2fa_ctime;
    325   1.1      fvdl 		} fa_nfsv2;
    326   1.1      fvdl 		struct {
    327   1.1      fvdl 			nfsuint64 nfsv3fa_size;
    328   1.1      fvdl 			nfsuint64 nfsv3fa_used;
    329   1.1      fvdl 			nfsv3spec nfsv3fa_rdev;
    330   1.1      fvdl 			nfsuint64 nfsv3fa_fsid;
    331   1.1      fvdl 			nfsuint64 nfsv3fa_fileid;
    332   1.1      fvdl 			nfstime3  nfsv3fa_atime;
    333   1.1      fvdl 			nfstime3  nfsv3fa_mtime;
    334   1.1      fvdl 			nfstime3  nfsv3fa_ctime;
    335   1.1      fvdl 		} fa_nfsv3;
    336   1.1      fvdl 	} fa_un;
    337   1.1      fvdl };
    338   1.1      fvdl 
    339   1.1      fvdl /* and some ugly defines for accessing union components */
    340   1.1      fvdl #define	fa2_size		fa_un.fa_nfsv2.nfsv2fa_size
    341   1.1      fvdl #define	fa2_blocksize		fa_un.fa_nfsv2.nfsv2fa_blocksize
    342   1.1      fvdl #define	fa2_rdev		fa_un.fa_nfsv2.nfsv2fa_rdev
    343   1.1      fvdl #define	fa2_blocks		fa_un.fa_nfsv2.nfsv2fa_blocks
    344   1.1      fvdl #define	fa2_fsid		fa_un.fa_nfsv2.nfsv2fa_fsid
    345   1.1      fvdl #define	fa2_fileid		fa_un.fa_nfsv2.nfsv2fa_fileid
    346   1.1      fvdl #define	fa2_atime		fa_un.fa_nfsv2.nfsv2fa_atime
    347   1.1      fvdl #define	fa2_mtime		fa_un.fa_nfsv2.nfsv2fa_mtime
    348   1.1      fvdl #define	fa2_ctime		fa_un.fa_nfsv2.nfsv2fa_ctime
    349   1.1      fvdl #define	fa3_size		fa_un.fa_nfsv3.nfsv3fa_size
    350   1.1      fvdl #define	fa3_used		fa_un.fa_nfsv3.nfsv3fa_used
    351   1.1      fvdl #define	fa3_rdev		fa_un.fa_nfsv3.nfsv3fa_rdev
    352   1.1      fvdl #define	fa3_fsid		fa_un.fa_nfsv3.nfsv3fa_fsid
    353   1.1      fvdl #define	fa3_fileid		fa_un.fa_nfsv3.nfsv3fa_fileid
    354   1.1      fvdl #define	fa3_atime		fa_un.fa_nfsv3.nfsv3fa_atime
    355   1.1      fvdl #define	fa3_mtime		fa_un.fa_nfsv3.nfsv3fa_mtime
    356   1.1      fvdl #define	fa3_ctime		fa_un.fa_nfsv3.nfsv3fa_ctime
    357   1.1      fvdl 
    358   1.1      fvdl struct nfsv2_sattr {
    359   1.1      fvdl 	u_int32_t sa_mode;
    360   1.1      fvdl 	u_int32_t sa_uid;
    361   1.1      fvdl 	u_int32_t sa_gid;
    362   1.1      fvdl 	u_int32_t sa_size;
    363   1.1      fvdl 	nfstime2  sa_atime;
    364   1.1      fvdl 	nfstime2  sa_mtime;
    365   1.1      fvdl };
    366   1.1      fvdl 
    367   1.1      fvdl /*
    368   1.1      fvdl  * NFS Version 3 sattr structure for the new node creation case.
    369   1.1      fvdl  */
    370   1.1      fvdl struct nfsv3_sattr {
    371   1.1      fvdl 	u_int32_t sa_modetrue;
    372   1.1      fvdl 	u_int32_t sa_mode;
    373   1.1      fvdl 	u_int32_t sa_uidfalse;
    374   1.1      fvdl 	u_int32_t sa_gidfalse;
    375   1.1      fvdl 	u_int32_t sa_sizefalse;
    376   1.1      fvdl 	u_int32_t sa_atimetype;
    377   1.1      fvdl 	nfstime3  sa_atime;
    378   1.1      fvdl 	u_int32_t sa_mtimetype;
    379   1.1      fvdl 	nfstime3  sa_mtime;
    380   1.1      fvdl };
    381   1.1      fvdl 
    382   1.1      fvdl struct nfs_statfs {
    383   1.1      fvdl 	union {
    384   1.1      fvdl 		struct {
    385   1.1      fvdl 			u_int32_t nfsv2sf_tsize;
    386   1.1      fvdl 			u_int32_t nfsv2sf_bsize;
    387   1.1      fvdl 			u_int32_t nfsv2sf_blocks;
    388   1.1      fvdl 			u_int32_t nfsv2sf_bfree;
    389   1.1      fvdl 			u_int32_t nfsv2sf_bavail;
    390   1.1      fvdl 		} sf_nfsv2;
    391   1.1      fvdl 		struct {
    392   1.1      fvdl 			nfsuint64 nfsv3sf_tbytes;
    393   1.1      fvdl 			nfsuint64 nfsv3sf_fbytes;
    394   1.1      fvdl 			nfsuint64 nfsv3sf_abytes;
    395   1.1      fvdl 			nfsuint64 nfsv3sf_tfiles;
    396   1.1      fvdl 			nfsuint64 nfsv3sf_ffiles;
    397   1.1      fvdl 			nfsuint64 nfsv3sf_afiles;
    398   1.1      fvdl 			u_int32_t nfsv3sf_invarsec;
    399   1.1      fvdl 		} sf_nfsv3;
    400   1.1      fvdl 	} sf_un;
    401   1.1      fvdl };
    402   1.1      fvdl 
    403   1.1      fvdl #define sf_tsize	sf_un.sf_nfsv2.nfsv2sf_tsize
    404   1.1      fvdl #define sf_bsize	sf_un.sf_nfsv2.nfsv2sf_bsize
    405   1.1      fvdl #define sf_blocks	sf_un.sf_nfsv2.nfsv2sf_blocks
    406   1.1      fvdl #define sf_bfree	sf_un.sf_nfsv2.nfsv2sf_bfree
    407   1.1      fvdl #define sf_bavail	sf_un.sf_nfsv2.nfsv2sf_bavail
    408   1.1      fvdl #define sf_tbytes	sf_un.sf_nfsv3.nfsv3sf_tbytes
    409   1.1      fvdl #define sf_fbytes	sf_un.sf_nfsv3.nfsv3sf_fbytes
    410   1.1      fvdl #define sf_abytes	sf_un.sf_nfsv3.nfsv3sf_abytes
    411   1.1      fvdl #define sf_tfiles	sf_un.sf_nfsv3.nfsv3sf_tfiles
    412   1.1      fvdl #define sf_ffiles	sf_un.sf_nfsv3.nfsv3sf_ffiles
    413   1.1      fvdl #define sf_afiles	sf_un.sf_nfsv3.nfsv3sf_afiles
    414   1.1      fvdl #define sf_invarsec	sf_un.sf_nfsv3.nfsv3sf_invarsec
    415   1.1      fvdl 
    416   1.1      fvdl struct nfsv3_fsinfo {
    417   1.1      fvdl 	u_int32_t fs_rtmax;
    418   1.1      fvdl 	u_int32_t fs_rtpref;
    419   1.1      fvdl 	u_int32_t fs_rtmult;
    420   1.1      fvdl 	u_int32_t fs_wtmax;
    421   1.1      fvdl 	u_int32_t fs_wtpref;
    422   1.1      fvdl 	u_int32_t fs_wtmult;
    423   1.1      fvdl 	u_int32_t fs_dtpref;
    424   1.1      fvdl 	nfsuint64 fs_maxfilesize;
    425   1.1      fvdl 	nfstime3  fs_timedelta;
    426   1.1      fvdl 	u_int32_t fs_properties;
    427   1.1      fvdl };
    428   1.1      fvdl 
    429   1.1      fvdl struct nfsv3_pathconf {
    430   1.1      fvdl 	u_int32_t pc_linkmax;
    431   1.1      fvdl 	u_int32_t pc_namemax;
    432   1.1      fvdl 	u_int32_t pc_notrunc;
    433   1.1      fvdl 	u_int32_t pc_chownrestricted;
    434   1.1      fvdl 	u_int32_t pc_caseinsensitive;
    435   1.1      fvdl 	u_int32_t pc_casepreserving;
    436   1.1      fvdl };
    437   1.1      fvdl 
    438   1.1      fvdl #endif
    439