nfsm_subs.h revision 10222
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 3710222Sdfr * $Id: nfsm_subs.h,v 1.7 1995/06/27 11:06:55 dfr 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 */ 5310222Sdfrstruct mbuf *nfsm_reqh __P((struct vnode *vp, u_long procid, int hsiz, 5410222Sdfr caddr_t *bposp)); 5510222Sdfrstruct mbuf *nfsm_rpchead __P((struct ucred *cr, int nmflag, int procid, 5610222Sdfr int auth_type, int auth_len, char *auth_str, 5710222Sdfr int verf_len, char *verf_str, 5810222Sdfr struct mbuf *mrest, int mrest_len, 5910222Sdfr struct mbuf **mbp, u_long *xidp)); 601541Srgrimes 611541Srgrimes#define M_HASCL(m) ((m)->m_flags & M_EXT) 621541Srgrimes#define NFSMINOFF(m) \ 631541Srgrimes if (M_HASCL(m)) \ 641541Srgrimes (m)->m_data = (m)->m_ext.ext_buf; \ 651541Srgrimes else if ((m)->m_flags & M_PKTHDR) \ 661541Srgrimes (m)->m_data = (m)->m_pktdat; \ 671541Srgrimes else \ 681541Srgrimes (m)->m_data = (m)->m_dat 691541Srgrimes#define NFSMADV(m, s) (m)->m_data += (s) 701541Srgrimes#define NFSMSIZ(m) ((M_HASCL(m))?MCLBYTES: \ 711541Srgrimes (((m)->m_flags & M_PKTHDR)?MHLEN:MLEN)) 721541Srgrimes 731541Srgrimes/* 741541Srgrimes * Now for the macros that do the simple stuff and call the functions 751541Srgrimes * for the hard stuff. 761541Srgrimes * These macros use several vars. declared in nfsm_reqhead and these 771541Srgrimes * vars. must not be used elsewhere unless you are careful not to corrupt 781541Srgrimes * them. The vars. starting with pN and tN (N=1,2,3,..) are temporaries 791541Srgrimes * that may be used so long as the value is not expected to retained 801541Srgrimes * after a macro. 811541Srgrimes * I know, this is kind of dorkey, but it makes the actual op functions 821541Srgrimes * fairly clean and deals with the mess caused by the xdr discriminating 831541Srgrimes * unions. 841541Srgrimes */ 851541Srgrimes 861541Srgrimes#define nfsm_build(a,c,s) \ 871541Srgrimes { if ((s) > M_TRAILINGSPACE(mb)) { \ 881541Srgrimes MGET(mb2, M_WAIT, MT_DATA); \ 891541Srgrimes if ((s) > MLEN) \ 901541Srgrimes panic("build > MLEN"); \ 911541Srgrimes mb->m_next = mb2; \ 921541Srgrimes mb = mb2; \ 931541Srgrimes mb->m_len = 0; \ 941541Srgrimes bpos = mtod(mb, caddr_t); \ 951541Srgrimes } \ 961541Srgrimes (a) = (c)(bpos); \ 971541Srgrimes mb->m_len += (s); \ 981541Srgrimes bpos += (s); } 991541Srgrimes 1009336Sdfr#define nfsm_dissect(a, c, s) \ 1011541Srgrimes { t1 = mtod(md, caddr_t)+md->m_len-dpos; \ 1021541Srgrimes if (t1 >= (s)) { \ 1031541Srgrimes (a) = (c)(dpos); \ 1041541Srgrimes dpos += (s); \ 1059336Sdfr } else if (t1 = nfsm_disct(&md, &dpos, (s), t1, &cp2)) { \ 1069336Sdfr error = t1; \ 1079336Sdfr m_freem(mrep); \ 1089336Sdfr goto nfsmout; \ 1091541Srgrimes } else { \ 1109336Sdfr (a) = (c)cp2; \ 1119336Sdfr } } 1129336Sdfr 1139336Sdfr#define nfsm_fhtom(v, v3) \ 1149336Sdfr { if (v3) { \ 1159336Sdfr t2 = nfsm_rndup(VTONFS(v)->n_fhsize) + NFSX_UNSIGNED; \ 1169336Sdfr if (t2 <= M_TRAILINGSPACE(mb)) { \ 1179336Sdfr nfsm_build(tl, u_long *, t2); \ 1189336Sdfr *tl++ = txdr_unsigned(VTONFS(v)->n_fhsize); \ 1199336Sdfr *(tl + ((t2>>2) - 2)) = 0; \ 1209336Sdfr bcopy((caddr_t)VTONFS(v)->n_fhp,(caddr_t)tl, \ 1219336Sdfr VTONFS(v)->n_fhsize); \ 1229336Sdfr } else if (t2 = nfsm_strtmbuf(&mb, &bpos, \ 1239336Sdfr (caddr_t)VTONFS(v)->n_fhp, VTONFS(v)->n_fhsize)) { \ 1249336Sdfr error = t2; \ 1259336Sdfr m_freem(mreq); \ 1263305Sphk goto nfsmout; \ 1273305Sphk } \ 1289336Sdfr } else { \ 1299336Sdfr nfsm_build(cp, caddr_t, NFSX_V2FH); \ 1309336Sdfr bcopy((caddr_t)VTONFS(v)->n_fhp, cp, NFSX_V2FH); \ 1311541Srgrimes } } 1321541Srgrimes 1339336Sdfr#define nfsm_srvfhtom(f, v3) \ 1349336Sdfr { if (v3) { \ 1359336Sdfr nfsm_build(tl, u_long *, NFSX_UNSIGNED + NFSX_V3FH); \ 1369336Sdfr *tl++ = txdr_unsigned(NFSX_V3FH); \ 1379336Sdfr bcopy((caddr_t)(f), (caddr_t)tl, NFSX_V3FH); \ 1389336Sdfr } else { \ 1399336Sdfr nfsm_build(cp, caddr_t, NFSX_V2FH); \ 1409336Sdfr bcopy((caddr_t)(f), cp, NFSX_V2FH); \ 1419336Sdfr } } 1421541Srgrimes 1439336Sdfr#define nfsm_srvpostop_fh(f) \ 1449336Sdfr { nfsm_build(tl, u_long *, 2 * NFSX_UNSIGNED + NFSX_V3FH); \ 1459336Sdfr *tl++ = nfs_true; \ 1469336Sdfr *tl++ = txdr_unsigned(NFSX_V3FH); \ 1479336Sdfr bcopy((caddr_t)(f), (caddr_t)tl, NFSX_V3FH); \ 1489336Sdfr } 1491541Srgrimes 1509336Sdfr#define nfsm_mtofh(d, v, v3, f) \ 1519336Sdfr { struct nfsnode *ttnp; nfsfh_t *ttfhp; int ttfhsize; \ 1529336Sdfr if (v3) { \ 1539336Sdfr nfsm_dissect(tl, u_long *, NFSX_UNSIGNED); \ 1549336Sdfr (f) = fxdr_unsigned(int, *tl); \ 1559336Sdfr } else \ 1569336Sdfr (f) = 1; \ 1579336Sdfr if (f) { \ 1589336Sdfr nfsm_getfh(ttfhp, ttfhsize, (v3)); \ 1599336Sdfr if (t1 = nfs_nget((d)->v_mount, ttfhp, ttfhsize, \ 1609336Sdfr &ttnp)) { \ 1619336Sdfr error = t1; \ 1629336Sdfr m_freem(mrep); \ 1639336Sdfr goto nfsmout; \ 1649336Sdfr } \ 1659336Sdfr (v) = NFSTOV(ttnp); \ 1661541Srgrimes } \ 1679336Sdfr if (v3) { \ 1689336Sdfr nfsm_dissect(tl, u_long *, NFSX_UNSIGNED); \ 1699336Sdfr if (f) \ 1709336Sdfr (f) = fxdr_unsigned(int, *tl); \ 1719336Sdfr else if (fxdr_unsigned(int, *tl)) \ 1729336Sdfr nfsm_adv(NFSX_V3FATTR); \ 1739336Sdfr } \ 1749336Sdfr if (f) \ 1759336Sdfr nfsm_loadattr((v), (struct vattr *)0); \ 1761541Srgrimes } 1771541Srgrimes 1789336Sdfr#define nfsm_getfh(f, s, v3) \ 1799336Sdfr { if (v3) { \ 1809336Sdfr nfsm_dissect(tl, u_long *, NFSX_UNSIGNED); \ 1819336Sdfr if (((s) = fxdr_unsigned(int, *tl)) <= 0 || \ 1829336Sdfr (s) > NFSX_V3FHMAX) { \ 1839336Sdfr m_freem(mrep); \ 1849336Sdfr error = EBADRPC; \ 1859336Sdfr goto nfsmout; \ 1869336Sdfr } \ 1879336Sdfr } else \ 1889336Sdfr (s) = NFSX_V2FH; \ 1899336Sdfr nfsm_dissect((f), nfsfh_t *, nfsm_rndup(s)); } 1909336Sdfr 1919336Sdfr#define nfsm_loadattr(v, a) \ 1929336Sdfr { struct vnode *ttvp = (v); \ 1939336Sdfr if (t1 = nfs_loadattrcache(&ttvp, &md, &dpos, (a))) { \ 1949336Sdfr error = t1; \ 1951541Srgrimes m_freem(mrep); \ 1961541Srgrimes goto nfsmout; \ 1971541Srgrimes } \ 1989336Sdfr (v) = ttvp; } 1991541Srgrimes 2009336Sdfr#define nfsm_postop_attr(v, f) \ 2019336Sdfr { struct vnode *ttvp = (v); \ 2029336Sdfr nfsm_dissect(tl, u_long *, NFSX_UNSIGNED); \ 2039336Sdfr if ((f) = fxdr_unsigned(int, *tl)) { \ 2049336Sdfr if (t1 = nfs_loadattrcache(&ttvp, &md, &dpos, \ 2059336Sdfr (struct vattr *)0)) { \ 2069336Sdfr error = t1; \ 2079336Sdfr (f) = 0; \ 2089336Sdfr m_freem(mrep); \ 2099336Sdfr goto nfsmout; \ 2109336Sdfr } \ 2119336Sdfr (v) = ttvp; \ 2129336Sdfr } } 2139336Sdfr 2149336Sdfr/* Used as (f) for nfsm_wcc_data() */ 2159336Sdfr#define NFSV3_WCCRATTR 0 2169336Sdfr#define NFSV3_WCCCHK 1 2179336Sdfr 2189336Sdfr#define nfsm_wcc_data(v, f) \ 2199336Sdfr { int ttattrf, ttretf = 0; \ 2209336Sdfr nfsm_dissect(tl, u_long *, NFSX_UNSIGNED); \ 2219336Sdfr if (*tl == nfs_true) { \ 2229336Sdfr nfsm_dissect(tl, u_long *, 6 * NFSX_UNSIGNED); \ 2239336Sdfr if (f) \ 2249336Sdfr ttretf = (VTONFS(v)->n_mtime == \ 2259336Sdfr fxdr_unsigned(u_long, *(tl + 2))); \ 2269336Sdfr } \ 2279336Sdfr nfsm_postop_attr((v), ttattrf); \ 2289336Sdfr if (f) { \ 2299336Sdfr (f) = ttretf; \ 2309336Sdfr } else { \ 2319336Sdfr (f) = ttattrf; \ 2329336Sdfr } } 2339336Sdfr 2349336Sdfr#define nfsm_v3sattr(s, a, u, g) \ 2359336Sdfr { (s)->sa_modetrue = nfs_true; \ 2369336Sdfr (s)->sa_mode = vtonfsv3_mode((a)->va_mode); \ 2379336Sdfr (s)->sa_uidtrue = nfs_true; \ 2389336Sdfr (s)->sa_uid = txdr_unsigned(u); \ 2399336Sdfr (s)->sa_gidtrue = nfs_true; \ 2409336Sdfr (s)->sa_gid = txdr_unsigned(g); \ 2419336Sdfr (s)->sa_sizefalse = nfs_false; \ 2429336Sdfr (s)->sa_atimetype = txdr_unsigned(NFSV3SATTRTIME_TOCLIENT); \ 2439336Sdfr txdr_nfsv3time(&(a)->va_atime, &(s)->sa_atime); \ 2449336Sdfr (s)->sa_mtimetype = txdr_unsigned(NFSV3SATTRTIME_TOCLIENT); \ 2459336Sdfr txdr_nfsv3time(&(a)->va_mtime, &(s)->sa_mtime); \ 2469336Sdfr } 2479336Sdfr 2481541Srgrimes#define nfsm_strsiz(s,m) \ 2491541Srgrimes { nfsm_dissect(tl,u_long *,NFSX_UNSIGNED); \ 2501541Srgrimes if (((s) = fxdr_unsigned(long,*tl)) > (m)) { \ 2511541Srgrimes m_freem(mrep); \ 2521541Srgrimes error = EBADRPC; \ 2531541Srgrimes goto nfsmout; \ 2541541Srgrimes } } 2551541Srgrimes 2561541Srgrimes#define nfsm_srvstrsiz(s,m) \ 2571541Srgrimes { nfsm_dissect(tl,u_long *,NFSX_UNSIGNED); \ 2581541Srgrimes if (((s) = fxdr_unsigned(long,*tl)) > (m) || (s) <= 0) { \ 2591541Srgrimes error = EBADRPC; \ 2601541Srgrimes nfsm_reply(0); \ 2611541Srgrimes } } 2621541Srgrimes 2639336Sdfr#define nfsm_srvnamesiz(s) \ 2649336Sdfr { nfsm_dissect(tl,u_long *,NFSX_UNSIGNED); \ 2659336Sdfr if (((s) = fxdr_unsigned(long,*tl)) > NFS_MAXNAMLEN) \ 2669336Sdfr error = NFSERR_NAMETOL; \ 2679336Sdfr if ((s) <= 0) \ 2689336Sdfr error = EBADRPC; \ 2699336Sdfr if (error) \ 2709336Sdfr nfsm_reply(0); \ 2719336Sdfr } 2729336Sdfr 2731541Srgrimes#define nfsm_mtouio(p,s) \ 2741541Srgrimes if ((s) > 0 && \ 2759336Sdfr (t1 = nfsm_mbuftouio(&md,(p),(s),&dpos))) { \ 2769336Sdfr error = t1; \ 2771541Srgrimes m_freem(mrep); \ 2781541Srgrimes goto nfsmout; \ 2791541Srgrimes } 2801541Srgrimes 2811541Srgrimes#define nfsm_uiotom(p,s) \ 2829336Sdfr if (t1 = nfsm_uiotombuf((p),&mb,(s),&bpos)) { \ 2839336Sdfr error = t1; \ 2841541Srgrimes m_freem(mreq); \ 2851541Srgrimes goto nfsmout; \ 2861541Srgrimes } 2871541Srgrimes 2881541Srgrimes#define nfsm_reqhead(v,a,s) \ 2891541Srgrimes mb = mreq = nfsm_reqh((v),(a),(s),&bpos) 2901541Srgrimes 2911541Srgrimes#define nfsm_reqdone m_freem(mrep); \ 2928876Srgrimes nfsmout: 2931541Srgrimes 2941541Srgrimes#define nfsm_rndup(a) (((a)+3)&(~0x3)) 2951541Srgrimes 2961541Srgrimes#define nfsm_request(v, t, p, c) \ 2979336Sdfr if (error = nfs_request((v), mreq, (t), (p), \ 2989336Sdfr (c), &mrep, &md, &dpos)) { \ 2999336Sdfr if (error & NFSERR_RETERR) \ 3009336Sdfr error &= ~NFSERR_RETERR; \ 3019336Sdfr else \ 3029336Sdfr goto nfsmout; \ 3039336Sdfr } 3041541Srgrimes 3051541Srgrimes#define nfsm_strtom(a,s,m) \ 3061541Srgrimes if ((s) > (m)) { \ 3071541Srgrimes m_freem(mreq); \ 3081541Srgrimes error = ENAMETOOLONG; \ 3091541Srgrimes goto nfsmout; \ 3101541Srgrimes } \ 3111541Srgrimes t2 = nfsm_rndup(s)+NFSX_UNSIGNED; \ 3121541Srgrimes if (t2 <= M_TRAILINGSPACE(mb)) { \ 3131541Srgrimes nfsm_build(tl,u_long *,t2); \ 3141541Srgrimes *tl++ = txdr_unsigned(s); \ 3151541Srgrimes *(tl+((t2>>2)-2)) = 0; \ 3161541Srgrimes bcopy((caddr_t)(a), (caddr_t)tl, (s)); \ 3179336Sdfr } else if (t2 = nfsm_strtmbuf(&mb, &bpos, (a), (s))) { \ 3189336Sdfr error = t2; \ 3199336Sdfr m_freem(mreq); \ 3209336Sdfr goto nfsmout; \ 3211541Srgrimes } 3221541Srgrimes 3231541Srgrimes#define nfsm_srvdone \ 3241541Srgrimes nfsmout: \ 3251541Srgrimes return(error) 3261541Srgrimes 3271541Srgrimes#define nfsm_reply(s) \ 3281541Srgrimes { \ 3291541Srgrimes nfsd->nd_repstat = error; \ 3309336Sdfr if (error && !(nfsd->nd_flag & ND_NFSV3)) \ 3319336Sdfr (void) nfs_rephead(0, nfsd, slp, error, cache, &frev, \ 3321541Srgrimes mrq, &mb, &bpos); \ 3331541Srgrimes else \ 3349336Sdfr (void) nfs_rephead((s), nfsd, slp, error, cache, &frev, \ 3351541Srgrimes mrq, &mb, &bpos); \ 3361541Srgrimes m_freem(mrep); \ 3371541Srgrimes mreq = *mrq; \ 3389336Sdfr if (error && (!(nfsd->nd_flag & ND_NFSV3) || \ 3399336Sdfr error == EBADRPC)) \ 3401541Srgrimes return(0); \ 3411541Srgrimes } 3421541Srgrimes 3439336Sdfr#define nfsm_writereply(s, v3) \ 3449336Sdfr { \ 3459336Sdfr nfsd->nd_repstat = error; \ 3469336Sdfr if (error && !(v3)) \ 3479336Sdfr (void) nfs_rephead(0, nfsd, slp, error, cache, &frev, \ 3489336Sdfr &mreq, &mb, &bpos); \ 3499336Sdfr else \ 3509336Sdfr (void) nfs_rephead((s), nfsd, slp, error, cache, &frev, \ 3519336Sdfr &mreq, &mb, &bpos); \ 3529336Sdfr } 3539336Sdfr 3541541Srgrimes#define nfsm_adv(s) \ 3559336Sdfr { t1 = mtod(md, caddr_t)+md->m_len-dpos; \ 3561541Srgrimes if (t1 >= (s)) { \ 3571541Srgrimes dpos += (s); \ 3589336Sdfr } else if (t1 = nfs_adv(&md, &dpos, (s), t1)) { \ 3599336Sdfr error = t1; \ 3609336Sdfr m_freem(mrep); \ 3619336Sdfr goto nfsmout; \ 3629336Sdfr } } 3639336Sdfr 3649336Sdfr#define nfsm_srvmtofh(f) \ 3659336Sdfr { if (nfsd->nd_flag & ND_NFSV3) { \ 3669336Sdfr nfsm_dissect(tl, u_long *, NFSX_UNSIGNED); \ 3679336Sdfr if (fxdr_unsigned(int, *tl) != NFSX_V3FH) { \ 3689336Sdfr error = EBADRPC; \ 3699336Sdfr nfsm_reply(0); \ 3703305Sphk } \ 3719336Sdfr } \ 3729336Sdfr nfsm_dissect(tl, u_long *, NFSX_V3FH); \ 3739336Sdfr bcopy((caddr_t)tl, (caddr_t)(f), NFSX_V3FH); \ 3749336Sdfr if ((nfsd->nd_flag & ND_NFSV3) == 0) \ 3759336Sdfr nfsm_adv(NFSX_V2FH - NFSX_V3FH); \ 3761541Srgrimes } 3771541Srgrimes 3781541Srgrimes#define nfsm_clget \ 3791541Srgrimes if (bp >= be) { \ 3801541Srgrimes if (mp == mb) \ 3811541Srgrimes mp->m_len += bp-bpos; \ 3821541Srgrimes MGET(mp, M_WAIT, MT_DATA); \ 3831541Srgrimes MCLGET(mp, M_WAIT); \ 3841541Srgrimes mp->m_len = NFSMSIZ(mp); \ 3851541Srgrimes mp2->m_next = mp; \ 3861541Srgrimes mp2 = mp; \ 3871541Srgrimes bp = mtod(mp, caddr_t); \ 3881541Srgrimes be = bp+mp->m_len; \ 3891541Srgrimes } \ 3901541Srgrimes tl = (u_long *)bp 3911541Srgrimes 3929336Sdfr#define nfsm_srvfillattr(a, f) \ 3939336Sdfr nfsm_srvfattr(nfsd, (a), (f)) 3941541Srgrimes 3959336Sdfr#define nfsm_srvwcc_data(br, b, ar, a) \ 3969336Sdfr nfsm_srvwcc(nfsd, (br), (b), (ar), (a), &mb, &bpos) 3979336Sdfr 3989336Sdfr#define nfsm_srvpostop_attr(r, a) \ 3999336Sdfr nfsm_srvpostopattr(nfsd, (r), (a), &mb, &bpos) 4009336Sdfr 4019336Sdfr#define nfsm_srvsattr(a) \ 4029336Sdfr { nfsm_dissect(tl, u_long *, NFSX_UNSIGNED); \ 4039336Sdfr if (*tl == nfs_true) { \ 4049336Sdfr nfsm_dissect(tl, u_long *, NFSX_UNSIGNED); \ 4059336Sdfr (a)->va_mode = nfstov_mode(*tl); \ 4069336Sdfr } \ 4079336Sdfr nfsm_dissect(tl, u_long *, NFSX_UNSIGNED); \ 4089336Sdfr if (*tl == nfs_true) { \ 4099336Sdfr nfsm_dissect(tl, u_long *, NFSX_UNSIGNED); \ 4109336Sdfr (a)->va_uid = fxdr_unsigned(uid_t, *tl); \ 4119336Sdfr } \ 4129336Sdfr nfsm_dissect(tl, u_long *, NFSX_UNSIGNED); \ 4139336Sdfr if (*tl == nfs_true) { \ 4149336Sdfr nfsm_dissect(tl, u_long *, NFSX_UNSIGNED); \ 4159336Sdfr (a)->va_gid = fxdr_unsigned(gid_t, *tl); \ 4169336Sdfr } \ 4179336Sdfr nfsm_dissect(tl, u_long *, NFSX_UNSIGNED); \ 4189336Sdfr if (*tl == nfs_true) { \ 4199336Sdfr nfsm_dissect(tl, u_long *, 2 * NFSX_UNSIGNED); \ 4209336Sdfr fxdr_hyper(tl, &(a)->va_size); \ 4219336Sdfr } \ 4229336Sdfr nfsm_dissect(tl, u_long *, NFSX_UNSIGNED); \ 4239336Sdfr switch (fxdr_unsigned(int, *tl)) { \ 4249336Sdfr case NFSV3SATTRTIME_TOCLIENT: \ 4259336Sdfr nfsm_dissect(tl, u_long *, 2 * NFSX_UNSIGNED); \ 4269336Sdfr fxdr_nfsv3time(tl, &(a)->va_atime); \ 4279336Sdfr break; \ 4289336Sdfr case NFSV3SATTRTIME_TOSERVER: \ 4299336Sdfr (a)->va_atime.ts_sec = time.tv_sec; \ 4309336Sdfr (a)->va_atime.ts_nsec = time.tv_usec * 1000; \ 4319336Sdfr break; \ 4329336Sdfr }; \ 4339336Sdfr nfsm_dissect(tl, u_long *, NFSX_UNSIGNED); \ 4349336Sdfr switch (fxdr_unsigned(int, *tl)) { \ 4359336Sdfr case NFSV3SATTRTIME_TOCLIENT: \ 4369336Sdfr nfsm_dissect(tl, u_long *, 2 * NFSX_UNSIGNED); \ 4379336Sdfr fxdr_nfsv3time(tl, &(a)->va_mtime); \ 4389336Sdfr break; \ 4399336Sdfr case NFSV3SATTRTIME_TOSERVER: \ 4409336Sdfr (a)->va_mtime.ts_sec = time.tv_sec; \ 4419336Sdfr (a)->va_mtime.ts_nsec = time.tv_usec * 1000; \ 4429336Sdfr break; \ 4439336Sdfr }; } 4449336Sdfr 4452175Spaul#endif 446