nfsm_subs.h revision 1.34
1/* $NetBSD: nfsm_subs.h,v 1.34 2004/03/19 13:52:07 yamt Exp $ */ 2 3/* 4 * Copyright (c) 1989, 1993 5 * The Regents of the University of California. All rights reserved. 6 * 7 * This code is derived from software contributed to Berkeley by 8 * Rick Macklem at The University of Guelph. 9 * 10 * Redistribution and use in source and binary forms, with or without 11 * modification, are permitted provided that the following conditions 12 * are met: 13 * 1. Redistributions of source code must retain the above copyright 14 * notice, this list of conditions and the following disclaimer. 15 * 2. Redistributions in binary form must reproduce the above copyright 16 * notice, this list of conditions and the following disclaimer in the 17 * documentation and/or other materials provided with the distribution. 18 * 3. Neither the name of the University nor the names of its contributors 19 * may be used to endorse or promote products derived from this software 20 * without specific prior written permission. 21 * 22 * THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND 23 * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE 24 * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE 25 * ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE 26 * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL 27 * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS 28 * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) 29 * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT 30 * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY 31 * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF 32 * SUCH DAMAGE. 33 * 34 * @(#)nfsm_subs.h 8.2 (Berkeley) 3/30/95 35 */ 36 37 38#ifndef _NFS_NFSM_SUBS_H_ 39#define _NFS_NFSM_SUBS_H_ 40 41 42/* 43 * These macros do strange and peculiar things to mbuf chains for 44 * the assistance of the nfs code. To attempt to use them for any 45 * other purpose will be dangerous. (they make weird assumptions) 46 */ 47 48/* 49 * First define what the actual subs. return 50 */ 51 52#define M_HASCL(m) ((m)->m_flags & M_EXT) 53#define NFSMINOFF(m) \ 54 if (M_HASCL(m)) \ 55 (m)->m_data = (m)->m_ext.ext_buf; \ 56 else if ((m)->m_flags & M_PKTHDR) \ 57 (m)->m_data = (m)->m_pktdat; \ 58 else \ 59 (m)->m_data = (m)->m_dat 60#define NFSMADV(m, s) (m)->m_data += (s) 61#define NFSMSIZ(m) ((M_HASCL(m)) ? (m)->m_ext.ext_size : \ 62 (((m)->m_flags & M_PKTHDR) ? MHLEN : MLEN)) 63 64/* 65 * Now for the macros that do the simple stuff and call the functions 66 * for the hard stuff. 67 * These macros use several vars. declared in nfsm_reqhead and these 68 * vars. must not be used elsewhere unless you are careful not to corrupt 69 * them. The vars. starting with pN and tN (N=1,2,3,..) are temporaries 70 * that may be used so long as the value is not expected to retained 71 * after a macro. 72 * I know, this is kind of dorkey, but it makes the actual op functions 73 * fairly clean and deals with the mess caused by the xdr discriminating 74 * unions. 75 */ 76 77#define nfsm_build(a,c,s) \ 78 { if ((s) > M_TRAILINGSPACE(mb)) { \ 79 struct mbuf *mb2; \ 80 mb2 = m_get(M_WAIT, MT_DATA); \ 81 MCLAIM(mb2, &nfs_mowner); \ 82 if ((s) > MLEN) \ 83 panic("build > MLEN"); \ 84 mb->m_next = mb2; \ 85 mb = mb2; \ 86 mb->m_len = 0; \ 87 bpos = mtod(mb, caddr_t); \ 88 } \ 89 (a) = (c)(bpos); \ 90 mb->m_len += (s); \ 91 bpos += (s); } 92 93#define nfsm_aligned(p) ALIGNED_POINTER(p,u_int32_t) 94 95#define nfsm_dissect(a, c, s) \ 96 { t1 = mtod(md, caddr_t)+md->m_len-dpos; \ 97 if (t1 >= (s) && nfsm_aligned(dpos)) { \ 98 (a) = (c)(dpos); \ 99 dpos += (s); \ 100 } else if ((t1 = nfsm_disct(&md, &dpos, (s), t1, &cp2)) != 0){ \ 101 error = t1; \ 102 m_freem(mrep); \ 103 goto nfsmout; \ 104 } else { \ 105 (a) = (c)cp2; \ 106 } } 107 108#define nfsm_fhtom(n, v3) \ 109 { if (v3) { \ 110 t2 = nfsm_rndup((n)->n_fhsize) + NFSX_UNSIGNED; \ 111 if (t2 <= M_TRAILINGSPACE(mb)) { \ 112 nfsm_build(tl, u_int32_t *, t2); \ 113 *tl++ = txdr_unsigned((n)->n_fhsize); \ 114 *(tl + ((t2>>2) - 2)) = 0; \ 115 memcpy((caddr_t)tl,(caddr_t)(n)->n_fhp, \ 116 (n)->n_fhsize); \ 117 } else if ((t2 = nfsm_strtmbuf(&mb, &bpos, \ 118 (caddr_t)(n)->n_fhp, \ 119 (n)->n_fhsize)) != 0) { \ 120 error = t2; \ 121 m_freem(mreq); \ 122 goto nfsmout; \ 123 } \ 124 } else { \ 125 nfsm_build(cp, caddr_t, NFSX_V2FH); \ 126 memcpy(cp, (caddr_t)(n)->n_fhp, NFSX_V2FH); \ 127 } } 128 129#define nfsm_srvfhtom(f, v3) \ 130 { if (v3) { \ 131 nfsm_build(tl, u_int32_t *, NFSX_UNSIGNED + NFSX_V3FH); \ 132 *tl++ = txdr_unsigned(NFSX_V3FH); \ 133 memcpy((caddr_t)tl, (caddr_t)(f), NFSX_V3FH); \ 134 } else { \ 135 nfsm_build(cp, caddr_t, NFSX_V2FH); \ 136 memcpy(cp, (caddr_t)(f), NFSX_V2FH); \ 137 } } 138 139#define nfsm_srvpostop_fh(f) \ 140 { nfsm_build(tl, u_int32_t *, 2 * NFSX_UNSIGNED + NFSX_V3FH); \ 141 *tl++ = nfs_true; \ 142 *tl++ = txdr_unsigned(NFSX_V3FH); \ 143 memcpy((caddr_t)tl, (caddr_t)(f), NFSX_V3FH); \ 144 } 145 146/* 147 * nfsm_mtofh: dissect a "resulted obj" part of create-like operations 148 * like mkdir. 149 * 150 * for nfsv3, dissect post_op_fh3 and following post_op_attr. 151 * for nfsv2, dissect fhandle and following fattr. 152 * 153 * d: (IN) the vnode of the parent directry. 154 * v: (OUT) the corresponding vnode (we allocate one if needed) 155 * v3: (IN) true for nfsv3. 156 * f: (OUT) true if we got valid filehandle. always true for nfsv2. 157 */ 158 159#define nfsm_mtofh(d, v, v3, f) \ 160 { struct nfsnode *ttnp; nfsfh_t *ttfhp; int ttfhsize; \ 161 if (v3) { \ 162 nfsm_dissect(tl, u_int32_t *, NFSX_UNSIGNED); \ 163 (f) = fxdr_unsigned(int, *tl); \ 164 } else \ 165 (f) = 1; \ 166 if (f) { \ 167 nfsm_getfh(ttfhp, ttfhsize, (v3)); \ 168 if ((t1 = nfs_nget((d)->v_mount, ttfhp, ttfhsize, \ 169 &ttnp)) != 0) { \ 170 error = t1; \ 171 m_freem(mrep); \ 172 goto nfsmout; \ 173 } \ 174 (v) = NFSTOV(ttnp); \ 175 } \ 176 if (v3) { \ 177 nfsm_dissect(tl, u_int32_t *, NFSX_UNSIGNED); \ 178 if (f) \ 179 (f) = fxdr_unsigned(int, *tl); \ 180 else if (fxdr_unsigned(int, *tl)) \ 181 nfsm_adv(NFSX_V3FATTR); \ 182 } \ 183 if (f) \ 184 nfsm_loadattr((v), (struct vattr *)0, 0); \ 185 } 186 187/* 188 * nfsm_getfh: dissect a filehandle. 189 * 190 * f: (OUT) a filehandle. 191 * s: (OUT) size of the filehandle in bytes. 192 * v3: (IN) true if nfsv3. 193 */ 194 195#define nfsm_getfh(f, s, v3) \ 196 { if (v3) { \ 197 nfsm_dissect(tl, u_int32_t *, NFSX_UNSIGNED); \ 198 if (((s) = fxdr_unsigned(int, *tl)) <= 0 || \ 199 (s) > NFSX_V3FHMAX) { \ 200 m_freem(mrep); \ 201 error = EBADRPC; \ 202 goto nfsmout; \ 203 } \ 204 } else \ 205 (s) = NFSX_V2FH; \ 206 nfsm_dissect((f), nfsfh_t *, nfsm_rndup(s)); } 207 208#define nfsm_loadattr(v, a, flags) \ 209 { struct vnode *ttvp = (v); \ 210 if ((t1 = nfsm_loadattrcache(&ttvp, &md, &dpos, (a), (flags))) \ 211 != 0) { \ 212 error = t1; \ 213 m_freem(mrep); \ 214 goto nfsmout; \ 215 } \ 216 (v) = ttvp; } 217 218/* 219 * nfsm_postop_attr: process nfsv3 post_op_attr 220 * 221 * dissect post_op_attr. if we got a one, 222 * call nfsm_loadattrcache to update attribute cache. 223 * 224 * v: (IN/OUT) the corresponding vnode 225 * f: (OUT) true if we got valid attribute 226 * flags: (IN) flags for nfsm_loadattrcache 227 */ 228 229#define nfsm_postop_attr(v, f, flags) \ 230 { struct vnode *ttvp = (v); \ 231 nfsm_dissect(tl, u_int32_t *, NFSX_UNSIGNED); \ 232 if (((f) = fxdr_unsigned(int, *tl)) != 0) { \ 233 if ((t1 = nfsm_loadattrcache(&ttvp, &md, &dpos, \ 234 (struct vattr *)0, (flags))) != 0) { \ 235 error = t1; \ 236 (f) = 0; \ 237 m_freem(mrep); \ 238 goto nfsmout; \ 239 } \ 240 (v) = ttvp; \ 241 } } 242 243/* 244 * nfsm_wcc_data: process nfsv3 wcc_data 245 * 246 * dissect pre_op_attr and then let nfsm_postop_attr dissect post_op_attr. 247 * 248 * v: (IN/OUT) the corresponding vnode 249 * f: (IN/OUT) 250 * NFSV3_WCCRATTR return true if we got valid post_op_attr. 251 * NFSV3_WCCCHK return true if pre_op_attr's mtime is the same 252 * as our n_mtime. (ie. our cache isn't stale.) 253 * flags: (IN) flags for nfsm_loadattrcache 254 */ 255 256/* Used as (f) for nfsm_wcc_data() */ 257#define NFSV3_WCCRATTR 0 258#define NFSV3_WCCCHK 1 259 260#define nfsm_wcc_data(v, f, flags) \ 261 { int ttattrf, ttretf = 0; \ 262 nfsm_dissect(tl, u_int32_t *, NFSX_UNSIGNED); \ 263 if (*tl == nfs_true) { \ 264 nfsm_dissect(tl, u_int32_t *, 6 * NFSX_UNSIGNED); \ 265 if (f) { \ 266 struct timespec mtime; \ 267 fxdr_nfsv3time(tl + 2, &mtime); \ 268 ttretf = timespeccmp(&VTONFS(v)->n_mtime, \ 269 &mtime, ==); \ 270 } \ 271 } \ 272 nfsm_postop_attr((v), ttattrf, (flags)); \ 273 if (f) { \ 274 (f) = ttretf; \ 275 } else { \ 276 (f) = ttattrf; \ 277 } } 278 279/* If full is true, set all fields, otherwise just set mode and time fields */ 280#define nfsm_v3attrbuild(a, full) \ 281 { if ((a)->va_mode != (mode_t)VNOVAL) { \ 282 nfsm_build(tl, u_int32_t *, 2 * NFSX_UNSIGNED); \ 283 *tl++ = nfs_true; \ 284 *tl = txdr_unsigned((a)->va_mode); \ 285 } else { \ 286 nfsm_build(tl, u_int32_t *, NFSX_UNSIGNED); \ 287 *tl = nfs_false; \ 288 } \ 289 if ((full) && (a)->va_uid != (uid_t)VNOVAL) { \ 290 nfsm_build(tl, u_int32_t *, 2 * NFSX_UNSIGNED); \ 291 *tl++ = nfs_true; \ 292 *tl = txdr_unsigned((a)->va_uid); \ 293 } else { \ 294 nfsm_build(tl, u_int32_t *, NFSX_UNSIGNED); \ 295 *tl = nfs_false; \ 296 } \ 297 if ((full) && (a)->va_gid != (gid_t)VNOVAL) { \ 298 nfsm_build(tl, u_int32_t *, 2 * NFSX_UNSIGNED); \ 299 *tl++ = nfs_true; \ 300 *tl = txdr_unsigned((a)->va_gid); \ 301 } else { \ 302 nfsm_build(tl, u_int32_t *, NFSX_UNSIGNED); \ 303 *tl = nfs_false; \ 304 } \ 305 if ((full) && (a)->va_size != VNOVAL) { \ 306 nfsm_build(tl, u_int32_t *, 3 * NFSX_UNSIGNED); \ 307 *tl++ = nfs_true; \ 308 txdr_hyper((a)->va_size, tl); \ 309 } else { \ 310 nfsm_build(tl, u_int32_t *, NFSX_UNSIGNED); \ 311 *tl = nfs_false; \ 312 } \ 313 if ((a)->va_atime.tv_sec != VNOVAL) { \ 314 if ((a)->va_atime.tv_sec != time.tv_sec) { \ 315 nfsm_build(tl, u_int32_t *, 3 * NFSX_UNSIGNED); \ 316 *tl++ = txdr_unsigned(NFSV3SATTRTIME_TOCLIENT); \ 317 txdr_nfsv3time(&(a)->va_atime, tl); \ 318 } else { \ 319 nfsm_build(tl, u_int32_t *, NFSX_UNSIGNED); \ 320 *tl = txdr_unsigned(NFSV3SATTRTIME_TOSERVER); \ 321 } \ 322 } else { \ 323 nfsm_build(tl, u_int32_t *, NFSX_UNSIGNED); \ 324 *tl = txdr_unsigned(NFSV3SATTRTIME_DONTCHANGE); \ 325 } \ 326 if ((a)->va_mtime.tv_sec != VNOVAL) { \ 327 if ((a)->va_mtime.tv_sec != time.tv_sec) { \ 328 nfsm_build(tl, u_int32_t *, 3 * NFSX_UNSIGNED); \ 329 *tl++ = txdr_unsigned(NFSV3SATTRTIME_TOCLIENT); \ 330 txdr_nfsv3time(&(a)->va_mtime, tl); \ 331 } else { \ 332 nfsm_build(tl, u_int32_t *, NFSX_UNSIGNED); \ 333 *tl = txdr_unsigned(NFSV3SATTRTIME_TOSERVER); \ 334 } \ 335 } else { \ 336 nfsm_build(tl, u_int32_t *, NFSX_UNSIGNED); \ 337 *tl = txdr_unsigned(NFSV3SATTRTIME_DONTCHANGE); \ 338 } \ 339 } 340 341 342#define nfsm_strsiz(s,m) \ 343 { nfsm_dissect(tl,uint32_t *,NFSX_UNSIGNED); \ 344 if (((s) = fxdr_unsigned(uint32_t,*tl)) > (m)) { \ 345 m_freem(mrep); \ 346 error = EBADRPC; \ 347 goto nfsmout; \ 348 } } 349 350#define nfsm_srvnamesiz(s) \ 351 { nfsm_dissect(tl,uint32_t *,NFSX_UNSIGNED); \ 352 if (((s) = fxdr_unsigned(uint32_t,*tl)) > NFS_MAXNAMLEN) \ 353 error = NFSERR_NAMETOL; \ 354 if (error) \ 355 nfsm_reply(0); \ 356 } 357 358#define nfsm_mtouio(p,s) \ 359 if ((s) > 0 && \ 360 (t1 = nfsm_mbuftouio(&md,(p),(s),&dpos)) != 0) { \ 361 error = t1; \ 362 m_freem(mrep); \ 363 goto nfsmout; \ 364 } 365 366#define nfsm_uiotom(p,s) \ 367 if ((t1 = nfsm_uiotombuf((p),&mb,(s),&bpos)) != 0) { \ 368 error = t1; \ 369 m_freem(mreq); \ 370 goto nfsmout; \ 371 } 372 373#define nfsm_reqhead(n,a,s) \ 374 mb = mreq = nfsm_reqh((n),(a),(s),&bpos) 375 376#define nfsm_reqdone m_freem(mrep); \ 377 nfsmout: 378 379#define nfsm_rndup(a) (((a)+3)&(~0x3)) 380#define nfsm_padlen(a) (nfsm_rndup(a) - (a)) 381 382#define nfsm_request(v, t, p, c) \ 383 if ((error = nfs_request((v), mreq, (t), (p), \ 384 (c), &mrep, &md, &dpos)) != 0) { \ 385 if (error & NFSERR_RETERR) \ 386 error &= ~NFSERR_RETERR; \ 387 else \ 388 goto nfsmout; \ 389 } 390 391#define nfsm_strtom(a,s,m) \ 392 if ((s) > (m)) { \ 393 m_freem(mreq); \ 394 error = ENAMETOOLONG; \ 395 goto nfsmout; \ 396 } \ 397 t2 = nfsm_rndup(s)+NFSX_UNSIGNED; \ 398 if (t2 <= M_TRAILINGSPACE(mb)) { \ 399 nfsm_build(tl,u_int32_t *,t2); \ 400 *tl++ = txdr_unsigned(s); \ 401 *(tl+((t2>>2)-2)) = 0; \ 402 memcpy((caddr_t)tl, (const char *)(a), (s)); \ 403 } else if ((t2 = nfsm_strtmbuf(&mb, &bpos, (a), (s))) != 0) { \ 404 error = t2; \ 405 m_freem(mreq); \ 406 goto nfsmout; \ 407 } 408 409#define nfsm_srvdone \ 410 nfsmout: \ 411 return(error) 412 413#define nfsm_reply(s) \ 414 { \ 415 nfsd->nd_repstat = error; \ 416 if (error && !(nfsd->nd_flag & ND_NFSV3)) \ 417 (void) nfs_rephead(0, nfsd, slp, error, cache, &frev, \ 418 mrq, &mb, &bpos); \ 419 else \ 420 (void) nfs_rephead((s), nfsd, slp, error, cache, &frev, \ 421 mrq, &mb, &bpos); \ 422 if (mrep != NULL) { \ 423 m_freem(mrep); \ 424 mrep = NULL; \ 425 } \ 426 mreq = *mrq; \ 427 if (error && (!(nfsd->nd_flag & ND_NFSV3) || \ 428 error == EBADRPC)) \ 429 return(0); \ 430 } 431 432#define nfsm_writereply(s, v3) \ 433 { \ 434 nfsd->nd_repstat = error; \ 435 if (error && !(v3)) \ 436 (void) nfs_rephead(0, nfsd, slp, error, cache, &frev, \ 437 &mreq, &mb, &bpos); \ 438 else \ 439 (void) nfs_rephead((s), nfsd, slp, error, cache, &frev, \ 440 &mreq, &mb, &bpos); \ 441 } 442 443#define nfsm_adv(s) \ 444 { t1 = mtod(md, caddr_t)+md->m_len-dpos; \ 445 if (t1 >= (s)) { \ 446 dpos += (s); \ 447 } else if ((t1 = nfs_adv(&md, &dpos, (s), t1)) != 0) { \ 448 error = t1; \ 449 m_freem(mrep); \ 450 goto nfsmout; \ 451 } } 452 453#define nfsm_srvmtofh(f) \ 454 { int fhlen = NFSX_V3FH; \ 455 if (nfsd->nd_flag & ND_NFSV3) { \ 456 nfsm_dissect(tl, u_int32_t *, NFSX_UNSIGNED); \ 457 fhlen = fxdr_unsigned(int, *tl); \ 458 if (fhlen == 0) { \ 459 memset((caddr_t)(f), 0, NFSX_V3FH); \ 460 } else if (fhlen != NFSX_V3FH) { \ 461 error = EBADRPC; \ 462 nfsm_reply(0); \ 463 } \ 464 } \ 465 if (fhlen != 0) { \ 466 nfsm_dissect(tl, u_int32_t *, NFSX_V3FH); \ 467 memcpy( (caddr_t)(f), (caddr_t)tl, NFSX_V3FH); \ 468 if ((nfsd->nd_flag & ND_NFSV3) == 0) \ 469 nfsm_adv(NFSX_V2FH - NFSX_V3FH); \ 470 } \ 471 } 472 473#define nfsm_clget \ 474 if (bp >= be) { \ 475 if (mp == mb) \ 476 mp->m_len += bp-bpos; \ 477 mp = m_get(M_WAIT, MT_DATA); \ 478 MCLAIM(mp, &nfs_mowner); \ 479 m_clget(mp, M_WAIT); \ 480 mp->m_len = NFSMSIZ(mp); \ 481 mp2->m_next = mp; \ 482 mp2 = mp; \ 483 bp = mtod(mp, caddr_t); \ 484 be = bp+mp->m_len; \ 485 } \ 486 tl = (u_int32_t *)bp 487 488#define nfsm_srvfillattr(a, f) \ 489 nfsm_srvfattr(nfsd, (a), (f)) 490 491#define nfsm_srvwcc_data(br, b, ar, a) \ 492 nfsm_srvwcc(nfsd, (br), (b), (ar), (a), &mb, &bpos) 493 494#define nfsm_srvpostop_attr(r, a) \ 495 nfsm_srvpostopattr(nfsd, (r), (a), &mb, &bpos) 496 497#define nfsm_srvsattr(a) \ 498 { nfsm_dissect(tl, u_int32_t *, NFSX_UNSIGNED); \ 499 if (*tl == nfs_true) { \ 500 nfsm_dissect(tl, u_int32_t *, NFSX_UNSIGNED); \ 501 (a)->va_mode = nfstov_mode(*tl); \ 502 } \ 503 nfsm_dissect(tl, u_int32_t *, NFSX_UNSIGNED); \ 504 if (*tl == nfs_true) { \ 505 nfsm_dissect(tl, u_int32_t *, NFSX_UNSIGNED); \ 506 (a)->va_uid = fxdr_unsigned(uid_t, *tl); \ 507 } \ 508 nfsm_dissect(tl, u_int32_t *, NFSX_UNSIGNED); \ 509 if (*tl == nfs_true) { \ 510 nfsm_dissect(tl, u_int32_t *, NFSX_UNSIGNED); \ 511 (a)->va_gid = fxdr_unsigned(gid_t, *tl); \ 512 } \ 513 nfsm_dissect(tl, u_int32_t *, NFSX_UNSIGNED); \ 514 if (*tl == nfs_true) { \ 515 nfsm_dissect(tl, u_int32_t *, 2 * NFSX_UNSIGNED); \ 516 (a)->va_size = fxdr_hyper(tl); \ 517 } \ 518 nfsm_dissect(tl, u_int32_t *, NFSX_UNSIGNED); \ 519 switch (fxdr_unsigned(int, *tl)) { \ 520 case NFSV3SATTRTIME_TOCLIENT: \ 521 nfsm_dissect(tl, u_int32_t *, 2 * NFSX_UNSIGNED); \ 522 fxdr_nfsv3time(tl, &(a)->va_atime); \ 523 break; \ 524 case NFSV3SATTRTIME_TOSERVER: \ 525 (a)->va_atime.tv_sec = time.tv_sec; \ 526 (a)->va_atime.tv_nsec = time.tv_usec * 1000; \ 527 (a)->va_vaflags |= VA_UTIMES_NULL; \ 528 break; \ 529 }; \ 530 nfsm_dissect(tl, u_int32_t *, NFSX_UNSIGNED); \ 531 switch (fxdr_unsigned(int, *tl)) { \ 532 case NFSV3SATTRTIME_TOCLIENT: \ 533 nfsm_dissect(tl, u_int32_t *, 2 * NFSX_UNSIGNED); \ 534 fxdr_nfsv3time(tl, &(a)->va_mtime); \ 535 (a)->va_vaflags &= ~VA_UTIMES_NULL; \ 536 break; \ 537 case NFSV3SATTRTIME_TOSERVER: \ 538 (a)->va_mtime.tv_sec = time.tv_sec; \ 539 (a)->va_mtime.tv_nsec = time.tv_usec * 1000; \ 540 (a)->va_vaflags |= VA_UTIMES_NULL; \ 541 break; \ 542 }; } 543 544#endif 545