rpc: add function to get the current RPC state

Change-Id: I74e08a4ce5d3073933721011dc5fb8a92a46c184
Signed-off-by: Seth Howell <seth.howell@intel.com>
Reviewed-on: https://review.gerrithub.io/432490
Chandler-Test-Pool: SPDK Automated Test System <sys_sgsw@intel.com>
Tested-by: SPDK CI Jenkins <sys_sgci@intel.com>
Reviewed-by: Ben Walker <benjamin.walker@intel.com>
Reviewed-by: Jim Harris <james.r.harris@intel.com>
This commit is contained in:
Seth Howell 2018-11-08 13:24:10 -07:00 committed by Jim Harris
parent 90b4bd6cf9
commit 9bec452561
3 changed files with 13 additions and 1 deletions

View File

@ -98,6 +98,12 @@ static void __attribute__((constructor)) rpc_register_##func(void) \
*/
void spdk_rpc_set_state(uint32_t state_mask);
/**
* Get the current state of the RPC server.
*
* \return The current state of the RPC server.
*/
uint32_t spdk_rpc_get_state(void);
#ifdef __cplusplus
}

View File

@ -66,6 +66,12 @@ spdk_rpc_set_state(uint32_t state)
g_rpc_state = state;
}
uint32_t
spdk_rpc_get_state(void)
{
return g_rpc_state;
}
static void
spdk_jsonrpc_handler(struct spdk_jsonrpc_request *request,
const struct spdk_json_val *method,

View File

@ -59,7 +59,7 @@ DEFINE_STUB(spdk_env_get_core_count, uint32_t, (void), 1);
DEFINE_STUB_V(spdk_rpc_register_method, (const char *method, spdk_rpc_method_handler func,
uint32_t state_mask));
DEFINE_STUB_V(spdk_rpc_set_state, (uint32_t state));
DEFINE_STUB(spdk_rpc_get_state, uint32_t, (void), SPDK_RPC_RUNTIME);
static void
unittest_usage(void)