head/sys/rpc/rpc_prot.c
/*
 * given a reply message, fills in the error
 */
given a reply message, fills in the error
given a reply message fills in the error
enum clnt_stat
_seterr_reply(struct rpc_msg *msg, struct rpc_err *error)
{
	enum clnt_stat stat;
	assert(msg != NULL);
	assert(error != NULL);
	switch (msg->rm_reply.rp_stat) {
	case MSG_ACCEPTED:
		if (msg->acpted_rply.ar_stat == SUCCESS) {
			stat = RPC_SUCCESS;
			return (stat);
		}
		stat = accepted(msg->acpted_rply.ar_stat, error);
		break;
	case MSG_DENIED:
		stat = rejected(msg->rjcted_rply.rj_stat, error);
		break;
	default:
		stat = RPC_FAILED;
		error->re_lb.s1 = (int32_t)(msg->rm_reply.rp_stat);
		break;
	}
	error->re_status = stat;
	switch (stat) {
	case RPC_VERSMISMATCH:
		error->re_vers.low = msg->rjcted_rply.rj_vers.low;
		error->re_vers.high = msg->rjcted_rply.rj_vers.high;
		break;
	case RPC_AUTHERROR:
		error->re_why = msg->rjcted_rply.rj_why;
		break;
	case RPC_PROGVERSMISMATCH:
		error->re_vers.low = msg->acpted_rply.ar_vers.low;
		error->re_vers.high = msg->acpted_rply.ar_vers.high;
		break;
	case RPC_FAILED:
	case RPC_SUCCESS:
	case RPC_PROGNOTREGISTERED:
	case RPC_PMAPFAILURE:
	case RPC_UNKNOWNPROTO:
	case RPC_UNKNOWNHOST:
	case RPC_SYSTEMERROR:
	case RPC_CANTDECODEARGS:
	case RPC_PROCUNAVAIL:
	case RPC_PROGUNAVAIL:
	case RPC_TIMEDOUT:
	case RPC_CANTRECV:
	case RPC_CANTSEND:
	case RPC_CANTDECODERES:
	case RPC_CANTENCODEARGS:
	default:
		break;
	}
	return (stat);
}
enum clnt_stat _seterr_reply ( struct rpc_msg * msg , struct rpc_err * error ) { enum clnt_stat stat ; assert ( msg != NULL ) ; assert ( error != NULL ) ; switch ( msg -> rm_reply . rp_stat ) { case MSG_ACCEPTED : if ( msg -> acpted_rply . ar_stat == SUCCESS ) { stat = RPC_SUCCESS ; return ( stat ) ; } stat = accepted ( msg -> acpted_rply . ar_stat , error ) ; break ; case MSG_DENIED : stat = rejected ( msg -> rjcted_rply . rj_stat , error ) ; break ; default : stat = RPC_FAILED ; error -> re_lb . s1 = ( int32_t ) ( msg -> rm_reply . rp_stat ) ; break ; } error -> re_status = stat ; switch ( stat ) { case RPC_VERSMISMATCH : error -> re_vers . low = msg -> rjcted_rply . rj_vers . low ; error -> re_vers . high = msg -> rjcted_rply . rj_vers . high ; break ; case RPC_AUTHERROR : error -> re_why = msg -> rjcted_rply . rj_why ; break ; case RPC_PROGVERSMISMATCH : error -> re_vers . low = msg -> acpted_rply . ar_vers . low ; error -> re_vers . high = msg -> acpted_rply . ar_vers . high ; break ; case RPC_FAILED : case RPC_SUCCESS : case RPC_PROGNOTREGISTERED : case RPC_PMAPFAILURE : case RPC_UNKNOWNPROTO : case RPC_UNKNOWNHOST : case RPC_SYSTEMERROR : case RPC_CANTDECODEARGS : case RPC_PROCUNAVAIL : case RPC_PROGUNAVAIL : case RPC_TIMEDOUT : case RPC_CANTRECV : case RPC_CANTSEND : case RPC_CANTDECODERES : case RPC_CANTENCODEARGS : default : break ; } return ( stat ) ; }
given a reply message, fills in the error
given a reply message fills in the error
/* optimized for normal, SUCCESSful case */