1 /* 2 * CDDL HEADER START 3 * 4 * The contents of this file are subject to the terms of the 5 * Common Development and Distribution License, Version 1.0 only 6 * (the "License"). You may not use this file except in compliance 7 * with the License. 8 * 9 * You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE 10 * or http://www.opensolaris.org/os/licensing. 11 * See the License for the specific language governing permissions 12 * and limitations under the License. 13 * 14 * When distributing Covered Code, include this CDDL HEADER in each 15 * file and include the License file at usr/src/OPENSOLARIS.LICENSE. 16 * If applicable, add the following below this CDDL HEADER, with the 17 * fields enclosed by brackets "[]" replaced with your own identifying 18 * information: Portions Copyright [yyyy] [name of copyright owner] 19 * 20 * CDDL HEADER END 21 */ 22 /* 23 * Copyright (c) 1999 by Sun Microsystems, Inc. 24 * All rights reserved. 25 */ 26 27 #pragma ident "%Z%%M% %I% %E% SMI" 28 29 #include <nfs/nfs.h> 30 #include <nfs/nfs_log.h> 31 32 static bool_t xdr_timestruc32_t(XDR *, timestruc32_t *); 33 static bool_t xdr_nfs2_timeval(XDR *, nfs2_timeval *); 34 static bool_t xdr_ftype3(XDR *, ftype3 *); 35 static bool_t xdr_stable_how(XDR *, stable_how *); 36 static bool_t xdr_createmode3(XDR *, createmode3 *); 37 static bool_t xdr_size3(XDR *, size3 *); 38 static bool_t xdr_count3(XDR *, count3 *); 39 static bool_t xdr_set_size3(XDR *, set_size3 *); 40 static bool_t xdr_offset3(XDR *, offset3 *); 41 static bool_t xdr_post_op_fh3(XDR *, post_op_fh3 *); 42 static bool_t xdr_nfsreadargs(XDR *, struct nfsreadargs *); 43 static bool_t xdr_nfslog_record_header(XDR *, nfslog_record_header *); 44 static bool_t xdr_nfslog_drok(XDR *, nfslog_drok *); 45 static bool_t xdr_nfslog_rrok(XDR *, nfslog_rrok *); 46 static bool_t xdr_nfslog_sattr(XDR *, nfslog_sattr *); 47 static bool_t xdr_nfslog_rdok(XDR *, nfslog_rdok *); 48 static bool_t xdr_nfslog_createhow3(XDR *, nfslog_createhow3 *); 49 static bool_t xdr_nfslog_CREATE3resok(XDR *, nfslog_CREATE3resok *); 50 static bool_t xdr_nfslog_READ3resok(XDR *, nfslog_READ3resok *); 51 static bool_t xdr_nfslog_WRITE3resok(XDR *, nfslog_WRITE3resok *); 52 static bool_t xdr_nfslog_entryplus3(XDR *, nfslog_entryplus3 *); 53 static bool_t xdr_nfslog_dirlistplus3(XDR *, nfslog_dirlistplus3 *); 54 static bool_t xdr_nfslog_READDIRPLUS3resok(XDR *, nfslog_READDIRPLUS3resok *); 55 56 static bool_t 57 xdr_timestruc32_t(XDR *xdrs, timestruc32_t *objp) 58 { 59 if (!xdr_int(xdrs, &objp->tv_sec)) 60 return (FALSE); 61 if (!xdr_int(xdrs, &objp->tv_nsec)) 62 return (FALSE); 63 return (TRUE); 64 } 65 66 static bool_t 67 xdr_nfs2_timeval(XDR *xdrs, nfs2_timeval *objp) 68 { 69 if (!xdr_u_int(xdrs, &objp->tv_sec)) 70 return (FALSE); 71 if (!xdr_u_int(xdrs, &objp->tv_usec)) 72 return (FALSE); 73 return (TRUE); 74 } 75 76 bool_t 77 xdr_nfsstat(XDR *xdrs, nfsstat *objp) 78 { 79 if (!xdr_enum(xdrs, (enum_t *)objp)) 80 return (FALSE); 81 return (TRUE); 82 } 83 84 bool_t 85 xdr_uint64(XDR *xdrs, uint64 *objp) 86 { 87 return (xdr_u_longlong_t(xdrs, objp)); 88 } 89 90 bool_t 91 xdr_uint32(XDR *xdrs, uint32 *objp) 92 { 93 return (xdr_u_int(xdrs, objp)); 94 } 95 96 static bool_t 97 xdr_ftype3(XDR *xdrs, ftype3 *objp) 98 { 99 return (xdr_enum(xdrs, (enum_t *)objp)); 100 } 101 102 static bool_t 103 xdr_stable_how(XDR *xdrs, stable_how *objp) 104 { 105 return (xdr_enum(xdrs, (enum_t *)objp)); 106 } 107 108 static bool_t 109 xdr_createmode3(XDR *xdrs, createmode3 *objp) 110 { 111 return (xdr_enum(xdrs, (enum_t *)objp)); 112 } 113 114 static bool_t 115 xdr_size3(XDR *xdrs, size3 *objp) 116 { 117 return (xdr_uint64(xdrs, objp)); 118 } 119 120 static bool_t 121 xdr_count3(XDR *xdrs, count3 *objp) 122 { 123 return (xdr_uint32(xdrs, objp)); 124 } 125 126 static bool_t 127 xdr_set_size3(XDR *xdrs, set_size3 *objp) 128 { 129 if (!xdr_bool(xdrs, &objp->set_it)) 130 return (FALSE); 131 switch (objp->set_it) { 132 case TRUE: 133 if (!xdr_size3(xdrs, &objp->size)) 134 return (FALSE); 135 break; 136 } 137 return (TRUE); 138 } 139 140 static bool_t 141 xdr_offset3(XDR *xdrs, offset3 *objp) 142 { 143 return (xdr_uint64(xdrs, objp)); 144 } 145 146 bool_t 147 xdr_fhandle(XDR *xdrs, fhandle_t *fh) 148 { 149 if (xdrs->x_op == XDR_FREE) 150 return (TRUE); 151 152 return (xdr_opaque(xdrs, (caddr_t)fh, NFS_FHSIZE)); 153 } 154 155 156 bool_t 157 xdr_nfs_fh3(XDR *xdrs, nfs_fh3 *objp) 158 { 159 if (!xdr_u_int(xdrs, &objp->fh3_length)) 160 return (FALSE); 161 162 if (objp->fh3_length > NFS3_FHSIZE) 163 return (FALSE); 164 165 if (xdrs->x_op == XDR_DECODE || xdrs->x_op == XDR_ENCODE) 166 return (xdr_opaque(xdrs, objp->fh3_u.data, objp->fh3_length)); 167 168 if (xdrs->x_op == XDR_FREE) 169 return (TRUE); 170 171 return (FALSE); 172 } 173 174 static bool_t 175 xdr_post_op_fh3(XDR *xdrs, post_op_fh3 *objp) 176 { 177 if (!xdr_bool(xdrs, &objp->handle_follows)) 178 return (FALSE); 179 switch (objp->handle_follows) { 180 case TRUE: 181 if (!xdr_nfs_fh3(xdrs, &objp->handle)) 182 return (FALSE); 183 break; 184 case FALSE: 185 break; 186 default: 187 return (FALSE); 188 } 189 return (TRUE); 190 } 191 192 bool_t 193 xdr_nfsstat3(XDR *xdrs, nfsstat3 *objp) 194 { 195 return (xdr_enum(xdrs, (enum_t *)objp)); 196 } 197 198 static bool_t 199 xdr_nfsreadargs(XDR *xdrs, struct nfsreadargs *ra) 200 { 201 if (xdr_fhandle(xdrs, &ra->ra_fhandle) && 202 xdr_u_int(xdrs, &ra->ra_offset) && 203 xdr_u_int(xdrs, &ra->ra_count) && 204 xdr_u_int(xdrs, &ra->ra_totcount)) { 205 return (TRUE); 206 } 207 return (FALSE); 208 } 209 210 211 bool_t 212 xdr_nfslog_buffer_header(XDR *xdrs, nfslog_buffer_header *objp) 213 { 214 if (!xdr_u_int(xdrs, &objp->bh_length)) 215 return (FALSE); 216 if (!xdr_rpcvers(xdrs, &objp->bh_version)) 217 return (FALSE); 218 if (objp->bh_version > 1) { 219 if (!xdr_u_longlong_t(xdrs, &objp->bh_offset)) 220 return (FALSE); 221 if (!xdr_u_int(xdrs, &objp->bh_flags)) 222 return (FALSE); 223 } else { 224 uint_t bh_offset; 225 226 if (!xdr_u_int(xdrs, &objp->bh_flags)) 227 return (FALSE); 228 if (xdrs->x_op == XDR_ENCODE) 229 bh_offset = (uint_t)objp->bh_offset; 230 if (!xdr_u_int(xdrs, &bh_offset)) 231 return (FALSE); 232 if (xdrs->x_op == XDR_DECODE) 233 objp->bh_offset = (u_offset_t)bh_offset; 234 } 235 if (!xdr_timestruc32_t(xdrs, &objp->bh_timestamp)) 236 return (FALSE); 237 return (TRUE); 238 } 239 240 static bool_t 241 xdr_nfslog_record_header(XDR *xdrs, nfslog_record_header *objp) 242 { 243 if (!xdr_u_int(xdrs, &objp->rh_reclen)) 244 return (FALSE); 245 if (!xdr_u_int(xdrs, &objp->rh_rec_id)) 246 return (FALSE); 247 if (!xdr_rpcprog(xdrs, &objp->rh_prognum)) 248 return (FALSE); 249 if (!xdr_rpcproc(xdrs, &objp->rh_procnum)) 250 return (FALSE); 251 if (!xdr_rpcvers(xdrs, &objp->rh_version)) 252 return (FALSE); 253 if (!xdr_u_int(xdrs, &objp->rh_auth_flavor)) 254 return (FALSE); 255 if (!xdr_timestruc32_t(xdrs, &objp->rh_timestamp)) 256 return (FALSE); 257 if (!xdr_uid_t(xdrs, &objp->rh_uid)) 258 return (FALSE); 259 if (!xdr_gid_t(xdrs, &objp->rh_gid)) 260 return (FALSE); 261 return (TRUE); 262 } 263 264 bool_t 265 xdr_nfslog_request_record(XDR *xdrs, nfslog_request_record *objp) 266 { 267 if (!xdr_nfslog_record_header(xdrs, &objp->re_header)) 268 return (FALSE); 269 if (!xdr_string(xdrs, &objp->re_principal_name, ~0)) 270 return (FALSE); 271 if (!xdr_string(xdrs, &objp->re_netid, ~0)) 272 return (FALSE); 273 if (!xdr_string(xdrs, &objp->re_tag, ~0)) 274 return (FALSE); 275 if (!xdr_netbuf(xdrs, &objp->re_ipaddr)) 276 return (FALSE); 277 return (TRUE); 278 } 279 280 bool_t 281 xdr_nfslog_sharefsargs(XDR *xdrs, nfslog_sharefsargs *objp) 282 { 283 if (!xdr_int(xdrs, &objp->sh_flags)) 284 return (FALSE); 285 if (!xdr_u_int(xdrs, &objp->sh_anon)) 286 return (FALSE); 287 if (!xdr_string(xdrs, &objp->sh_path, ~0)) 288 return (FALSE); 289 if (!xdr_fhandle(xdrs, &objp->sh_fh_buf)) 290 return (FALSE); 291 return (TRUE); 292 } 293 294 bool_t 295 xdr_nfslog_sharefsres(XDR *xdrs, nfslog_sharefsres *objp) 296 { 297 if (!xdr_nfsstat(xdrs, objp)) 298 return (FALSE); 299 return (TRUE); 300 } 301 302 bool_t 303 xdr_nfslog_getfhargs(XDR *xdrs, nfslog_getfhargs *objp) 304 { 305 if (!xdr_fhandle(xdrs, &objp->gfh_fh_buf)) 306 return (FALSE); 307 if (!xdr_string(xdrs, &objp->gfh_path, ~0)) 308 return (FALSE); 309 return (TRUE); 310 } 311 312 bool_t 313 xdr_nfslog_diropargs(XDR *xdrs, nfslog_diropargs *objp) 314 { 315 if (!xdr_fhandle(xdrs, &objp->da_fhandle)) 316 return (FALSE); 317 if (!xdr_string(xdrs, &objp->da_name, ~0)) 318 return (FALSE); 319 return (TRUE); 320 } 321 322 static bool_t 323 xdr_nfslog_drok(XDR *xdrs, nfslog_drok *objp) 324 { 325 if (!xdr_fhandle(xdrs, &objp->drok_fhandle)) 326 return (FALSE); 327 return (TRUE); 328 } 329 330 bool_t 331 xdr_nfslog_diropres(XDR *xdrs, nfslog_diropres *objp) 332 { 333 if (!xdr_nfsstat(xdrs, &objp->dr_status)) 334 return (FALSE); 335 switch (objp->dr_status) { 336 case NFS_OK: 337 if (!xdr_nfslog_drok(xdrs, &objp->nfslog_diropres_u.dr_ok)) 338 return (FALSE); 339 break; 340 } 341 return (TRUE); 342 } 343 344 bool_t 345 xdr_nfslog_nfsreadargs(XDR *xdrs, nfslog_nfsreadargs *objp) 346 { 347 if (!xdr_nfsreadargs(xdrs, objp)) 348 return (FALSE); 349 return (TRUE); 350 } 351 352 static bool_t 353 xdr_nfslog_rrok(XDR *xdrs, nfslog_rrok *objp) 354 { 355 if (!xdr_u_int(xdrs, &objp->filesize)) 356 return (FALSE); 357 if (!xdr_u_int(xdrs, &objp->rrok_count)) 358 return (FALSE); 359 return (TRUE); 360 } 361 362 bool_t 363 xdr_nfslog_rdresult(XDR *xdrs, nfslog_rdresult *objp) 364 { 365 if (!xdr_nfsstat(xdrs, &objp->r_status)) 366 return (FALSE); 367 switch (objp->r_status) { 368 case NFS_OK: 369 if (!xdr_nfslog_rrok(xdrs, &objp->nfslog_rdresult_u.r_ok)) 370 return (FALSE); 371 break; 372 } 373 return (TRUE); 374 } 375 376 bool_t 377 xdr_nfslog_writeargs(XDR *xdrs, nfslog_writeargs *objp) 378 { 379 if (!xdr_fhandle(xdrs, &objp->waargs_fhandle)) 380 return (FALSE); 381 if (!xdr_u_int(xdrs, &objp->waargs_begoff)) 382 return (FALSE); 383 if (!xdr_u_int(xdrs, &objp->waargs_offset)) 384 return (FALSE); 385 if (!xdr_u_int(xdrs, &objp->waargs_totcount)) 386 return (FALSE); 387 if (!xdr_u_int(xdrs, &objp->waargs_count)) 388 return (FALSE); 389 return (TRUE); 390 } 391 392 bool_t 393 xdr_nfslog_writeresult(XDR *xdrs, nfslog_writeresult *objp) 394 { 395 if (!xdr_nfsstat(xdrs, &objp->wr_status)) 396 return (FALSE); 397 switch (objp->wr_status) { 398 case NFS_OK: 399 if (!xdr_u_int(xdrs, &objp->nfslog_writeresult_u.wr_size)) 400 return (FALSE); 401 break; 402 } 403 return (TRUE); 404 } 405 406 static bool_t 407 xdr_nfslog_sattr(XDR *xdrs, nfslog_sattr *objp) 408 { 409 if (!xdr_u_int(xdrs, &objp->sa_mode)) 410 return (FALSE); 411 if (!xdr_u_int(xdrs, &objp->sa_uid)) 412 return (FALSE); 413 if (!xdr_u_int(xdrs, &objp->sa_gid)) 414 return (FALSE); 415 if (!xdr_u_int(xdrs, &objp->sa_size)) 416 return (FALSE); 417 if (!xdr_nfs2_timeval(xdrs, (nfs2_timeval *)&objp->sa_atime)) 418 return (FALSE); 419 if (!xdr_nfs2_timeval(xdrs, (nfs2_timeval *)&objp->sa_mtime)) 420 return (FALSE); 421 return (TRUE); 422 } 423 424 bool_t 425 xdr_nfslog_createargs(XDR *xdrs, nfslog_createargs *objp) 426 { 427 if (!xdr_nfslog_sattr(xdrs, &objp->ca_sa)) 428 return (FALSE); 429 if (!xdr_nfslog_diropargs(xdrs, &objp->ca_da)) 430 return (FALSE); 431 return (TRUE); 432 } 433 434 bool_t 435 xdr_nfslog_setattrargs(XDR *xdrs, nfslog_setattrargs *objp) 436 { 437 if (!xdr_fhandle(xdrs, &objp->saa_fh)) 438 return (FALSE); 439 if (!xdr_nfslog_sattr(xdrs, &objp->saa_sa)) 440 return (FALSE); 441 return (TRUE); 442 } 443 444 bool_t 445 xdr_nfslog_rdlnres(XDR *xdrs, nfslog_rdlnres *objp) 446 { 447 if (!xdr_nfsstat(xdrs, &objp->rl_status)) 448 return (FALSE); 449 switch (objp->rl_status) { 450 case NFS_OK: 451 if (!xdr_string(xdrs, &objp->nfslog_rdlnres_u.rl_ok, ~0)) 452 return (FALSE); 453 break; 454 } 455 return (TRUE); 456 } 457 458 bool_t 459 xdr_nfslog_rnmargs(XDR *xdrs, nfslog_rnmargs *objp) 460 { 461 if (!xdr_nfslog_diropargs(xdrs, &objp->rna_from)) 462 return (FALSE); 463 if (!xdr_nfslog_diropargs(xdrs, &objp->rna_to)) 464 return (FALSE); 465 return (TRUE); 466 } 467 468 bool_t 469 xdr_nfslog_linkargs(XDR *xdrs, nfslog_linkargs *objp) 470 { 471 if (!xdr_fhandle(xdrs, &objp->la_from)) 472 return (FALSE); 473 if (!xdr_nfslog_diropargs(xdrs, &objp->la_to)) 474 return (FALSE); 475 return (TRUE); 476 } 477 478 bool_t 479 xdr_nfslog_symlinkargs(XDR *xdrs, nfslog_symlinkargs *objp) 480 { 481 if (!xdr_nfslog_diropargs(xdrs, &objp->sla_from)) 482 return (FALSE); 483 if (!xdr_string(xdrs, &objp->sla_tnm, ~0)) 484 return (FALSE); 485 if (!xdr_nfslog_sattr(xdrs, &objp->sla_sa)) 486 return (FALSE); 487 return (TRUE); 488 } 489 490 bool_t 491 xdr_nfslog_rddirargs(XDR *xdrs, nfslog_rddirargs *objp) 492 { 493 if (!xdr_fhandle(xdrs, &objp->rda_fh)) 494 return (FALSE); 495 if (!xdr_u_int(xdrs, &objp->rda_offset)) 496 return (FALSE); 497 if (!xdr_u_int(xdrs, &objp->rda_count)) 498 return (FALSE); 499 return (TRUE); 500 } 501 502 static bool_t 503 xdr_nfslog_rdok(XDR *xdrs, nfslog_rdok *objp) 504 { 505 if (!xdr_u_int(xdrs, &objp->rdok_offset)) 506 return (FALSE); 507 if (!xdr_u_int(xdrs, &objp->rdok_size)) 508 return (FALSE); 509 if (!xdr_bool(xdrs, &objp->rdok_eof)) 510 return (FALSE); 511 return (TRUE); 512 } 513 514 bool_t 515 xdr_nfslog_rddirres(XDR *xdrs, nfslog_rddirres *objp) 516 { 517 if (!xdr_nfsstat(xdrs, &objp->rd_status)) 518 return (FALSE); 519 switch (objp->rd_status) { 520 case NFS_OK: 521 if (!xdr_nfslog_rdok(xdrs, &objp->nfslog_rddirres_u.rd_ok)) 522 return (FALSE); 523 break; 524 } 525 return (TRUE); 526 } 527 528 bool_t 529 xdr_nfslog_diropargs3(XDR *xdrs, nfslog_diropargs3 *objp) 530 { 531 if (!xdr_nfs_fh3(xdrs, &objp->dir)) 532 return (FALSE); 533 if (!xdr_string(xdrs, &objp->name, ~0)) 534 return (FALSE); 535 return (TRUE); 536 } 537 538 bool_t 539 xdr_nfslog_LOOKUP3res(XDR *xdrs, nfslog_LOOKUP3res *objp) 540 { 541 if (!xdr_nfsstat3(xdrs, &objp->status)) 542 return (FALSE); 543 switch (objp->status) { 544 case NFS3_OK: 545 if (!xdr_nfs_fh3(xdrs, &objp->nfslog_LOOKUP3res_u.object)) 546 return (FALSE); 547 break; 548 } 549 return (TRUE); 550 } 551 552 static bool_t 553 xdr_nfslog_createhow3(XDR *xdrs, nfslog_createhow3 *objp) 554 { 555 if (!xdr_createmode3(xdrs, &objp->mode)) 556 return (FALSE); 557 switch (objp->mode) { 558 case UNCHECKED: 559 case GUARDED: 560 if (!xdr_set_size3(xdrs, &objp->nfslog_createhow3_u.size)) 561 return (FALSE); 562 break; 563 case EXCLUSIVE: 564 break; 565 default: 566 return (FALSE); 567 } 568 return (TRUE); 569 } 570 571 bool_t 572 xdr_nfslog_CREATE3args(XDR *xdrs, nfslog_CREATE3args *objp) 573 { 574 if (!xdr_nfslog_diropargs3(xdrs, &objp->where)) 575 return (FALSE); 576 if (!xdr_nfslog_createhow3(xdrs, &objp->how)) 577 return (FALSE); 578 return (TRUE); 579 } 580 581 static bool_t 582 xdr_nfslog_CREATE3resok(XDR *xdrs, nfslog_CREATE3resok *objp) 583 { 584 if (!xdr_post_op_fh3(xdrs, &objp->obj)) 585 return (FALSE); 586 return (TRUE); 587 } 588 589 bool_t 590 xdr_nfslog_CREATE3res(XDR *xdrs, nfslog_CREATE3res *objp) 591 { 592 if (!xdr_nfsstat3(xdrs, &objp->status)) 593 return (FALSE); 594 switch (objp->status) { 595 case NFS3_OK: 596 if (!xdr_nfslog_CREATE3resok( 597 xdrs, &objp->nfslog_CREATE3res_u.ok)) 598 return (FALSE); 599 break; 600 } 601 return (TRUE); 602 } 603 604 bool_t 605 xdr_nfslog_SETATTR3args(XDR *xdrs, nfslog_SETATTR3args *objp) 606 { 607 if (!xdr_nfs_fh3(xdrs, &objp->object)) 608 return (FALSE); 609 if (!xdr_set_size3(xdrs, &objp->size)) 610 return (FALSE); 611 return (TRUE); 612 } 613 614 bool_t 615 xdr_nfslog_READLINK3res(XDR *xdrs, nfslog_READLINK3res *objp) 616 { 617 if (!xdr_nfsstat3(xdrs, &objp->status)) 618 return (FALSE); 619 switch (objp->status) { 620 case NFS3_OK: 621 if (!xdr_string(xdrs, &objp->nfslog_READLINK3res_u.data, ~0)) 622 return (FALSE); 623 break; 624 } 625 return (TRUE); 626 } 627 628 bool_t 629 xdr_nfslog_READ3args(XDR *xdrs, nfslog_READ3args *objp) 630 { 631 if (!xdr_nfs_fh3(xdrs, &objp->file)) 632 return (FALSE); 633 if (!xdr_offset3(xdrs, &objp->offset)) 634 return (FALSE); 635 if (!xdr_count3(xdrs, &objp->count)) 636 return (FALSE); 637 return (TRUE); 638 } 639 640 static bool_t 641 xdr_nfslog_READ3resok(XDR *xdrs, nfslog_READ3resok *objp) 642 { 643 if (!xdr_size3(xdrs, &objp->filesize)) 644 return (FALSE); 645 if (!xdr_count3(xdrs, &objp->count)) 646 return (FALSE); 647 if (!xdr_bool(xdrs, &objp->eof)) 648 return (FALSE); 649 if (!xdr_u_int(xdrs, &objp->size)) 650 return (FALSE); 651 return (TRUE); 652 } 653 654 bool_t 655 xdr_nfslog_READ3res(XDR *xdrs, nfslog_READ3res *objp) 656 { 657 if (!xdr_nfsstat3(xdrs, &objp->status)) 658 return (FALSE); 659 switch (objp->status) { 660 case NFS3_OK: 661 if (!xdr_nfslog_READ3resok(xdrs, &objp->nfslog_READ3res_u.ok)) 662 return (FALSE); 663 break; 664 } 665 return (TRUE); 666 } 667 668 bool_t 669 xdr_nfslog_WRITE3args(XDR *xdrs, nfslog_WRITE3args *objp) 670 { 671 if (!xdr_nfs_fh3(xdrs, &objp->file)) 672 return (FALSE); 673 if (!xdr_offset3(xdrs, &objp->offset)) 674 return (FALSE); 675 if (!xdr_count3(xdrs, &objp->count)) 676 return (FALSE); 677 if (!xdr_stable_how(xdrs, &objp->stable)) 678 return (FALSE); 679 return (TRUE); 680 } 681 682 static bool_t 683 xdr_nfslog_WRITE3resok(XDR *xdrs, nfslog_WRITE3resok *objp) 684 { 685 if (!xdr_size3(xdrs, &objp->filesize)) 686 return (FALSE); 687 if (!xdr_count3(xdrs, &objp->count)) 688 return (FALSE); 689 if (!xdr_stable_how(xdrs, &objp->committed)) 690 return (FALSE); 691 return (TRUE); 692 } 693 694 bool_t 695 xdr_nfslog_WRITE3res(XDR *xdrs, nfslog_WRITE3res *objp) 696 { 697 if (!xdr_nfsstat3(xdrs, &objp->status)) 698 return (FALSE); 699 switch (objp->status) { 700 case NFS3_OK: 701 if (!xdr_nfslog_WRITE3resok(xdrs, &objp->nfslog_WRITE3res_u.ok)) 702 return (FALSE); 703 break; 704 } 705 return (TRUE); 706 } 707 708 bool_t 709 xdr_nfslog_MKDIR3args(XDR *xdrs, nfslog_MKDIR3args *objp) 710 { 711 if (!xdr_nfslog_diropargs3(xdrs, &objp->where)) 712 return (FALSE); 713 return (TRUE); 714 } 715 716 bool_t 717 xdr_nfslog_MKDIR3res(XDR *xdrs, nfslog_MKDIR3res *objp) 718 { 719 if (!xdr_nfsstat3(xdrs, &objp->status)) 720 return (FALSE); 721 switch (objp->status) { 722 case NFS3_OK: 723 if (!xdr_post_op_fh3(xdrs, &objp->nfslog_MKDIR3res_u.obj)) 724 return (FALSE); 725 break; 726 } 727 return (TRUE); 728 } 729 730 bool_t 731 xdr_nfslog_SYMLINK3args(XDR *xdrs, nfslog_SYMLINK3args *objp) 732 { 733 if (!xdr_nfslog_diropargs3(xdrs, &objp->where)) 734 return (FALSE); 735 if (!xdr_string(xdrs, &objp->symlink_data, ~0)) 736 return (FALSE); 737 return (TRUE); 738 } 739 740 bool_t 741 xdr_nfslog_SYMLINK3res(XDR *xdrs, nfslog_SYMLINK3res *objp) 742 { 743 if (!xdr_nfsstat3(xdrs, &objp->status)) 744 return (FALSE); 745 switch (objp->status) { 746 case NFS3_OK: 747 if (!xdr_post_op_fh3(xdrs, &objp->nfslog_SYMLINK3res_u.obj)) 748 return (FALSE); 749 break; 750 } 751 return (TRUE); 752 } 753 754 bool_t 755 xdr_nfslog_MKNOD3args(XDR *xdrs, nfslog_MKNOD3args *objp) 756 { 757 if (!xdr_nfslog_diropargs3(xdrs, &objp->where)) 758 return (FALSE); 759 if (!xdr_ftype3(xdrs, &objp->type)) 760 return (FALSE); 761 return (TRUE); 762 } 763 764 bool_t 765 xdr_nfslog_MKNOD3res(XDR *xdrs, nfslog_MKNOD3res *objp) 766 { 767 if (!xdr_nfsstat3(xdrs, &objp->status)) 768 return (FALSE); 769 switch (objp->status) { 770 case NFS3_OK: 771 if (!xdr_post_op_fh3(xdrs, &objp->nfslog_MKNOD3res_u.obj)) 772 return (FALSE); 773 break; 774 } 775 return (TRUE); 776 } 777 778 bool_t 779 xdr_nfslog_REMOVE3args(XDR *xdrs, nfslog_REMOVE3args *objp) 780 { 781 if (!xdr_nfslog_diropargs3(xdrs, &objp->object)) 782 return (FALSE); 783 return (TRUE); 784 } 785 786 bool_t 787 xdr_nfslog_RMDIR3args(XDR *xdrs, nfslog_RMDIR3args *objp) 788 { 789 if (!xdr_nfslog_diropargs3(xdrs, &objp->object)) 790 return (FALSE); 791 return (TRUE); 792 } 793 794 bool_t 795 xdr_nfslog_RENAME3args(XDR *xdrs, nfslog_RENAME3args *objp) 796 { 797 if (!xdr_nfslog_diropargs3(xdrs, &objp->from)) 798 return (FALSE); 799 if (!xdr_nfslog_diropargs3(xdrs, &objp->to)) 800 return (FALSE); 801 return (TRUE); 802 } 803 804 bool_t 805 xdr_nfslog_LINK3args(XDR *xdrs, nfslog_LINK3args *objp) 806 { 807 if (!xdr_nfs_fh3(xdrs, &objp->file)) 808 return (FALSE); 809 if (!xdr_nfslog_diropargs3(xdrs, &objp->link)) 810 return (FALSE); 811 return (TRUE); 812 } 813 814 bool_t 815 xdr_nfslog_READDIRPLUS3args(XDR *xdrs, nfslog_READDIRPLUS3args *objp) 816 { 817 if (!xdr_nfs_fh3(xdrs, &objp->dir)) 818 return (FALSE); 819 if (!xdr_count3(xdrs, &objp->dircount)) 820 return (FALSE); 821 if (!xdr_count3(xdrs, &objp->maxcount)) 822 return (FALSE); 823 return (TRUE); 824 } 825 826 static bool_t 827 xdr_nfslog_entryplus3(XDR *xdrs, nfslog_entryplus3 *objp) 828 { 829 if (!xdr_post_op_fh3(xdrs, &objp->name_handle)) 830 return (FALSE); 831 if (!xdr_string(xdrs, &objp->name, ~0)) 832 return (FALSE); 833 if (!xdr_pointer(xdrs, (char **)&objp->nextentry, 834 sizeof (nfslog_entryplus3), (xdrproc_t)xdr_nfslog_entryplus3)) 835 return (FALSE); 836 return (TRUE); 837 } 838 839 static bool_t 840 xdr_nfslog_dirlistplus3(XDR *xdrs, nfslog_dirlistplus3 *objp) 841 { 842 if (!xdr_pointer(xdrs, (char **)&objp->entries, 843 sizeof (nfslog_entryplus3), (xdrproc_t)xdr_nfslog_entryplus3)) 844 return (FALSE); 845 if (!xdr_bool(xdrs, &objp->eof)) 846 return (FALSE); 847 return (TRUE); 848 } 849 850 static bool_t 851 xdr_nfslog_READDIRPLUS3resok(XDR *xdrs, nfslog_READDIRPLUS3resok *objp) 852 { 853 if (!xdr_nfslog_dirlistplus3(xdrs, &objp->reply)) 854 return (FALSE); 855 return (TRUE); 856 } 857 858 bool_t 859 xdr_nfslog_READDIRPLUS3res(XDR *xdrs, nfslog_READDIRPLUS3res *objp) 860 { 861 if (!xdr_nfsstat3(xdrs, &objp->status)) 862 return (FALSE); 863 switch (objp->status) { 864 case NFS3_OK: 865 if (!xdr_nfslog_READDIRPLUS3resok( 866 xdrs, &objp->nfslog_READDIRPLUS3res_u.ok)) 867 return (FALSE); 868 break; 869 } 870 return (TRUE); 871 } 872 873 bool_t 874 xdr_nfslog_COMMIT3args(XDR *xdrs, nfslog_COMMIT3args *objp) 875 { 876 if (!xdr_nfs_fh3(xdrs, &objp->file)) 877 return (FALSE); 878 if (!xdr_offset3(xdrs, &objp->offset)) 879 return (FALSE); 880 if (!xdr_count3(xdrs, &objp->count)) 881 return (FALSE); 882 return (TRUE); 883 } 884