bool_t xdr_ex_entryplus3(XDR *xdrs, ex_entryplus3 *objp) { register int32_t *buf; if (!xdr_uint64(xdrs, &objp->fileid)) { return (FALSE); } if (!xdr_filename3(xdrs, &objp->name)) { return (FALSE); } if (!xdr_uint64(xdrs, &objp->cookie)) { return (FALSE); } if (!xdr_ex_post_op_attr(xdrs, &objp->name_attributes)) { return (FALSE); } if (!xdr_post_op_fh3(xdrs, &objp->name_handle)) { return (FALSE); } if (!xdr_pointer(xdrs, (char **)&objp->nextentry, sizeof(ex_entryplus3), (xdrproc_t)xdr_ex_entryplus3)) { return (FALSE); } return (TRUE); }
bool_t xdr_ex_fattr3(XDR *xdrs, ex_fattr3 *objp) { register int32_t *buf; if (!xdr_ftype3(xdrs, &objp->type)) { return (FALSE); } if (!xdr_uint32(xdrs, &objp->mode)) { return (FALSE); } if (!xdr_uint32(xdrs, &objp->nlink)) { return (FALSE); } if (!xdr_uint32(xdrs, &objp->uid)) { return (FALSE); } if (!xdr_uint32(xdrs, &objp->gid)) { return (FALSE); } if (!xdr_uint64(xdrs, &objp->size)) { return (FALSE); } if (!xdr_uint64(xdrs, &objp->used)) { return (FALSE); } if (!xdr_specdata3(xdrs, &objp->rdev)) { return (FALSE); } if (!xdr_uint64(xdrs, &objp->fsid)) { return (FALSE); } if (!xdr_uint64(xdrs, &objp->fileid)) { return (FALSE); } if (!xdr_nfstime3(xdrs, &objp->atime)) { return (FALSE); } if (!xdr_nfstime3(xdrs, &objp->mtime)) { return (FALSE); } if (!xdr_nfstime3(xdrs, &objp->ctime)) { return (FALSE); } if (!xdr_uint32(xdrs, &objp->expire)) { return (FALSE); } return (TRUE); }
bool_t xdr_offset3(register XDR *xdrs, offset3 *objp) { if (!xdr_uint64(xdrs, objp)) return (FALSE); return (TRUE); }
bool_t xdr_fileid3(register XDR *xdrs, fileid3 *objp) { if (!xdr_uint64(xdrs, objp)) return (FALSE); return (TRUE); }
bool_t xdr_cookie3(register XDR *xdrs, cookie3 *objp) { if (!xdr_uint64(xdrs, objp)) return (FALSE); return (TRUE); }
bool_t xdr_size3 (XDR *xdrs, size3 *objp) { if (!xdr_uint64 (xdrs, objp)) return FALSE; return TRUE; }
bool_t xdr_offset3 (XDR *xdrs, offset3 *objp) { if (!xdr_uint64 (xdrs, objp)) return FALSE; return TRUE; }
bool_t xdr_fattr3 (XDR *xdrs, fattr3 *objp) { if (!xdr_ftype3 (xdrs, &objp->type)) return FALSE; if (!xdr_mode3 (xdrs, &objp->mode)) return FALSE; if (!xdr_uint32 (xdrs, &objp->nlink)) return FALSE; if (!xdr_uid3 (xdrs, &objp->uid)) return FALSE; if (!xdr_gid3 (xdrs, &objp->gid)) return FALSE; if (!xdr_size3 (xdrs, &objp->size)) return FALSE; if (!xdr_size3 (xdrs, &objp->used)) return FALSE; if (!xdr_specdata3 (xdrs, &objp->rdev)) return FALSE; if (!xdr_uint64 (xdrs, &objp->fsid)) return FALSE; if (!xdr_fileid3 (xdrs, &objp->fileid)) return FALSE; if (!xdr_nfstime3 (xdrs, &objp->atime)) return FALSE; if (!xdr_nfstime3 (xdrs, &objp->mtime)) return FALSE; if (!xdr_nfstime3 (xdrs, &objp->ctime)) return FALSE; return TRUE; }
bool_t xdr_fileid3 (XDR *xdrs, fileid3 *objp) { if (!xdr_uint64 (xdrs, objp)) return FALSE; return TRUE; }
/* * XDR decode the long reply write chunk. */ bool_t xdr_decode_reply_wchunk(XDR *xdrs, struct clist **clist) { bool_t have_rchunk = FALSE; struct clist *first = NULL, *ncl = NULL; uint32_t num_wclist; uint32_t i; if (!xdr_bool(xdrs, &have_rchunk)) return (FALSE); if (have_rchunk == FALSE) return (TRUE); if (!xdr_uint32(xdrs, &num_wclist)) { DTRACE_PROBE(krpc__e__xdrrdma__replywchunk__listlength); return (FALSE); } if (num_wclist == 0) { return (FALSE); } first = ncl = clist_alloc(); for (i = 0; i < num_wclist; i++) { if (i > 0) { ncl->c_next = clist_alloc(); ncl = ncl->c_next; } if (!xdr_uint32(xdrs, &ncl->c_dmemhandle.mrc_rmr)) goto err_out; if (!xdr_uint32(xdrs, &ncl->c_len)) goto err_out; if (!xdr_uint64(xdrs, &ncl->u.c_daddr)) goto err_out; if (ncl->c_len > MAX_SVC_XFER_SIZE) { DTRACE_PROBE( krpc__e__xdrrdma__replywchunk__chunklist_toobig); ncl->c_len = MAX_SVC_XFER_SIZE; } if (!(ncl->c_dmemhandle.mrc_rmr && (ncl->c_len > 0) && ncl->u.c_daddr)) DTRACE_PROBE( krpc__e__xdrrdma__replywchunk__invalid_segaddr); DTRACE_PROBE1(krpc__i__xdr_decode_reply_wchunk_c_len, uint32_t, ncl->c_len); } *clist = first; return (TRUE); err_out: clist_free(first); return (FALSE); }
bool_t xdr_cookie3 (XDR *xdrs, cookie3 *objp) { if (!xdr_uint64 (xdrs, objp)) return FALSE; return TRUE; }
bool_t xdr_size3(XDR *xdrs, size3 *objp) { if (!xdr_uint64(xdrs, objp)) return (FALSE); return (TRUE); }
bool_t xdr_entry3(XDR *xdrs, entry3 *objp) { register int32_t *buf; if (!xdr_uint64(xdrs, &objp->fileid)) { return (FALSE); } if (!xdr_filename3(xdrs, &objp->name)) { return (FALSE); } if (!xdr_uint64(xdrs, &objp->cookie)) { return (FALSE); } if (!xdr_pointer(xdrs, (char **)&objp->nextentry, sizeof(entry3), (xdrproc_t)xdr_entry3)) { return (FALSE); } return (TRUE); }
bool_t xdr_ex_fsstat3resok(XDR *xdrs, ex_fsstat3resok *objp) { register int32_t *buf; if (!xdr_ex_post_op_attr(xdrs, &objp->obj_attributes)) { return (FALSE); } if (!xdr_uint64(xdrs, &objp->tbytes)) { return (FALSE); } if (!xdr_uint64(xdrs, &objp->fbytes)) { return (FALSE); } if (!xdr_uint64(xdrs, &objp->abytes)) { return (FALSE); } if (!xdr_uint64(xdrs, &objp->tfiles)) { return (FALSE); } if (!xdr_uint64(xdrs, &objp->ffiles)) { return (FALSE); } if (!xdr_uint64(xdrs, &objp->afiles)) { return (FALSE); } if (!xdr_uint32(xdrs, &objp->invarsec)) { return (FALSE); } return (TRUE); }
/* * Not all fields in struct clist are interesting to the RPC over RDMA * protocol. Only XDR the interesting fields. */ bool_t xdr_clist(XDR *xdrs, clist *objp) { if (!xdr_uint32(xdrs, &objp->c_xdroff)) return (FALSE); if (!xdr_uint32(xdrs, &objp->c_smemhandle.mrc_rmr)) return (FALSE); if (!xdr_uint32(xdrs, &objp->c_len)) return (FALSE); if (!xdr_uint64(xdrs, &objp->w.c_saddr)) return (FALSE); if (!xdr_do_clist(xdrs, &objp->c_next)) return (FALSE); return (TRUE); }
/* * Conditionally decode a RDMA WRITE chunk list from XDR stream. * * If the next boolean in the XDR stream is false there is no * RDMA WRITE chunk list present. Otherwise iterate over the * array and for each entry: allocate a struct clist and decode. * Pass back an indication via wlist_exists if we have seen a * RDMA WRITE chunk list. */ bool_t xdr_decode_wlist(XDR *xdrs, struct clist **w, bool_t *wlist_exists) { struct clist *tmp; bool_t more = FALSE; uint32_t seg_array_len; uint32_t i; if (!xdr_bool(xdrs, &more)) return (FALSE); /* is there a wlist? */ if (more == FALSE) { *wlist_exists = FALSE; return (TRUE); } *wlist_exists = TRUE; if (!xdr_uint32(xdrs, &seg_array_len)) return (FALSE); tmp = *w = clist_alloc(); for (i = 0; i < seg_array_len; i++) { if (!xdr_uint32(xdrs, &tmp->c_dmemhandle.mrc_rmr)) return (FALSE); if (!xdr_uint32(xdrs, &tmp->c_len)) return (FALSE); DTRACE_PROBE1(krpc__i__xdr_decode_wlist_len, uint_t, tmp->c_len); if (!xdr_uint64(xdrs, &tmp->u.c_daddr)) return (FALSE); if (i < seg_array_len - 1) { tmp->c_next = clist_alloc(); tmp = tmp->c_next; } else { tmp->c_next = NULL; } } more = FALSE; if (!xdr_bool(xdrs, &more)) return (FALSE); return (TRUE); }
bool_t xdr_wcc_attr(XDR *xdrs, wcc_attr *objp) { register int32_t *buf; if (!xdr_uint64(xdrs, &objp->size)) { return (FALSE); } if (!xdr_nfstime3(xdrs, &objp->mtime)) { return (FALSE); } if (!xdr_nfstime3(xdrs, &objp->ctime)) { return (FALSE); } return (TRUE); }
bool_t xdr_read3args(XDR *xdrs, read3args *objp) { register int32_t *buf; if (!xdr_nfs_fh3(xdrs, &objp->file)) { return (FALSE); } if (!xdr_uint64(xdrs, &objp->offset)) { return (FALSE); } if (!xdr_uint32(xdrs, &objp->count)) { return (FALSE); } return (TRUE); }
bool_t xdr_set_uint64(XDR *xdrs, set_uint64 *objp) { register int32_t *buf; if (!xdr_bool(xdrs, &objp->set)) { return (FALSE); } switch (objp->set) { case TRUE: if (!xdr_uint64(xdrs, &objp->RPC_UNION_NAME(set_uint64).val)) { return (FALSE); } break; } return (TRUE); }
bool_t xdr_encode_wlist(XDR *xdrs, clist *w) { bool_t vfalse = FALSE, vtrue = TRUE; int i; uint_t num_segment = 0; struct clist *cl; /* does a wlist exist? */ if (w == NULL) { return (xdr_bool(xdrs, &vfalse)); } /* Encode N consecutive segments, 1, N, HLOO, ..., HLOO, 0 */ if (!xdr_bool(xdrs, &vtrue)) return (FALSE); for (cl = w; cl != NULL; cl = cl->c_next) { num_segment++; } if (!xdr_uint32(xdrs, &num_segment)) return (FALSE); for (i = 0; i < num_segment; i++) { DTRACE_PROBE1(krpc__i__xdr_encode_wlist_len, uint_t, w->c_len); if (!xdr_uint32(xdrs, &w->c_dmemhandle.mrc_rmr)) return (FALSE); if (!xdr_uint32(xdrs, &w->c_len)) return (FALSE); if (!xdr_uint64(xdrs, &w->u.c_daddr)) return (FALSE); w = w->c_next; } if (!xdr_bool(xdrs, &vfalse)) return (FALSE); return (TRUE); }
bool_t xdr_readdir3args(XDR *xdrs, readdir3args *objp) { register int32_t *buf; if (!xdr_nfs_fh3(xdrs, &objp->dir)) { return (FALSE); } if (!xdr_uint64(xdrs, &objp->cookie)) { return (FALSE); } if (!xdr_cookieverf3(xdrs, objp->cookieverf)) { return (FALSE); } if (!xdr_uint32(xdrs, &objp->count)) { return (FALSE); } return (TRUE); }
bool_t xdr_encode_reply_wchunk(XDR *xdrs, struct clist *cl_longreply, uint32_t seg_array_len) { int i; bool_t long_reply_exists = TRUE; uint32_t length; uint64 offset; if (seg_array_len > 0) { if (!xdr_bool(xdrs, &long_reply_exists)) return (FALSE); if (!xdr_uint32(xdrs, &seg_array_len)) return (FALSE); for (i = 0; i < seg_array_len; i++) { if (!cl_longreply) return (FALSE); length = cl_longreply->c_len; offset = (uint64) cl_longreply->u.c_daddr; DTRACE_PROBE1( krpc__i__xdr_encode_reply_wchunk_c_len, uint32_t, length); if (!xdr_uint32(xdrs, &cl_longreply->c_dmemhandle.mrc_rmr)) return (FALSE); if (!xdr_uint32(xdrs, &length)) return (FALSE); if (!xdr_uint64(xdrs, &offset)) return (FALSE); cl_longreply = cl_longreply->c_next; } } else { long_reply_exists = FALSE; if (!xdr_bool(xdrs, &long_reply_exists)) return (FALSE); } return (TRUE); }
bool_t xdr_ex_fsinfo3resok(XDR *xdrs, ex_fsinfo3resok *objp) { register int32_t *buf; if (!xdr_ex_post_op_attr(xdrs, &objp->obj_attributes)) { return (FALSE); } if (!xdr_uint32(xdrs, &objp->rtmax)) { return (FALSE); } if (!xdr_uint32(xdrs, &objp->rtpref)) { return (FALSE); } if (!xdr_uint32(xdrs, &objp->rtmult)) { return (FALSE); } if (!xdr_uint32(xdrs, &objp->wtmax)) { return (FALSE); } if (!xdr_uint32(xdrs, &objp->wtpref)) { return (FALSE); } if (!xdr_uint32(xdrs, &objp->wtmult)) { return (FALSE); } if (!xdr_uint32(xdrs, &objp->dtpref)) { return (FALSE); } if (!xdr_uint64(xdrs, &objp->maxfilesize)) { return (FALSE); } if (!xdr_nfstime3(xdrs, &objp->time_delta)) { return (FALSE); } if (!xdr_uint32(xdrs, &objp->properties)) { return (FALSE); } return (TRUE); }
bool_t xdr_write3args(XDR *xdrs, write3args *objp) { register int32_t *buf; if (!xdr_nfs_fh3(xdrs, &objp->file)) { return (FALSE); } if (!xdr_uint64(xdrs, &objp->offset)) { return (FALSE); } if (!xdr_uint32(xdrs, &objp->count)) { return (FALSE); } if (!xdr_stable_how(xdrs, &objp->stable)) { return (FALSE); } if (!xdr_bytes(xdrs, (char **)&objp->data.val, (u_int *)&objp->data.len, ~0)) { return (FALSE); } return (TRUE); }
/* * Server side RDMA WRITE list decode. * XDR context is memory ops */ bool_t xdr_decode_wlist_svc(XDR *xdrs, struct clist **wclp, bool_t *wwl, uint32_t *total_length, CONN *conn) { struct clist *first, *ncl; char *memp; uint32_t num_wclist; uint32_t wcl_length = 0; uint32_t i; bool_t more = FALSE; *wclp = NULL; *wwl = FALSE; *total_length = 0; if (!xdr_bool(xdrs, &more)) { return (FALSE); } if (more == FALSE) { return (TRUE); } *wwl = TRUE; if (!xdr_uint32(xdrs, &num_wclist)) { DTRACE_PROBE(krpc__e__xdrrdma__wlistsvc__listlength); return (FALSE); } first = ncl = clist_alloc(); for (i = 0; i < num_wclist; i++) { if (!xdr_uint32(xdrs, &ncl->c_dmemhandle.mrc_rmr)) goto err_out; if (!xdr_uint32(xdrs, &ncl->c_len)) goto err_out; if (!xdr_uint64(xdrs, &ncl->u.c_daddr)) goto err_out; if (ncl->c_len > MAX_SVC_XFER_SIZE) { DTRACE_PROBE( krpc__e__xdrrdma__wlistsvc__chunklist_toobig); ncl->c_len = MAX_SVC_XFER_SIZE; } DTRACE_PROBE1(krpc__i__xdr_decode_wlist_svc_len, uint_t, ncl->c_len); wcl_length += ncl->c_len; if (i < num_wclist - 1) { ncl->c_next = clist_alloc(); ncl = ncl->c_next; } } if (!xdr_bool(xdrs, &more)) goto err_out; first->rb_longbuf.type = RDMA_LONG_BUFFER; first->rb_longbuf.len = wcl_length > WCL_BUF_LEN ? wcl_length : WCL_BUF_LEN; if (rdma_buf_alloc(conn, &first->rb_longbuf)) { clist_free(first); return (FALSE); } memp = first->rb_longbuf.addr; ncl = first; for (i = 0; i < num_wclist; i++) { ncl->w.c_saddr3 = (caddr_t)memp; memp += ncl->c_len; ncl = ncl->c_next; } *wclp = first; *total_length = wcl_length; return (TRUE); err_out: clist_free(first); return (FALSE); }