nfsm_subs.h revision 9336
11541Srgrimes/*
21541Srgrimes * Copyright (c) 1989, 1993
31541Srgrimes *	The Regents of the University of California.  All rights reserved.
41541Srgrimes *
51541Srgrimes * This code is derived from software contributed to Berkeley by
61541Srgrimes * Rick Macklem at The University of Guelph.
71541Srgrimes *
81541Srgrimes * Redistribution and use in source and binary forms, with or without
91541Srgrimes * modification, are permitted provided that the following conditions
101541Srgrimes * are met:
111541Srgrimes * 1. Redistributions of source code must retain the above copyright
121541Srgrimes *    notice, this list of conditions and the following disclaimer.
131541Srgrimes * 2. Redistributions in binary form must reproduce the above copyright
141541Srgrimes *    notice, this list of conditions and the following disclaimer in the
151541Srgrimes *    documentation and/or other materials provided with the distribution.
161541Srgrimes * 3. All advertising materials mentioning features or use of this software
171541Srgrimes *    must display the following acknowledgement:
181541Srgrimes *	This product includes software developed by the University of
191541Srgrimes *	California, Berkeley and its contributors.
201541Srgrimes * 4. Neither the name of the University nor the names of its contributors
211541Srgrimes *    may be used to endorse or promote products derived from this software
221541Srgrimes *    without specific prior written permission.
231541Srgrimes *
241541Srgrimes * THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND
251541Srgrimes * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
261541Srgrimes * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
271541Srgrimes * ARE DISCLAIMED.  IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE
281541Srgrimes * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
291541Srgrimes * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
301541Srgrimes * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
311541Srgrimes * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
321541Srgrimes * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
331541Srgrimes * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
341541Srgrimes * SUCH DAMAGE.
351541Srgrimes *
361541Srgrimes *	@(#)nfsm_subs.h	8.1 (Berkeley) 6/16/93
379336Sdfr * $Id: nfsm_subs.h,v 1.6 1995/05/30 08:12:51 rgrimes Exp $
381541Srgrimes */
391541Srgrimes
402175Spaul#ifndef _NFS_NFSM_SUBS_H_
412175Spaul#define _NFS_NFSM_SUBS_H_
422175Spaul
439336Sdfr
441541Srgrimes/*
451541Srgrimes * These macros do strange and peculiar things to mbuf chains for
461541Srgrimes * the assistance of the nfs code. To attempt to use them for any
471541Srgrimes * other purpose will be dangerous. (they make weird assumptions)
481541Srgrimes */
491541Srgrimes
501541Srgrimes/*
511541Srgrimes * First define what the actual subs. return
521541Srgrimes */
531541Srgrimesextern struct mbuf *nfsm_reqh();
541541Srgrimes
551541Srgrimes#define	M_HASCL(m)	((m)->m_flags & M_EXT)
561541Srgrimes#define	NFSMINOFF(m) \
571541Srgrimes		if (M_HASCL(m)) \
581541Srgrimes			(m)->m_data = (m)->m_ext.ext_buf; \
591541Srgrimes		else if ((m)->m_flags & M_PKTHDR) \
601541Srgrimes			(m)->m_data = (m)->m_pktdat; \
611541Srgrimes		else \
621541Srgrimes			(m)->m_data = (m)->m_dat
631541Srgrimes#define	NFSMADV(m, s)	(m)->m_data += (s)
641541Srgrimes#define	NFSMSIZ(m)	((M_HASCL(m))?MCLBYTES: \
651541Srgrimes				(((m)->m_flags & M_PKTHDR)?MHLEN:MLEN))
661541Srgrimes
671541Srgrimes/*
681541Srgrimes * Now for the macros that do the simple stuff and call the functions
691541Srgrimes * for the hard stuff.
701541Srgrimes * These macros use several vars. declared in nfsm_reqhead and these
711541Srgrimes * vars. must not be used elsewhere unless you are careful not to corrupt
721541Srgrimes * them. The vars. starting with pN and tN (N=1,2,3,..) are temporaries
731541Srgrimes * that may be used so long as the value is not expected to retained
741541Srgrimes * after a macro.
751541Srgrimes * I know, this is kind of dorkey, but it makes the actual op functions
761541Srgrimes * fairly clean and deals with the mess caused by the xdr discriminating
771541Srgrimes * unions.
781541Srgrimes */
791541Srgrimes
801541Srgrimes#define	nfsm_build(a,c,s) \
811541Srgrimes		{ if ((s) > M_TRAILINGSPACE(mb)) { \
821541Srgrimes			MGET(mb2, M_WAIT, MT_DATA); \
831541Srgrimes			if ((s) > MLEN) \
841541Srgrimes				panic("build > MLEN"); \
851541Srgrimes			mb->m_next = mb2; \
861541Srgrimes			mb = mb2; \
871541Srgrimes			mb->m_len = 0; \
881541Srgrimes			bpos = mtod(mb, caddr_t); \
891541Srgrimes		} \
901541Srgrimes		(a) = (c)(bpos); \
911541Srgrimes		mb->m_len += (s); \
921541Srgrimes		bpos += (s); }
931541Srgrimes
949336Sdfr#define	nfsm_dissect(a, c, s) \
951541Srgrimes		{ t1 = mtod(md, caddr_t)+md->m_len-dpos; \
961541Srgrimes		if (t1 >= (s)) { \
971541Srgrimes			(a) = (c)(dpos); \
981541Srgrimes			dpos += (s); \
999336Sdfr		} else if (t1 = nfsm_disct(&md, &dpos, (s), t1, &cp2)) { \
1009336Sdfr			error = t1; \
1019336Sdfr			m_freem(mrep); \
1029336Sdfr			goto nfsmout; \
1031541Srgrimes		} else { \
1049336Sdfr			(a) = (c)cp2; \
1059336Sdfr		} }
1069336Sdfr
1079336Sdfr#define nfsm_fhtom(v, v3) \
1089336Sdfr	      { if (v3) { \
1099336Sdfr			t2 = nfsm_rndup(VTONFS(v)->n_fhsize) + NFSX_UNSIGNED; \
1109336Sdfr			if (t2 <= M_TRAILINGSPACE(mb)) { \
1119336Sdfr				nfsm_build(tl, u_long *, t2); \
1129336Sdfr				*tl++ = txdr_unsigned(VTONFS(v)->n_fhsize); \
1139336Sdfr				*(tl + ((t2>>2) - 2)) = 0; \
1149336Sdfr				bcopy((caddr_t)VTONFS(v)->n_fhp,(caddr_t)tl, \
1159336Sdfr					VTONFS(v)->n_fhsize); \
1169336Sdfr			} else if (t2 = nfsm_strtmbuf(&mb, &bpos, \
1179336Sdfr				(caddr_t)VTONFS(v)->n_fhp, VTONFS(v)->n_fhsize)) { \
1189336Sdfr				error = t2; \
1199336Sdfr				m_freem(mreq); \
1203305Sphk				goto nfsmout; \
1213305Sphk			} \
1229336Sdfr		} else { \
1239336Sdfr			nfsm_build(cp, caddr_t, NFSX_V2FH); \
1249336Sdfr			bcopy((caddr_t)VTONFS(v)->n_fhp, cp, NFSX_V2FH); \
1251541Srgrimes		} }
1261541Srgrimes
1279336Sdfr#define nfsm_srvfhtom(f, v3) \
1289336Sdfr		{ if (v3) { \
1299336Sdfr			nfsm_build(tl, u_long *, NFSX_UNSIGNED + NFSX_V3FH); \
1309336Sdfr			*tl++ = txdr_unsigned(NFSX_V3FH); \
1319336Sdfr			bcopy((caddr_t)(f), (caddr_t)tl, NFSX_V3FH); \
1329336Sdfr		} else { \
1339336Sdfr			nfsm_build(cp, caddr_t, NFSX_V2FH); \
1349336Sdfr			bcopy((caddr_t)(f), cp, NFSX_V2FH); \
1359336Sdfr		} }
1361541Srgrimes
1379336Sdfr#define nfsm_srvpostop_fh(f) \
1389336Sdfr		{ nfsm_build(tl, u_long *, 2 * NFSX_UNSIGNED + NFSX_V3FH); \
1399336Sdfr		*tl++ = nfs_true; \
1409336Sdfr		*tl++ = txdr_unsigned(NFSX_V3FH); \
1419336Sdfr		bcopy((caddr_t)(f), (caddr_t)tl, NFSX_V3FH); \
1429336Sdfr		}
1431541Srgrimes
1449336Sdfr#define nfsm_mtofh(d, v, v3, f) \
1459336Sdfr		{ struct nfsnode *ttnp; nfsfh_t *ttfhp; int ttfhsize; \
1469336Sdfr		if (v3) { \
1479336Sdfr			nfsm_dissect(tl, u_long *, NFSX_UNSIGNED); \
1489336Sdfr			(f) = fxdr_unsigned(int, *tl); \
1499336Sdfr		} else \
1509336Sdfr			(f) = 1; \
1519336Sdfr		if (f) { \
1529336Sdfr			nfsm_getfh(ttfhp, ttfhsize, (v3)); \
1539336Sdfr			if (t1 = nfs_nget((d)->v_mount, ttfhp, ttfhsize, \
1549336Sdfr				&ttnp)) { \
1559336Sdfr				error = t1; \
1569336Sdfr				m_freem(mrep); \
1579336Sdfr				goto nfsmout; \
1589336Sdfr			} \
1599336Sdfr			(v) = NFSTOV(ttnp); \
1601541Srgrimes		} \
1619336Sdfr		if (v3) { \
1629336Sdfr			nfsm_dissect(tl, u_long *, NFSX_UNSIGNED); \
1639336Sdfr			if (f) \
1649336Sdfr				(f) = fxdr_unsigned(int, *tl); \
1659336Sdfr			else if (fxdr_unsigned(int, *tl)) \
1669336Sdfr				nfsm_adv(NFSX_V3FATTR); \
1679336Sdfr		} \
1689336Sdfr		if (f) \
1699336Sdfr			nfsm_loadattr((v), (struct vattr *)0); \
1701541Srgrimes		}
1711541Srgrimes
1729336Sdfr#define nfsm_getfh(f, s, v3) \
1739336Sdfr		{ if (v3) { \
1749336Sdfr			nfsm_dissect(tl, u_long *, NFSX_UNSIGNED); \
1759336Sdfr			if (((s) = fxdr_unsigned(int, *tl)) <= 0 || \
1769336Sdfr				(s) > NFSX_V3FHMAX) { \
1779336Sdfr				m_freem(mrep); \
1789336Sdfr				error = EBADRPC; \
1799336Sdfr				goto nfsmout; \
1809336Sdfr			} \
1819336Sdfr		} else \
1829336Sdfr			(s) = NFSX_V2FH; \
1839336Sdfr		nfsm_dissect((f), nfsfh_t *, nfsm_rndup(s)); }
1849336Sdfr
1859336Sdfr#define	nfsm_loadattr(v, a) \
1869336Sdfr		{ struct vnode *ttvp = (v); \
1879336Sdfr		if (t1 = nfs_loadattrcache(&ttvp, &md, &dpos, (a))) { \
1889336Sdfr			error = t1; \
1891541Srgrimes			m_freem(mrep); \
1901541Srgrimes			goto nfsmout; \
1911541Srgrimes		} \
1929336Sdfr		(v) = ttvp; }
1931541Srgrimes
1949336Sdfr#define	nfsm_postop_attr(v, f) \
1959336Sdfr		{ struct vnode *ttvp = (v); \
1969336Sdfr		nfsm_dissect(tl, u_long *, NFSX_UNSIGNED); \
1979336Sdfr		if ((f) = fxdr_unsigned(int, *tl)) { \
1989336Sdfr			if (t1 = nfs_loadattrcache(&ttvp, &md, &dpos, \
1999336Sdfr				(struct vattr *)0)) { \
2009336Sdfr				error = t1; \
2019336Sdfr				(f) = 0; \
2029336Sdfr				m_freem(mrep); \
2039336Sdfr				goto nfsmout; \
2049336Sdfr			} \
2059336Sdfr			(v) = ttvp; \
2069336Sdfr		} }
2079336Sdfr
2089336Sdfr/* Used as (f) for nfsm_wcc_data() */
2099336Sdfr#define NFSV3_WCCRATTR	0
2109336Sdfr#define NFSV3_WCCCHK	1
2119336Sdfr
2129336Sdfr#define	nfsm_wcc_data(v, f) \
2139336Sdfr		{ int ttattrf, ttretf = 0; \
2149336Sdfr		nfsm_dissect(tl, u_long *, NFSX_UNSIGNED); \
2159336Sdfr		if (*tl == nfs_true) { \
2169336Sdfr			nfsm_dissect(tl, u_long *, 6 * NFSX_UNSIGNED); \
2179336Sdfr			if (f) \
2189336Sdfr				ttretf = (VTONFS(v)->n_mtime == \
2199336Sdfr					fxdr_unsigned(u_long, *(tl + 2))); \
2209336Sdfr		} \
2219336Sdfr		nfsm_postop_attr((v), ttattrf); \
2229336Sdfr		if (f) { \
2239336Sdfr			(f) = ttretf; \
2249336Sdfr		} else { \
2259336Sdfr			(f) = ttattrf; \
2269336Sdfr		} }
2279336Sdfr
2289336Sdfr#define nfsm_v3sattr(s, a, u, g) \
2299336Sdfr		{ (s)->sa_modetrue = nfs_true; \
2309336Sdfr		(s)->sa_mode = vtonfsv3_mode((a)->va_mode); \
2319336Sdfr		(s)->sa_uidtrue = nfs_true; \
2329336Sdfr		(s)->sa_uid = txdr_unsigned(u); \
2339336Sdfr		(s)->sa_gidtrue = nfs_true; \
2349336Sdfr		(s)->sa_gid = txdr_unsigned(g); \
2359336Sdfr		(s)->sa_sizefalse = nfs_false; \
2369336Sdfr		(s)->sa_atimetype = txdr_unsigned(NFSV3SATTRTIME_TOCLIENT); \
2379336Sdfr		txdr_nfsv3time(&(a)->va_atime, &(s)->sa_atime); \
2389336Sdfr		(s)->sa_mtimetype = txdr_unsigned(NFSV3SATTRTIME_TOCLIENT); \
2399336Sdfr		txdr_nfsv3time(&(a)->va_mtime, &(s)->sa_mtime); \
2409336Sdfr		}
2419336Sdfr
2421541Srgrimes#define	nfsm_strsiz(s,m) \
2431541Srgrimes		{ nfsm_dissect(tl,u_long *,NFSX_UNSIGNED); \
2441541Srgrimes		if (((s) = fxdr_unsigned(long,*tl)) > (m)) { \
2451541Srgrimes			m_freem(mrep); \
2461541Srgrimes			error = EBADRPC; \
2471541Srgrimes			goto nfsmout; \
2481541Srgrimes		} }
2491541Srgrimes
2501541Srgrimes#define	nfsm_srvstrsiz(s,m) \
2511541Srgrimes		{ nfsm_dissect(tl,u_long *,NFSX_UNSIGNED); \
2521541Srgrimes		if (((s) = fxdr_unsigned(long,*tl)) > (m) || (s) <= 0) { \
2531541Srgrimes			error = EBADRPC; \
2541541Srgrimes			nfsm_reply(0); \
2551541Srgrimes		} }
2561541Srgrimes
2579336Sdfr#define	nfsm_srvnamesiz(s) \
2589336Sdfr		{ nfsm_dissect(tl,u_long *,NFSX_UNSIGNED); \
2599336Sdfr		if (((s) = fxdr_unsigned(long,*tl)) > NFS_MAXNAMLEN) \
2609336Sdfr			error = NFSERR_NAMETOL; \
2619336Sdfr		if ((s) <= 0) \
2629336Sdfr			error = EBADRPC; \
2639336Sdfr		if (error) \
2649336Sdfr			nfsm_reply(0); \
2659336Sdfr		}
2669336Sdfr
2671541Srgrimes#define nfsm_mtouio(p,s) \
2681541Srgrimes		if ((s) > 0 && \
2699336Sdfr		   (t1 = nfsm_mbuftouio(&md,(p),(s),&dpos))) { \
2709336Sdfr			error = t1; \
2711541Srgrimes			m_freem(mrep); \
2721541Srgrimes			goto nfsmout; \
2731541Srgrimes		}
2741541Srgrimes
2751541Srgrimes#define nfsm_uiotom(p,s) \
2769336Sdfr		if (t1 = nfsm_uiotombuf((p),&mb,(s),&bpos)) { \
2779336Sdfr			error = t1; \
2781541Srgrimes			m_freem(mreq); \
2791541Srgrimes			goto nfsmout; \
2801541Srgrimes		}
2811541Srgrimes
2821541Srgrimes#define	nfsm_reqhead(v,a,s) \
2831541Srgrimes		mb = mreq = nfsm_reqh((v),(a),(s),&bpos)
2841541Srgrimes
2851541Srgrimes#define nfsm_reqdone	m_freem(mrep); \
2868876Srgrimes		nfsmout:
2871541Srgrimes
2881541Srgrimes#define nfsm_rndup(a)	(((a)+3)&(~0x3))
2891541Srgrimes
2901541Srgrimes#define	nfsm_request(v, t, p, c)	\
2919336Sdfr		if (error = nfs_request((v), mreq, (t), (p), \
2929336Sdfr		   (c), &mrep, &md, &dpos)) { \
2939336Sdfr			if (error & NFSERR_RETERR) \
2949336Sdfr				error &= ~NFSERR_RETERR; \
2959336Sdfr			else \
2969336Sdfr				goto nfsmout; \
2979336Sdfr		}
2981541Srgrimes
2991541Srgrimes#define	nfsm_strtom(a,s,m) \
3001541Srgrimes		if ((s) > (m)) { \
3011541Srgrimes			m_freem(mreq); \
3021541Srgrimes			error = ENAMETOOLONG; \
3031541Srgrimes			goto nfsmout; \
3041541Srgrimes		} \
3051541Srgrimes		t2 = nfsm_rndup(s)+NFSX_UNSIGNED; \
3061541Srgrimes		if (t2 <= M_TRAILINGSPACE(mb)) { \
3071541Srgrimes			nfsm_build(tl,u_long *,t2); \
3081541Srgrimes			*tl++ = txdr_unsigned(s); \
3091541Srgrimes			*(tl+((t2>>2)-2)) = 0; \
3101541Srgrimes			bcopy((caddr_t)(a), (caddr_t)tl, (s)); \
3119336Sdfr		} else if (t2 = nfsm_strtmbuf(&mb, &bpos, (a), (s))) { \
3129336Sdfr			error = t2; \
3139336Sdfr			m_freem(mreq); \
3149336Sdfr			goto nfsmout; \
3151541Srgrimes		}
3161541Srgrimes
3171541Srgrimes#define	nfsm_srvdone \
3181541Srgrimes		nfsmout: \
3191541Srgrimes		return(error)
3201541Srgrimes
3211541Srgrimes#define	nfsm_reply(s) \
3221541Srgrimes		{ \
3231541Srgrimes		nfsd->nd_repstat = error; \
3249336Sdfr		if (error && !(nfsd->nd_flag & ND_NFSV3)) \
3259336Sdfr		   (void) nfs_rephead(0, nfsd, slp, error, cache, &frev, \
3261541Srgrimes			mrq, &mb, &bpos); \
3271541Srgrimes		else \
3289336Sdfr		   (void) nfs_rephead((s), nfsd, slp, error, cache, &frev, \
3291541Srgrimes			mrq, &mb, &bpos); \
3301541Srgrimes		m_freem(mrep); \
3311541Srgrimes		mreq = *mrq; \
3329336Sdfr		if (error && (!(nfsd->nd_flag & ND_NFSV3) || \
3339336Sdfr			error == EBADRPC)) \
3341541Srgrimes			return(0); \
3351541Srgrimes		}
3361541Srgrimes
3379336Sdfr#define	nfsm_writereply(s, v3) \
3389336Sdfr		{ \
3399336Sdfr		nfsd->nd_repstat = error; \
3409336Sdfr		if (error && !(v3)) \
3419336Sdfr		   (void) nfs_rephead(0, nfsd, slp, error, cache, &frev, \
3429336Sdfr			&mreq, &mb, &bpos); \
3439336Sdfr		else \
3449336Sdfr		   (void) nfs_rephead((s), nfsd, slp, error, cache, &frev, \
3459336Sdfr			&mreq, &mb, &bpos); \
3469336Sdfr		}
3479336Sdfr
3481541Srgrimes#define	nfsm_adv(s) \
3499336Sdfr		{ t1 = mtod(md, caddr_t)+md->m_len-dpos; \
3501541Srgrimes		if (t1 >= (s)) { \
3511541Srgrimes			dpos += (s); \
3529336Sdfr		} else if (t1 = nfs_adv(&md, &dpos, (s), t1)) { \
3539336Sdfr			error = t1; \
3549336Sdfr			m_freem(mrep); \
3559336Sdfr			goto nfsmout; \
3569336Sdfr		} }
3579336Sdfr
3589336Sdfr#define nfsm_srvmtofh(f) \
3599336Sdfr		{ if (nfsd->nd_flag & ND_NFSV3) { \
3609336Sdfr			nfsm_dissect(tl, u_long *, NFSX_UNSIGNED); \
3619336Sdfr			if (fxdr_unsigned(int, *tl) != NFSX_V3FH) { \
3629336Sdfr				error = EBADRPC; \
3639336Sdfr				nfsm_reply(0); \
3643305Sphk			} \
3659336Sdfr		} \
3669336Sdfr		nfsm_dissect(tl, u_long *, NFSX_V3FH); \
3679336Sdfr		bcopy((caddr_t)tl, (caddr_t)(f), NFSX_V3FH); \
3689336Sdfr		if ((nfsd->nd_flag & ND_NFSV3) == 0) \
3699336Sdfr			nfsm_adv(NFSX_V2FH - NFSX_V3FH); \
3701541Srgrimes		}
3711541Srgrimes
3721541Srgrimes#define	nfsm_clget \
3731541Srgrimes		if (bp >= be) { \
3741541Srgrimes			if (mp == mb) \
3751541Srgrimes				mp->m_len += bp-bpos; \
3761541Srgrimes			MGET(mp, M_WAIT, MT_DATA); \
3771541Srgrimes			MCLGET(mp, M_WAIT); \
3781541Srgrimes			mp->m_len = NFSMSIZ(mp); \
3791541Srgrimes			mp2->m_next = mp; \
3801541Srgrimes			mp2 = mp; \
3811541Srgrimes			bp = mtod(mp, caddr_t); \
3821541Srgrimes			be = bp+mp->m_len; \
3831541Srgrimes		} \
3841541Srgrimes		tl = (u_long *)bp
3851541Srgrimes
3869336Sdfr#define	nfsm_srvfillattr(a, f) \
3879336Sdfr		nfsm_srvfattr(nfsd, (a), (f))
3881541Srgrimes
3899336Sdfr#define nfsm_srvwcc_data(br, b, ar, a) \
3909336Sdfr		nfsm_srvwcc(nfsd, (br), (b), (ar), (a), &mb, &bpos)
3919336Sdfr
3929336Sdfr#define nfsm_srvpostop_attr(r, a) \
3939336Sdfr		nfsm_srvpostopattr(nfsd, (r), (a), &mb, &bpos)
3949336Sdfr
3959336Sdfr#define nfsm_srvsattr(a) \
3969336Sdfr		{ nfsm_dissect(tl, u_long *, NFSX_UNSIGNED); \
3979336Sdfr		if (*tl == nfs_true) { \
3989336Sdfr			nfsm_dissect(tl, u_long *, NFSX_UNSIGNED); \
3999336Sdfr			(a)->va_mode = nfstov_mode(*tl); \
4009336Sdfr		} \
4019336Sdfr		nfsm_dissect(tl, u_long *, NFSX_UNSIGNED); \
4029336Sdfr		if (*tl == nfs_true) { \
4039336Sdfr			nfsm_dissect(tl, u_long *, NFSX_UNSIGNED); \
4049336Sdfr			(a)->va_uid = fxdr_unsigned(uid_t, *tl); \
4059336Sdfr		} \
4069336Sdfr		nfsm_dissect(tl, u_long *, NFSX_UNSIGNED); \
4079336Sdfr		if (*tl == nfs_true) { \
4089336Sdfr			nfsm_dissect(tl, u_long *, NFSX_UNSIGNED); \
4099336Sdfr			(a)->va_gid = fxdr_unsigned(gid_t, *tl); \
4109336Sdfr		} \
4119336Sdfr		nfsm_dissect(tl, u_long *, NFSX_UNSIGNED); \
4129336Sdfr		if (*tl == nfs_true) { \
4139336Sdfr			nfsm_dissect(tl, u_long *, 2 * NFSX_UNSIGNED); \
4149336Sdfr			fxdr_hyper(tl, &(a)->va_size); \
4159336Sdfr		} \
4169336Sdfr		nfsm_dissect(tl, u_long *, NFSX_UNSIGNED); \
4179336Sdfr		switch (fxdr_unsigned(int, *tl)) { \
4189336Sdfr		case NFSV3SATTRTIME_TOCLIENT: \
4199336Sdfr			nfsm_dissect(tl, u_long *, 2 * NFSX_UNSIGNED); \
4209336Sdfr			fxdr_nfsv3time(tl, &(a)->va_atime); \
4219336Sdfr			break; \
4229336Sdfr		case NFSV3SATTRTIME_TOSERVER: \
4239336Sdfr			(a)->va_atime.ts_sec = time.tv_sec; \
4249336Sdfr			(a)->va_atime.ts_nsec = time.tv_usec * 1000; \
4259336Sdfr			break; \
4269336Sdfr		}; \
4279336Sdfr		nfsm_dissect(tl, u_long *, NFSX_UNSIGNED); \
4289336Sdfr		switch (fxdr_unsigned(int, *tl)) { \
4299336Sdfr		case NFSV3SATTRTIME_TOCLIENT: \
4309336Sdfr			nfsm_dissect(tl, u_long *, 2 * NFSX_UNSIGNED); \
4319336Sdfr			fxdr_nfsv3time(tl, &(a)->va_mtime); \
4329336Sdfr			break; \
4339336Sdfr		case NFSV3SATTRTIME_TOSERVER: \
4349336Sdfr			(a)->va_mtime.ts_sec = time.tv_sec; \
4359336Sdfr			(a)->va_mtime.ts_nsec = time.tv_usec * 1000; \
4369336Sdfr			break; \
4379336Sdfr		}; }
4389336Sdfr
4392175Spaul#endif
440