nfsm_subs.h revision 33054
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 * 3622521Sdyson * @(#)nfsm_subs.h 8.2 (Berkeley) 3/30/95 3733054Sbde * $Id: nfsm_subs.h,v 1.13 1997/07/16 09:06:30 dfr Exp $ 381541Srgrimes */ 391541Srgrimes 4022521Sdyson 412175Spaul#ifndef _NFS_NFSM_SUBS_H_ 422175Spaul#define _NFS_NFSM_SUBS_H_ 432175Spaul 4433054Sbdestruct ucred; 4533054Sbdestruct vnode; 469336Sdfr 471541Srgrimes/* 481541Srgrimes * These macros do strange and peculiar things to mbuf chains for 491541Srgrimes * the assistance of the nfs code. To attempt to use them for any 501541Srgrimes * other purpose will be dangerous. (they make weird assumptions) 511541Srgrimes */ 521541Srgrimes 531541Srgrimes/* 541541Srgrimes * First define what the actual subs. return 551541Srgrimes */ 5610222Sdfrstruct mbuf *nfsm_reqh __P((struct vnode *vp, u_long procid, int hsiz, 5710222Sdfr caddr_t *bposp)); 5810222Sdfrstruct mbuf *nfsm_rpchead __P((struct ucred *cr, int nmflag, int procid, 5910222Sdfr int auth_type, int auth_len, char *auth_str, 6010222Sdfr int verf_len, char *verf_str, 6110222Sdfr struct mbuf *mrest, int mrest_len, 6210222Sdfr struct mbuf **mbp, u_long *xidp)); 631541Srgrimes 641541Srgrimes#define M_HASCL(m) ((m)->m_flags & M_EXT) 651541Srgrimes#define NFSMINOFF(m) \ 661541Srgrimes if (M_HASCL(m)) \ 671541Srgrimes (m)->m_data = (m)->m_ext.ext_buf; \ 681541Srgrimes else if ((m)->m_flags & M_PKTHDR) \ 691541Srgrimes (m)->m_data = (m)->m_pktdat; \ 701541Srgrimes else \ 711541Srgrimes (m)->m_data = (m)->m_dat 721541Srgrimes#define NFSMADV(m, s) (m)->m_data += (s) 731541Srgrimes#define NFSMSIZ(m) ((M_HASCL(m))?MCLBYTES: \ 741541Srgrimes (((m)->m_flags & M_PKTHDR)?MHLEN:MLEN)) 751541Srgrimes 761541Srgrimes/* 771541Srgrimes * Now for the macros that do the simple stuff and call the functions 781541Srgrimes * for the hard stuff. 791541Srgrimes * These macros use several vars. declared in nfsm_reqhead and these 801541Srgrimes * vars. must not be used elsewhere unless you are careful not to corrupt 811541Srgrimes * them. The vars. starting with pN and tN (N=1,2,3,..) are temporaries 821541Srgrimes * that may be used so long as the value is not expected to retained 831541Srgrimes * after a macro. 841541Srgrimes * I know, this is kind of dorkey, but it makes the actual op functions 851541Srgrimes * fairly clean and deals with the mess caused by the xdr discriminating 861541Srgrimes * unions. 871541Srgrimes */ 881541Srgrimes 891541Srgrimes#define nfsm_build(a,c,s) \ 901541Srgrimes { if ((s) > M_TRAILINGSPACE(mb)) { \ 911541Srgrimes MGET(mb2, M_WAIT, MT_DATA); \ 921541Srgrimes if ((s) > MLEN) \ 931541Srgrimes panic("build > MLEN"); \ 941541Srgrimes mb->m_next = mb2; \ 951541Srgrimes mb = mb2; \ 961541Srgrimes mb->m_len = 0; \ 971541Srgrimes bpos = mtod(mb, caddr_t); \ 981541Srgrimes } \ 991541Srgrimes (a) = (c)(bpos); \ 1001541Srgrimes mb->m_len += (s); \ 1011541Srgrimes bpos += (s); } 1021541Srgrimes 1039336Sdfr#define nfsm_dissect(a, c, s) \ 1041541Srgrimes { t1 = mtod(md, caddr_t)+md->m_len-dpos; \ 1051541Srgrimes if (t1 >= (s)) { \ 1061541Srgrimes (a) = (c)(dpos); \ 1071541Srgrimes dpos += (s); \ 1089336Sdfr } else if (t1 = nfsm_disct(&md, &dpos, (s), t1, &cp2)) { \ 1099336Sdfr error = t1; \ 1109336Sdfr m_freem(mrep); \ 1119336Sdfr goto nfsmout; \ 1121541Srgrimes } else { \ 1139336Sdfr (a) = (c)cp2; \ 1149336Sdfr } } 1159336Sdfr 1169336Sdfr#define nfsm_fhtom(v, v3) \ 1179336Sdfr { if (v3) { \ 1189336Sdfr t2 = nfsm_rndup(VTONFS(v)->n_fhsize) + NFSX_UNSIGNED; \ 1199336Sdfr if (t2 <= M_TRAILINGSPACE(mb)) { \ 1209336Sdfr nfsm_build(tl, u_long *, t2); \ 1219336Sdfr *tl++ = txdr_unsigned(VTONFS(v)->n_fhsize); \ 1229336Sdfr *(tl + ((t2>>2) - 2)) = 0; \ 1239336Sdfr bcopy((caddr_t)VTONFS(v)->n_fhp,(caddr_t)tl, \ 1249336Sdfr VTONFS(v)->n_fhsize); \ 1259336Sdfr } else if (t2 = nfsm_strtmbuf(&mb, &bpos, \ 1269336Sdfr (caddr_t)VTONFS(v)->n_fhp, VTONFS(v)->n_fhsize)) { \ 1279336Sdfr error = t2; \ 1289336Sdfr m_freem(mreq); \ 1293305Sphk goto nfsmout; \ 1303305Sphk } \ 1319336Sdfr } else { \ 1329336Sdfr nfsm_build(cp, caddr_t, NFSX_V2FH); \ 1339336Sdfr bcopy((caddr_t)VTONFS(v)->n_fhp, cp, NFSX_V2FH); \ 1341541Srgrimes } } 1351541Srgrimes 1369336Sdfr#define nfsm_srvfhtom(f, v3) \ 1379336Sdfr { if (v3) { \ 1389336Sdfr nfsm_build(tl, u_long *, NFSX_UNSIGNED + NFSX_V3FH); \ 1399336Sdfr *tl++ = txdr_unsigned(NFSX_V3FH); \ 1409336Sdfr bcopy((caddr_t)(f), (caddr_t)tl, NFSX_V3FH); \ 1419336Sdfr } else { \ 1429336Sdfr nfsm_build(cp, caddr_t, NFSX_V2FH); \ 1439336Sdfr bcopy((caddr_t)(f), cp, NFSX_V2FH); \ 1449336Sdfr } } 1451541Srgrimes 1469336Sdfr#define nfsm_srvpostop_fh(f) \ 1479336Sdfr { nfsm_build(tl, u_long *, 2 * NFSX_UNSIGNED + NFSX_V3FH); \ 1489336Sdfr *tl++ = nfs_true; \ 1499336Sdfr *tl++ = txdr_unsigned(NFSX_V3FH); \ 1509336Sdfr bcopy((caddr_t)(f), (caddr_t)tl, NFSX_V3FH); \ 1519336Sdfr } 1521541Srgrimes 1539336Sdfr#define nfsm_mtofh(d, v, v3, f) \ 1549336Sdfr { struct nfsnode *ttnp; nfsfh_t *ttfhp; int ttfhsize; \ 1559336Sdfr if (v3) { \ 1569336Sdfr nfsm_dissect(tl, u_long *, NFSX_UNSIGNED); \ 1579336Sdfr (f) = fxdr_unsigned(int, *tl); \ 1589336Sdfr } else \ 1599336Sdfr (f) = 1; \ 1609336Sdfr if (f) { \ 1619336Sdfr nfsm_getfh(ttfhp, ttfhsize, (v3)); \ 1629336Sdfr if (t1 = nfs_nget((d)->v_mount, ttfhp, ttfhsize, \ 1639336Sdfr &ttnp)) { \ 1649336Sdfr error = t1; \ 1659336Sdfr m_freem(mrep); \ 1669336Sdfr goto nfsmout; \ 1679336Sdfr } \ 1689336Sdfr (v) = NFSTOV(ttnp); \ 1691541Srgrimes } \ 1709336Sdfr if (v3) { \ 1719336Sdfr nfsm_dissect(tl, u_long *, NFSX_UNSIGNED); \ 1729336Sdfr if (f) \ 1739336Sdfr (f) = fxdr_unsigned(int, *tl); \ 1749336Sdfr else if (fxdr_unsigned(int, *tl)) \ 1759336Sdfr nfsm_adv(NFSX_V3FATTR); \ 1769336Sdfr } \ 1779336Sdfr if (f) \ 1789336Sdfr nfsm_loadattr((v), (struct vattr *)0); \ 1791541Srgrimes } 1801541Srgrimes 1819336Sdfr#define nfsm_getfh(f, s, v3) \ 1829336Sdfr { if (v3) { \ 1839336Sdfr nfsm_dissect(tl, u_long *, NFSX_UNSIGNED); \ 1849336Sdfr if (((s) = fxdr_unsigned(int, *tl)) <= 0 || \ 1859336Sdfr (s) > NFSX_V3FHMAX) { \ 1869336Sdfr m_freem(mrep); \ 1879336Sdfr error = EBADRPC; \ 1889336Sdfr goto nfsmout; \ 1899336Sdfr } \ 1909336Sdfr } else \ 1919336Sdfr (s) = NFSX_V2FH; \ 1929336Sdfr nfsm_dissect((f), nfsfh_t *, nfsm_rndup(s)); } 1939336Sdfr 1949336Sdfr#define nfsm_loadattr(v, a) \ 1959336Sdfr { struct vnode *ttvp = (v); \ 1969336Sdfr if (t1 = nfs_loadattrcache(&ttvp, &md, &dpos, (a))) { \ 1979336Sdfr error = t1; \ 1981541Srgrimes m_freem(mrep); \ 1991541Srgrimes goto nfsmout; \ 2001541Srgrimes } \ 2019336Sdfr (v) = ttvp; } 2021541Srgrimes 2039336Sdfr#define nfsm_postop_attr(v, f) \ 2049336Sdfr { struct vnode *ttvp = (v); \ 2059336Sdfr nfsm_dissect(tl, u_long *, NFSX_UNSIGNED); \ 2069336Sdfr if ((f) = fxdr_unsigned(int, *tl)) { \ 2079336Sdfr if (t1 = nfs_loadattrcache(&ttvp, &md, &dpos, \ 2089336Sdfr (struct vattr *)0)) { \ 2099336Sdfr error = t1; \ 2109336Sdfr (f) = 0; \ 2119336Sdfr m_freem(mrep); \ 2129336Sdfr goto nfsmout; \ 2139336Sdfr } \ 2149336Sdfr (v) = ttvp; \ 2159336Sdfr } } 2169336Sdfr 2179336Sdfr/* Used as (f) for nfsm_wcc_data() */ 2189336Sdfr#define NFSV3_WCCRATTR 0 2199336Sdfr#define NFSV3_WCCCHK 1 2209336Sdfr 2219336Sdfr#define nfsm_wcc_data(v, f) \ 2229336Sdfr { int ttattrf, ttretf = 0; \ 2239336Sdfr nfsm_dissect(tl, u_long *, NFSX_UNSIGNED); \ 2249336Sdfr if (*tl == nfs_true) { \ 2259336Sdfr nfsm_dissect(tl, u_long *, 6 * NFSX_UNSIGNED); \ 2269336Sdfr if (f) \ 2279336Sdfr ttretf = (VTONFS(v)->n_mtime == \ 2289336Sdfr fxdr_unsigned(u_long, *(tl + 2))); \ 2299336Sdfr } \ 2309336Sdfr nfsm_postop_attr((v), ttattrf); \ 2319336Sdfr if (f) { \ 2329336Sdfr (f) = ttretf; \ 2339336Sdfr } else { \ 2349336Sdfr (f) = ttattrf; \ 2359336Sdfr } } 2369336Sdfr 2379336Sdfr#define nfsm_v3sattr(s, a, u, g) \ 2389336Sdfr { (s)->sa_modetrue = nfs_true; \ 2399336Sdfr (s)->sa_mode = vtonfsv3_mode((a)->va_mode); \ 2409336Sdfr (s)->sa_uidtrue = nfs_true; \ 2419336Sdfr (s)->sa_uid = txdr_unsigned(u); \ 2429336Sdfr (s)->sa_gidtrue = nfs_true; \ 2439336Sdfr (s)->sa_gid = txdr_unsigned(g); \ 2449336Sdfr (s)->sa_sizefalse = nfs_false; \ 2459336Sdfr (s)->sa_atimetype = txdr_unsigned(NFSV3SATTRTIME_TOCLIENT); \ 2469336Sdfr txdr_nfsv3time(&(a)->va_atime, &(s)->sa_atime); \ 2479336Sdfr (s)->sa_mtimetype = txdr_unsigned(NFSV3SATTRTIME_TOCLIENT); \ 2489336Sdfr txdr_nfsv3time(&(a)->va_mtime, &(s)->sa_mtime); \ 2499336Sdfr } 2509336Sdfr 2511541Srgrimes#define nfsm_strsiz(s,m) \ 2521541Srgrimes { nfsm_dissect(tl,u_long *,NFSX_UNSIGNED); \ 2531541Srgrimes if (((s) = fxdr_unsigned(long,*tl)) > (m)) { \ 2541541Srgrimes m_freem(mrep); \ 2551541Srgrimes error = EBADRPC; \ 2561541Srgrimes goto nfsmout; \ 2571541Srgrimes } } 2581541Srgrimes 2591541Srgrimes#define nfsm_srvstrsiz(s,m) \ 2601541Srgrimes { nfsm_dissect(tl,u_long *,NFSX_UNSIGNED); \ 2611541Srgrimes if (((s) = fxdr_unsigned(long,*tl)) > (m) || (s) <= 0) { \ 2621541Srgrimes error = EBADRPC; \ 2631541Srgrimes nfsm_reply(0); \ 2641541Srgrimes } } 2651541Srgrimes 2669336Sdfr#define nfsm_srvnamesiz(s) \ 2679336Sdfr { nfsm_dissect(tl,u_long *,NFSX_UNSIGNED); \ 2689336Sdfr if (((s) = fxdr_unsigned(long,*tl)) > NFS_MAXNAMLEN) \ 2699336Sdfr error = NFSERR_NAMETOL; \ 2709336Sdfr if ((s) <= 0) \ 2719336Sdfr error = EBADRPC; \ 2729336Sdfr if (error) \ 2739336Sdfr nfsm_reply(0); \ 2749336Sdfr } 2759336Sdfr 2761541Srgrimes#define nfsm_mtouio(p,s) \ 2771541Srgrimes if ((s) > 0 && \ 2789336Sdfr (t1 = nfsm_mbuftouio(&md,(p),(s),&dpos))) { \ 2799336Sdfr error = t1; \ 2801541Srgrimes m_freem(mrep); \ 2811541Srgrimes goto nfsmout; \ 2821541Srgrimes } 2831541Srgrimes 2841541Srgrimes#define nfsm_uiotom(p,s) \ 2859336Sdfr if (t1 = nfsm_uiotombuf((p),&mb,(s),&bpos)) { \ 2869336Sdfr error = t1; \ 2871541Srgrimes m_freem(mreq); \ 2881541Srgrimes goto nfsmout; \ 2891541Srgrimes } 2901541Srgrimes 2911541Srgrimes#define nfsm_reqhead(v,a,s) \ 2921541Srgrimes mb = mreq = nfsm_reqh((v),(a),(s),&bpos) 2931541Srgrimes 2941541Srgrimes#define nfsm_reqdone m_freem(mrep); \ 2958876Srgrimes nfsmout: 2961541Srgrimes 2971541Srgrimes#define nfsm_rndup(a) (((a)+3)&(~0x3)) 2981541Srgrimes 2991541Srgrimes#define nfsm_request(v, t, p, c) \ 3009336Sdfr if (error = nfs_request((v), mreq, (t), (p), \ 3019336Sdfr (c), &mrep, &md, &dpos)) { \ 3029336Sdfr if (error & NFSERR_RETERR) \ 3039336Sdfr error &= ~NFSERR_RETERR; \ 3049336Sdfr else \ 3059336Sdfr goto nfsmout; \ 3069336Sdfr } 3071541Srgrimes 3081541Srgrimes#define nfsm_strtom(a,s,m) \ 3091541Srgrimes if ((s) > (m)) { \ 3101541Srgrimes m_freem(mreq); \ 3111541Srgrimes error = ENAMETOOLONG; \ 3121541Srgrimes goto nfsmout; \ 3131541Srgrimes } \ 3141541Srgrimes t2 = nfsm_rndup(s)+NFSX_UNSIGNED; \ 3151541Srgrimes if (t2 <= M_TRAILINGSPACE(mb)) { \ 3161541Srgrimes nfsm_build(tl,u_long *,t2); \ 3171541Srgrimes *tl++ = txdr_unsigned(s); \ 3181541Srgrimes *(tl+((t2>>2)-2)) = 0; \ 3191541Srgrimes bcopy((caddr_t)(a), (caddr_t)tl, (s)); \ 3209336Sdfr } else if (t2 = nfsm_strtmbuf(&mb, &bpos, (a), (s))) { \ 3219336Sdfr error = t2; \ 3229336Sdfr m_freem(mreq); \ 3239336Sdfr goto nfsmout; \ 3241541Srgrimes } 3251541Srgrimes 3261541Srgrimes#define nfsm_srvdone \ 3271541Srgrimes nfsmout: \ 3281541Srgrimes return(error) 3291541Srgrimes 3301541Srgrimes#define nfsm_reply(s) \ 3311541Srgrimes { \ 3321541Srgrimes nfsd->nd_repstat = error; \ 3339336Sdfr if (error && !(nfsd->nd_flag & ND_NFSV3)) \ 3349336Sdfr (void) nfs_rephead(0, nfsd, slp, error, cache, &frev, \ 3351541Srgrimes mrq, &mb, &bpos); \ 3361541Srgrimes else \ 3379336Sdfr (void) nfs_rephead((s), nfsd, slp, error, cache, &frev, \ 3381541Srgrimes mrq, &mb, &bpos); \ 3391541Srgrimes m_freem(mrep); \ 3401541Srgrimes mreq = *mrq; \ 3419336Sdfr if (error && (!(nfsd->nd_flag & ND_NFSV3) || \ 3429336Sdfr error == EBADRPC)) \ 3431541Srgrimes return(0); \ 3441541Srgrimes } 3451541Srgrimes 3469336Sdfr#define nfsm_writereply(s, v3) \ 3479336Sdfr { \ 3489336Sdfr nfsd->nd_repstat = error; \ 3499336Sdfr if (error && !(v3)) \ 3509336Sdfr (void) nfs_rephead(0, nfsd, slp, error, cache, &frev, \ 3519336Sdfr &mreq, &mb, &bpos); \ 3529336Sdfr else \ 3539336Sdfr (void) nfs_rephead((s), nfsd, slp, error, cache, &frev, \ 3549336Sdfr &mreq, &mb, &bpos); \ 3559336Sdfr } 3569336Sdfr 3571541Srgrimes#define nfsm_adv(s) \ 3589336Sdfr { t1 = mtod(md, caddr_t)+md->m_len-dpos; \ 3591541Srgrimes if (t1 >= (s)) { \ 3601541Srgrimes dpos += (s); \ 3619336Sdfr } else if (t1 = nfs_adv(&md, &dpos, (s), t1)) { \ 3629336Sdfr error = t1; \ 3639336Sdfr m_freem(mrep); \ 3649336Sdfr goto nfsmout; \ 3659336Sdfr } } 3669336Sdfr 3679336Sdfr#define nfsm_srvmtofh(f) \ 36827446Sdfr { int fhlen = NFSX_V3FH; \ 36927446Sdfr if (nfsd->nd_flag & ND_NFSV3) { \ 3709336Sdfr nfsm_dissect(tl, u_long *, NFSX_UNSIGNED); \ 37127446Sdfr fhlen = fxdr_unsigned(int, *tl); \ 37227446Sdfr if (fhlen == 0) { \ 37327446Sdfr bzero((caddr_t)(f), NFSX_V3FH); \ 37427446Sdfr } else if (fhlen != NFSX_V3FH) { \ 3759336Sdfr error = EBADRPC; \ 3769336Sdfr nfsm_reply(0); \ 3773305Sphk } \ 3789336Sdfr } \ 37927446Sdfr if (fhlen != 0) { \ 38027446Sdfr nfsm_dissect(tl, u_long *, NFSX_V3FH); \ 38127446Sdfr bcopy((caddr_t)tl, (caddr_t)(f), NFSX_V3FH); \ 38227446Sdfr if ((nfsd->nd_flag & ND_NFSV3) == 0) \ 38327446Sdfr nfsm_adv(NFSX_V2FH - NFSX_V3FH); \ 38427446Sdfr } \ 38527446Sdfr } 3861541Srgrimes 3871541Srgrimes#define nfsm_clget \ 3881541Srgrimes if (bp >= be) { \ 3891541Srgrimes if (mp == mb) \ 3901541Srgrimes mp->m_len += bp-bpos; \ 3911541Srgrimes MGET(mp, M_WAIT, MT_DATA); \ 3921541Srgrimes MCLGET(mp, M_WAIT); \ 3931541Srgrimes mp->m_len = NFSMSIZ(mp); \ 3941541Srgrimes mp2->m_next = mp; \ 3951541Srgrimes mp2 = mp; \ 3961541Srgrimes bp = mtod(mp, caddr_t); \ 3971541Srgrimes be = bp+mp->m_len; \ 3981541Srgrimes } \ 3991541Srgrimes tl = (u_long *)bp 4001541Srgrimes 4019336Sdfr#define nfsm_srvfillattr(a, f) \ 4029336Sdfr nfsm_srvfattr(nfsd, (a), (f)) 4031541Srgrimes 4049336Sdfr#define nfsm_srvwcc_data(br, b, ar, a) \ 4059336Sdfr nfsm_srvwcc(nfsd, (br), (b), (ar), (a), &mb, &bpos) 4069336Sdfr 4079336Sdfr#define nfsm_srvpostop_attr(r, a) \ 4089336Sdfr nfsm_srvpostopattr(nfsd, (r), (a), &mb, &bpos) 4099336Sdfr 4109336Sdfr#define nfsm_srvsattr(a) \ 4119336Sdfr { nfsm_dissect(tl, u_long *, NFSX_UNSIGNED); \ 4129336Sdfr if (*tl == nfs_true) { \ 4139336Sdfr nfsm_dissect(tl, u_long *, NFSX_UNSIGNED); \ 4149336Sdfr (a)->va_mode = nfstov_mode(*tl); \ 4159336Sdfr } \ 4169336Sdfr nfsm_dissect(tl, u_long *, NFSX_UNSIGNED); \ 4179336Sdfr if (*tl == nfs_true) { \ 4189336Sdfr nfsm_dissect(tl, u_long *, NFSX_UNSIGNED); \ 4199336Sdfr (a)->va_uid = fxdr_unsigned(uid_t, *tl); \ 4209336Sdfr } \ 4219336Sdfr nfsm_dissect(tl, u_long *, NFSX_UNSIGNED); \ 4229336Sdfr if (*tl == nfs_true) { \ 4239336Sdfr nfsm_dissect(tl, u_long *, NFSX_UNSIGNED); \ 4249336Sdfr (a)->va_gid = fxdr_unsigned(gid_t, *tl); \ 4259336Sdfr } \ 4269336Sdfr nfsm_dissect(tl, u_long *, NFSX_UNSIGNED); \ 4279336Sdfr if (*tl == nfs_true) { \ 4289336Sdfr nfsm_dissect(tl, u_long *, 2 * NFSX_UNSIGNED); \ 4299336Sdfr fxdr_hyper(tl, &(a)->va_size); \ 4309336Sdfr } \ 4319336Sdfr nfsm_dissect(tl, u_long *, NFSX_UNSIGNED); \ 4329336Sdfr switch (fxdr_unsigned(int, *tl)) { \ 4339336Sdfr case NFSV3SATTRTIME_TOCLIENT: \ 4349336Sdfr nfsm_dissect(tl, u_long *, 2 * NFSX_UNSIGNED); \ 4359336Sdfr fxdr_nfsv3time(tl, &(a)->va_atime); \ 4369336Sdfr break; \ 4379336Sdfr case NFSV3SATTRTIME_TOSERVER: \ 43818397Snate (a)->va_atime.tv_sec = time.tv_sec; \ 43918397Snate (a)->va_atime.tv_nsec = time.tv_usec * 1000; \ 4409336Sdfr break; \ 4419336Sdfr }; \ 4429336Sdfr nfsm_dissect(tl, u_long *, NFSX_UNSIGNED); \ 4439336Sdfr switch (fxdr_unsigned(int, *tl)) { \ 4449336Sdfr case NFSV3SATTRTIME_TOCLIENT: \ 4459336Sdfr nfsm_dissect(tl, u_long *, 2 * NFSX_UNSIGNED); \ 4469336Sdfr fxdr_nfsv3time(tl, &(a)->va_mtime); \ 4479336Sdfr break; \ 4489336Sdfr case NFSV3SATTRTIME_TOSERVER: \ 44918397Snate (a)->va_mtime.tv_sec = time.tv_sec; \ 45018397Snate (a)->va_mtime.tv_nsec = time.tv_usec * 1000; \ 4519336Sdfr break; \ 4529336Sdfr }; } 4539336Sdfr 4542175Spaul#endif 455