log_rpc: move log_enable_timestamps definition

This RPC was originally put into the app_rpc library,
but the log_rpc library is a better home for it, since
other log-related RPCs are already there.

Signed-off-by: Jim Harris <james.r.harris@intel.com>
Change-Id: I7ba5ac6cdeb57fb4219244690590c8fabbc3f59a
Reviewed-on: https://review.spdk.io/gerrit/c/spdk/spdk/+/4361
Tested-by: SPDK CI Jenkins <sys_sgci@intel.com>
Reviewed-by: Aleksey Marchuk <alexeymar@mellanox.com>
Reviewed-by: Changpeng Liu <changpeng.liu@intel.com>
Reviewed-by: Ben Walker <benjamin.walker@intel.com>
This commit is contained in:
Jim Harris 2020-09-23 20:53:21 +00:00 committed by Tomasz Zawadzki
parent ee17068b88
commit de0e2297b2
2 changed files with 31 additions and 32 deletions

View File

@ -337,4 +337,35 @@ rpc_log_get_flags(struct spdk_jsonrpc_request *request,
SPDK_RPC_REGISTER("log_get_flags", rpc_log_get_flags, SPDK_RPC_STARTUP | SPDK_RPC_RUNTIME)
SPDK_RPC_REGISTER_ALIAS_DEPRECATED(log_get_flags, get_log_flags)
struct rpc_log_enable_timestamps {
bool enabled;
};
static const struct spdk_json_object_decoder rpc_log_enable_timestamps_decoders[] = {
{"enabled", offsetof(struct rpc_log_enable_timestamps, enabled), spdk_json_decode_bool},
};
static void
rpc_log_enable_timestamps(struct spdk_jsonrpc_request *request,
const struct spdk_json_val *params)
{
struct rpc_log_enable_timestamps req = {};
struct spdk_json_write_ctx *w;
if (spdk_json_decode_object(params, rpc_log_enable_timestamps_decoders,
SPDK_COUNTOF(rpc_log_enable_timestamps_decoders),
&req)) {
SPDK_ERRLOG("spdk_json_decode_object failed\n");
spdk_jsonrpc_send_error_response(request, SPDK_JSONRPC_ERROR_INVALID_PARAMS,
"spdk_json_decode_object failed");
return;
}
spdk_log_enable_timestamps(req.enabled);
w = spdk_jsonrpc_begin_result(request);
spdk_json_write_bool(w, true);
spdk_jsonrpc_end_result(request, w);
}
SPDK_RPC_REGISTER("log_enable_timestamps", rpc_log_enable_timestamps, SPDK_RPC_RUNTIME)
SPDK_LOG_REGISTER_COMPONENT("log_rpc", SPDK_LOG_LOG_RPC)

View File

@ -540,36 +540,4 @@ err:
free(ctx);
}
SPDK_RPC_REGISTER("thread_set_cpumask", rpc_thread_set_cpumask, SPDK_RPC_RUNTIME)
struct rpc_log_enable_timestamps {
bool enabled;
};
static const struct spdk_json_object_decoder rpc_log_enable_timestamps_decoders[] = {
{"enabled", offsetof(struct rpc_log_enable_timestamps, enabled), spdk_json_decode_bool},
};
static void
rpc_log_enable_timestamps(struct spdk_jsonrpc_request *request,
const struct spdk_json_val *params)
{
struct rpc_log_enable_timestamps req = {};
struct spdk_json_write_ctx *w;
if (spdk_json_decode_object(params, rpc_log_enable_timestamps_decoders,
SPDK_COUNTOF(rpc_log_enable_timestamps_decoders),
&req)) {
SPDK_ERRLOG("spdk_json_decode_object failed\n");
spdk_jsonrpc_send_error_response(request, SPDK_JSONRPC_ERROR_INVALID_PARAMS,
"spdk_json_decode_object failed");
return;
}
spdk_log_enable_timestamps(req.enabled);
w = spdk_jsonrpc_begin_result(request);
spdk_json_write_bool(w, true);
spdk_jsonrpc_end_result(request, w);
}
SPDK_RPC_REGISTER("log_enable_timestamps", rpc_log_enable_timestamps, SPDK_RPC_RUNTIME)
SPDK_LOG_REGISTER_COMPONENT("APP_RPC", SPDK_LOG_APP_RPC)