bool_t xdr_FSSTAT3resok(XDR *xdrs, FSSTAT3resok *objp) { if (!xdr_post_op_attr(xdrs, &objp->obj_attributes)) return (FALSE); if (!xdr_size3(xdrs, &objp->tbytes)) return (FALSE); if (!xdr_size3(xdrs, &objp->fbytes)) return (FALSE); if (!xdr_size3(xdrs, &objp->abytes)) return (FALSE); if (!xdr_size3(xdrs, &objp->tfiles)) return (FALSE); if (!xdr_size3(xdrs, &objp->ffiles)) return (FALSE); if (!xdr_size3(xdrs, &objp->afiles)) return (FALSE); if (!xdr_uint32(xdrs, &objp->invarsec)) return (FALSE); return (TRUE); }
bool_t xdr_read3res(XDR *xdrs, read3res *objp) { register int32_t *buf; if (!xdr_nfsstat3(xdrs, &objp->status)) { return (FALSE); } switch (objp->status) { case NFS3_OK: if (!xdr_read3resok(xdrs, &objp->RPC_UNION_NAME(read3res).resok)) { return (FALSE); } break; default: if (!xdr_post_op_attr(xdrs, &objp->RPC_UNION_NAME(read3res).resfail)) { return (FALSE); } break; } return (TRUE); }
bool_t xdr_pathconf3resok (XDR *xdrs, pathconf3resok *objp) { register int32_t *buf; if (xdrs->x_op == XDR_ENCODE) { if (!xdr_post_op_attr (xdrs, &objp->obj_attributes)) return FALSE; if (!xdr_uint32 (xdrs, &objp->linkmax)) return FALSE; if (!xdr_uint32 (xdrs, &objp->name_max)) return FALSE; buf = XDR_INLINE (xdrs, 4 * BYTES_PER_XDR_UNIT); if (buf == NULL) { if (!xdr_bool (xdrs, &objp->no_trunc)) return FALSE; if (!xdr_bool (xdrs, &objp->chown_restricted)) return FALSE; if (!xdr_bool (xdrs, &objp->case_insensitive)) return FALSE; if (!xdr_bool (xdrs, &objp->case_preserving)) return FALSE; } else { IXDR_PUT_BOOL(buf, objp->no_trunc); IXDR_PUT_BOOL(buf, objp->chown_restricted); IXDR_PUT_BOOL(buf, objp->case_insensitive); IXDR_PUT_BOOL(buf, objp->case_preserving); } return TRUE; } else if (xdrs->x_op == XDR_DECODE) { if (!xdr_post_op_attr (xdrs, &objp->obj_attributes)) return FALSE; if (!xdr_uint32 (xdrs, &objp->linkmax)) return FALSE; if (!xdr_uint32 (xdrs, &objp->name_max)) return FALSE; buf = XDR_INLINE (xdrs, 4 * BYTES_PER_XDR_UNIT); if (buf == NULL) { if (!xdr_bool (xdrs, &objp->no_trunc)) return FALSE; if (!xdr_bool (xdrs, &objp->chown_restricted)) return FALSE; if (!xdr_bool (xdrs, &objp->case_insensitive)) return FALSE; if (!xdr_bool (xdrs, &objp->case_preserving)) return FALSE; } else { objp->no_trunc = IXDR_GET_BOOL(buf); objp->chown_restricted = IXDR_GET_BOOL(buf); objp->case_insensitive = IXDR_GET_BOOL(buf); objp->case_preserving = IXDR_GET_BOOL(buf); } return TRUE; } if (!xdr_post_op_attr (xdrs, &objp->obj_attributes)) return FALSE; if (!xdr_uint32 (xdrs, &objp->linkmax)) return FALSE; if (!xdr_uint32 (xdrs, &objp->name_max)) return FALSE; if (!xdr_bool (xdrs, &objp->no_trunc)) return FALSE; if (!xdr_bool (xdrs, &objp->chown_restricted)) return FALSE; if (!xdr_bool (xdrs, &objp->case_insensitive)) return FALSE; if (!xdr_bool (xdrs, &objp->case_preserving)) return FALSE; return TRUE; }
BOOL afsdir::xdr (XDR *x, void *_sbp) { /* When encoding . and .. in an XDR, we want to make sure the string * memory doesn't get freed before the XDR uses it. */ static const filename dot ("."); static const filename dotdot (".."); svccb *sbp = static_cast<svccb *> (_sbp); const sfs_aid aid = sbp2aid (sbp); assert (x->x_op == XDR_ENCODE); const bool v2 = sbp->vers () == 2; afsdir *d; u_int32_t cookie; u_int32_t count; bool (*putentry) (XDR *, afsnode *, filename, u_int32_t); if (v2) { const readdirargs *arg = sbp->Xtmpl getarg<readdirargs> (); d = static_cast<afsdir *> (afsnode::fh2node (&arg->dir)); cookie = getint (arg->cookie.base ()); count = arg->count; putentry = xdr_putentry; } else if (sbp->proc () == NFSPROC3_READDIR) { const readdir3args *arg = sbp->Xtmpl getarg<readdir3args> (); d = static_cast<afsdir *> (afsnode::fh3node (&arg->dir)); cookie = arg->cookie; count = arg->count; putentry = xdr_putentry3; } else if (sbp->proc () == NFSPROC3_READDIRPLUS) { const readdirplus3args *arg = sbp->Xtmpl getarg<readdirplus3args> (); d = static_cast<afsdir *> (afsnode::fh3node (&arg->dir)); cookie = arg->cookie; count = arg->dircount; putentry = xdr_putentryplus3; } else return xdr_putint (x, NFS3ERR_NOTSUPP); if (!d) return xdr_putint (x, NFSERR_STALE); afsdirentry *e = NULL; if (cookie >= 3 && (!(e = cookietab[cookie]) || !d->entryok (e, aid))) { warn ("afsdir::xdr: bad cookie 0x%x\n", cookie); return xdr_putint (x, v2 ? EINVAL : NFS3ERR_BAD_COOKIE); } if (!xdr_putint (x, NFS_OK)) return false; if (!v2) { post_op_attr poa; d->mkpoattr (poa, aid); if (!xdr_post_op_attr (x, &poa) || !xdr_puthyper (x, 0)) return false; } switch (cookie) { case 0: if (!putentry (x, d, dot, 1)) return false; case 1: if (!putentry (x, d->parent, dotdot, 2)) return false; case 2: e = d->firstentry (aid); break; default: e = d->nextentry (e, aid); break; } for (; e && XDR_GETPOS (x) + 24 + e->name.len () <= count; e = d->nextentry (e, aid)) if (!putentry (x, e->node, e->name, e->cookie)) return false; return xdr_putint (x, 0) // NULL entry * && xdr_putint (x, !e); // bool eof }