Ejemplo n.º 1
0
static bool
svc_rdma_reply(SVCXPRT *xprt, struct svc_req *req, struct rpc_msg *msg)
{
	struct rpc_rdma_cbc *cbc = req->rq_context;
	XDR *xdrs = cbc->holdq.xdrs;
	xdrproc_t proc;
	void *where;
	bool has_args;

	__warnx(TIRPC_DEBUG_FLAG_SVC_RDMA,
		"%s() xprt %p cbc %p outgoing xdr %p\n",
		__func__, xprt, cbc, xdrs);

	if (msg->rm_reply.rp_stat == MSG_ACCEPTED
	 && msg->rm_reply.rp_acpt.ar_stat == SUCCESS) {
	    has_args = TRUE;
	    proc = msg->acpted_rply.ar_results.proc;
	    where = msg->acpted_rply.ar_results.where;
	    msg->acpted_rply.ar_results.proc = (xdrproc_t)xdr_void;
	    msg->acpted_rply.ar_results.where = NULL;
	} else {
	    has_args = FALSE;
	    proc = NULL;
	    where = NULL;
	}

	if (!xdr_rdma_svc_reply(cbc, 0)){
		__warnx(TIRPC_DEBUG_FLAG_SVC_RDMA,
			"%s: xdr_rdma_svc_reply failed (will set dead)",
			__func__);
		return (FALSE);
	}
	xdrs->x_op = XDR_ENCODE;

	if (!xdr_reply_encode(xdrs, msg)) {
		__warnx(TIRPC_DEBUG_FLAG_SVC_RDMA,
			"%s: xdr_reply_encode failed (will set dead)",
			__func__);
		return (FALSE);
	}
	xdr_tail_update(xdrs);

	if (has_args && req->rq_auth
	  && !SVCAUTH_WRAP(req->rq_auth, req, xdrs, proc, where)) {
		__warnx(TIRPC_DEBUG_FLAG_SVC_RDMA,
			"%s: SVCAUTH_WRAP failed (will set dead)",
			__func__);
		return (FALSE);
	}
	xdr_tail_update(xdrs);

	return xdr_rdma_svc_flushout(cbc);
}
Ejemplo n.º 2
0
static u_int
xdrmem_getpos(XDR *xdrs)
{
	/* update the most recent data length, just in case */
	xdr_tail_update(xdrs);

	return ((uintptr_t)xdrs->x_data - (uintptr_t)xdrs->x_v.vio_head);
}
Ejemplo n.º 3
0
static bool
xdrmem_setpos(XDR *xdrs, u_int pos)
{
	uint8_t *future = xdrs->x_v.vio_head + pos;

	/* update the most recent data length, just in case */
	xdr_tail_update(xdrs);

	if (future > xdrs->x_v.vio_wrap)
		return (false);
	xdrs->x_data = future;
	return (true);
}