lib/event: remove spdk prefix from static functions.
Signed-off-by: Seth Howell <seth.howell@intel.com> Change-Id: I22ea328f19d7cdb766c12c4c15c188963f971226 Reviewed-on: https://review.spdk.io/gerrit/c/spdk/spdk/+/2363 Community-CI: Mellanox Build Bot Reviewed-by: Paul Luse <paul.e.luse@intel.com> Reviewed-by: Aleksey Marchuk <alexeymar@mellanox.com> Reviewed-by: Tomasz Zawadzki <tomasz.zawadzki@intel.com> Tested-by: SPDK CI Jenkins <sys_sgci@intel.com>
This commit is contained in:
parent
3456377b45
commit
a7592dbe13
@ -163,7 +163,7 @@ static const struct option g_cmdline_options[] = {
|
|||||||
"\n" \
|
"\n" \
|
||||||
|
|
||||||
static void
|
static void
|
||||||
spdk_app_config_dump_global_section(FILE *fp)
|
app_config_dump_global_section(FILE *fp)
|
||||||
{
|
{
|
||||||
struct spdk_cpuset *coremask;
|
struct spdk_cpuset *coremask;
|
||||||
|
|
||||||
@ -202,7 +202,7 @@ spdk_app_get_running_config(char **config_str, char *name)
|
|||||||
/* Buffered IO */
|
/* Buffered IO */
|
||||||
setvbuf(fp, vbuf, _IOFBF, BUFSIZ);
|
setvbuf(fp, vbuf, _IOFBF, BUFSIZ);
|
||||||
|
|
||||||
spdk_app_config_dump_global_section(fp);
|
app_config_dump_global_section(fp);
|
||||||
spdk_subsystem_config(fp);
|
spdk_subsystem_config(fp);
|
||||||
|
|
||||||
length = ftell(fp);
|
length = ftell(fp);
|
||||||
@ -251,7 +251,7 @@ __shutdown_signal(int signo)
|
|||||||
}
|
}
|
||||||
|
|
||||||
static int
|
static int
|
||||||
spdk_app_opts_validate(const char *app_opts)
|
app_opts_validate(const char *app_opts)
|
||||||
{
|
{
|
||||||
int i = 0, j;
|
int i = 0, j;
|
||||||
|
|
||||||
@ -292,7 +292,7 @@ spdk_app_opts_init(struct spdk_app_opts *opts)
|
|||||||
}
|
}
|
||||||
|
|
||||||
static int
|
static int
|
||||||
spdk_app_setup_signal_handlers(struct spdk_app_opts *opts)
|
app_setup_signal_handlers(struct spdk_app_opts *opts)
|
||||||
{
|
{
|
||||||
struct sigaction sigact;
|
struct sigaction sigact;
|
||||||
sigset_t sigmask;
|
sigset_t sigmask;
|
||||||
@ -342,7 +342,7 @@ spdk_app_setup_signal_handlers(struct spdk_app_opts *opts)
|
|||||||
}
|
}
|
||||||
|
|
||||||
static void
|
static void
|
||||||
spdk_app_start_application(void)
|
app_start_application(void)
|
||||||
{
|
{
|
||||||
assert(spdk_get_thread() == g_app_thread);
|
assert(spdk_get_thread() == g_app_thread);
|
||||||
|
|
||||||
@ -350,7 +350,7 @@ spdk_app_start_application(void)
|
|||||||
}
|
}
|
||||||
|
|
||||||
static void
|
static void
|
||||||
spdk_app_start_rpc(int rc, void *arg1)
|
app_start_rpc(int rc, void *arg1)
|
||||||
{
|
{
|
||||||
if (rc) {
|
if (rc) {
|
||||||
spdk_app_stop(rc);
|
spdk_app_stop(rc);
|
||||||
@ -360,12 +360,12 @@ spdk_app_start_rpc(int rc, void *arg1)
|
|||||||
spdk_rpc_initialize(g_spdk_app.rpc_addr);
|
spdk_rpc_initialize(g_spdk_app.rpc_addr);
|
||||||
if (!g_delay_subsystem_init) {
|
if (!g_delay_subsystem_init) {
|
||||||
spdk_rpc_set_state(SPDK_RPC_RUNTIME);
|
spdk_rpc_set_state(SPDK_RPC_RUNTIME);
|
||||||
spdk_app_start_application();
|
app_start_application();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
static struct spdk_conf *
|
static struct spdk_conf *
|
||||||
spdk_app_setup_conf(const char *config_file)
|
app_setup_conf(const char *config_file)
|
||||||
{
|
{
|
||||||
struct spdk_conf *config;
|
struct spdk_conf *config;
|
||||||
int rc;
|
int rc;
|
||||||
@ -392,7 +392,7 @@ error:
|
|||||||
}
|
}
|
||||||
|
|
||||||
static int
|
static int
|
||||||
spdk_app_opts_add_pci_addr(struct spdk_app_opts *opts, struct spdk_pci_addr **list, char *bdf)
|
app_opts_add_pci_addr(struct spdk_app_opts *opts, struct spdk_pci_addr **list, char *bdf)
|
||||||
{
|
{
|
||||||
struct spdk_pci_addr *tmp = *list;
|
struct spdk_pci_addr *tmp = *list;
|
||||||
size_t i = opts->num_pci_addr;
|
size_t i = opts->num_pci_addr;
|
||||||
@ -414,7 +414,7 @@ spdk_app_opts_add_pci_addr(struct spdk_app_opts *opts, struct spdk_pci_addr **li
|
|||||||
}
|
}
|
||||||
|
|
||||||
static int
|
static int
|
||||||
spdk_app_read_config_file_global_params(struct spdk_app_opts *opts)
|
app_read_config_file_global_params(struct spdk_app_opts *opts)
|
||||||
{
|
{
|
||||||
struct spdk_conf_section *sp;
|
struct spdk_conf_section *sp;
|
||||||
char *bdf;
|
char *bdf;
|
||||||
@ -458,7 +458,7 @@ spdk_app_read_config_file_global_params(struct spdk_app_opts *opts)
|
|||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
|
||||||
rc = spdk_app_opts_add_pci_addr(opts, &opts->pci_blacklist, bdf);
|
rc = app_opts_add_pci_addr(opts, &opts->pci_blacklist, bdf);
|
||||||
if (rc != 0) {
|
if (rc != 0) {
|
||||||
free(opts->pci_blacklist);
|
free(opts->pci_blacklist);
|
||||||
return rc;
|
return rc;
|
||||||
@ -477,7 +477,7 @@ spdk_app_read_config_file_global_params(struct spdk_app_opts *opts)
|
|||||||
return -EINVAL;
|
return -EINVAL;
|
||||||
}
|
}
|
||||||
|
|
||||||
rc = spdk_app_opts_add_pci_addr(opts, &opts->pci_whitelist, bdf);
|
rc = app_opts_add_pci_addr(opts, &opts->pci_whitelist, bdf);
|
||||||
if (rc != 0) {
|
if (rc != 0) {
|
||||||
free(opts->pci_whitelist);
|
free(opts->pci_whitelist);
|
||||||
return rc;
|
return rc;
|
||||||
@ -487,7 +487,7 @@ spdk_app_read_config_file_global_params(struct spdk_app_opts *opts)
|
|||||||
}
|
}
|
||||||
|
|
||||||
static int
|
static int
|
||||||
spdk_app_setup_env(struct spdk_app_opts *opts)
|
app_setup_env(struct spdk_app_opts *opts)
|
||||||
{
|
{
|
||||||
struct spdk_env_opts env_opts = {};
|
struct spdk_env_opts env_opts = {};
|
||||||
int rc;
|
int rc;
|
||||||
@ -521,7 +521,7 @@ spdk_app_setup_env(struct spdk_app_opts *opts)
|
|||||||
}
|
}
|
||||||
|
|
||||||
static int
|
static int
|
||||||
spdk_app_setup_trace(struct spdk_app_opts *opts)
|
app_setup_trace(struct spdk_app_opts *opts)
|
||||||
{
|
{
|
||||||
char shm_name[64];
|
char shm_name[64];
|
||||||
uint64_t tpoint_group_mask;
|
uint64_t tpoint_group_mask;
|
||||||
@ -563,11 +563,11 @@ bootstrap_fn(void *arg1)
|
|||||||
{
|
{
|
||||||
if (g_spdk_app.json_config_file) {
|
if (g_spdk_app.json_config_file) {
|
||||||
g_delay_subsystem_init = false;
|
g_delay_subsystem_init = false;
|
||||||
spdk_app_json_config_load(g_spdk_app.json_config_file, g_spdk_app.rpc_addr, spdk_app_start_rpc,
|
spdk_app_json_config_load(g_spdk_app.json_config_file, g_spdk_app.rpc_addr, app_start_rpc,
|
||||||
NULL, !g_spdk_app.json_config_ignore_errors);
|
NULL, !g_spdk_app.json_config_ignore_errors);
|
||||||
} else {
|
} else {
|
||||||
if (!g_delay_subsystem_init) {
|
if (!g_delay_subsystem_init) {
|
||||||
spdk_subsystem_init(spdk_app_start_rpc, NULL);
|
spdk_subsystem_init(app_start_rpc, NULL);
|
||||||
} else {
|
} else {
|
||||||
spdk_rpc_initialize(g_spdk_app.rpc_addr);
|
spdk_rpc_initialize(g_spdk_app.rpc_addr);
|
||||||
}
|
}
|
||||||
@ -616,12 +616,12 @@ spdk_app_start(struct spdk_app_opts *opts, spdk_msg_fn start_fn,
|
|||||||
}
|
}
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
config = spdk_app_setup_conf(opts->config_file);
|
config = app_setup_conf(opts->config_file);
|
||||||
if (config == NULL) {
|
if (config == NULL) {
|
||||||
return 1;
|
return 1;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (spdk_app_read_config_file_global_params(opts) < 0) {
|
if (app_read_config_file_global_params(opts) < 0) {
|
||||||
spdk_conf_free(config);
|
spdk_conf_free(config);
|
||||||
return 1;
|
return 1;
|
||||||
}
|
}
|
||||||
@ -638,7 +638,7 @@ spdk_app_start(struct spdk_app_opts *opts, spdk_msg_fn start_fn,
|
|||||||
spdk_log_set_level(SPDK_APP_DEFAULT_LOG_LEVEL);
|
spdk_log_set_level(SPDK_APP_DEFAULT_LOG_LEVEL);
|
||||||
spdk_log_set_backtrace_level(SPDK_APP_DEFAULT_BACKTRACE_LOG_LEVEL);
|
spdk_log_set_backtrace_level(SPDK_APP_DEFAULT_BACKTRACE_LOG_LEVEL);
|
||||||
|
|
||||||
if (spdk_app_setup_env(opts) < 0) {
|
if (app_setup_env(opts) < 0) {
|
||||||
return 1;
|
return 1;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -666,17 +666,17 @@ spdk_app_start(struct spdk_app_opts *opts, spdk_msg_fn start_fn,
|
|||||||
}
|
}
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* Note the call to spdk_app_setup_trace() is located here
|
* Note the call to app_setup_trace() is located here
|
||||||
* ahead of spdk_app_setup_signal_handlers().
|
* ahead of app_setup_signal_handlers().
|
||||||
* That's because there is not an easy/direct clean
|
* That's because there is not an easy/direct clean
|
||||||
* way of unwinding alloc'd resources that can occur
|
* way of unwinding alloc'd resources that can occur
|
||||||
* in spdk_app_setup_signal_handlers().
|
* in app_setup_signal_handlers().
|
||||||
*/
|
*/
|
||||||
if (spdk_app_setup_trace(opts) != 0) {
|
if (app_setup_trace(opts) != 0) {
|
||||||
return 1;
|
return 1;
|
||||||
}
|
}
|
||||||
|
|
||||||
if ((rc = spdk_app_setup_signal_handlers(opts)) != 0) {
|
if ((rc = app_setup_signal_handlers(opts)) != 0) {
|
||||||
return 1;
|
return 1;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -819,7 +819,7 @@ spdk_app_parse_args(int argc, char **argv, struct spdk_app_opts *opts,
|
|||||||
}
|
}
|
||||||
|
|
||||||
if (app_getopt_str != NULL) {
|
if (app_getopt_str != NULL) {
|
||||||
ch = spdk_app_opts_validate(app_getopt_str);
|
ch = app_opts_validate(app_getopt_str);
|
||||||
if (ch) {
|
if (ch) {
|
||||||
SPDK_ERRLOG("Duplicated option '%c' between the generic and application specific spdk opts.\n",
|
SPDK_ERRLOG("Duplicated option '%c' between the generic and application specific spdk opts.\n",
|
||||||
ch);
|
ch);
|
||||||
@ -931,7 +931,7 @@ spdk_app_parse_args(int argc, char **argv, struct spdk_app_opts *opts,
|
|||||||
goto out;
|
goto out;
|
||||||
}
|
}
|
||||||
|
|
||||||
rc = spdk_app_opts_add_pci_addr(opts, &opts->pci_blacklist, optarg);
|
rc = app_opts_add_pci_addr(opts, &opts->pci_blacklist, optarg);
|
||||||
if (rc != 0) {
|
if (rc != 0) {
|
||||||
free(opts->pci_blacklist);
|
free(opts->pci_blacklist);
|
||||||
opts->pci_blacklist = NULL;
|
opts->pci_blacklist = NULL;
|
||||||
@ -966,7 +966,7 @@ spdk_app_parse_args(int argc, char **argv, struct spdk_app_opts *opts,
|
|||||||
goto out;
|
goto out;
|
||||||
}
|
}
|
||||||
|
|
||||||
rc = spdk_app_opts_add_pci_addr(opts, &opts->pci_whitelist, optarg);
|
rc = app_opts_add_pci_addr(opts, &opts->pci_whitelist, optarg);
|
||||||
if (rc != 0) {
|
if (rc != 0) {
|
||||||
free(opts->pci_whitelist);
|
free(opts->pci_whitelist);
|
||||||
opts->pci_whitelist = NULL;
|
opts->pci_whitelist = NULL;
|
||||||
@ -1056,7 +1056,7 @@ spdk_app_usage(void)
|
|||||||
}
|
}
|
||||||
|
|
||||||
static void
|
static void
|
||||||
spdk_rpc_framework_start_init_cpl(int rc, void *arg1)
|
rpc_framework_start_init_cpl(int rc, void *arg1)
|
||||||
{
|
{
|
||||||
struct spdk_jsonrpc_request *request = arg1;
|
struct spdk_jsonrpc_request *request = arg1;
|
||||||
struct spdk_json_write_ctx *w;
|
struct spdk_json_write_ctx *w;
|
||||||
@ -1070,7 +1070,7 @@ spdk_rpc_framework_start_init_cpl(int rc, void *arg1)
|
|||||||
}
|
}
|
||||||
|
|
||||||
spdk_rpc_set_state(SPDK_RPC_RUNTIME);
|
spdk_rpc_set_state(SPDK_RPC_RUNTIME);
|
||||||
spdk_app_start_application();
|
app_start_application();
|
||||||
|
|
||||||
w = spdk_jsonrpc_begin_result(request);
|
w = spdk_jsonrpc_begin_result(request);
|
||||||
spdk_json_write_bool(w, true);
|
spdk_json_write_bool(w, true);
|
||||||
@ -1078,7 +1078,7 @@ spdk_rpc_framework_start_init_cpl(int rc, void *arg1)
|
|||||||
}
|
}
|
||||||
|
|
||||||
static void
|
static void
|
||||||
spdk_rpc_framework_start_init(struct spdk_jsonrpc_request *request,
|
rpc_framework_start_init(struct spdk_jsonrpc_request *request,
|
||||||
const struct spdk_json_val *params)
|
const struct spdk_json_val *params)
|
||||||
{
|
{
|
||||||
if (params != NULL) {
|
if (params != NULL) {
|
||||||
@ -1087,9 +1087,9 @@ spdk_rpc_framework_start_init(struct spdk_jsonrpc_request *request,
|
|||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
spdk_subsystem_init(spdk_rpc_framework_start_init_cpl, request);
|
spdk_subsystem_init(rpc_framework_start_init_cpl, request);
|
||||||
}
|
}
|
||||||
SPDK_RPC_REGISTER("framework_start_init", spdk_rpc_framework_start_init, SPDK_RPC_STARTUP)
|
SPDK_RPC_REGISTER("framework_start_init", rpc_framework_start_init, SPDK_RPC_STARTUP)
|
||||||
SPDK_RPC_REGISTER_ALIAS_DEPRECATED(framework_start_init, start_subsystem_init)
|
SPDK_RPC_REGISTER_ALIAS_DEPRECATED(framework_start_init, start_subsystem_init)
|
||||||
|
|
||||||
struct subsystem_init_poller_ctx {
|
struct subsystem_init_poller_ctx {
|
||||||
@ -1098,7 +1098,7 @@ struct subsystem_init_poller_ctx {
|
|||||||
};
|
};
|
||||||
|
|
||||||
static int
|
static int
|
||||||
spdk_rpc_subsystem_init_poller_ctx(void *ctx)
|
rpc_subsystem_init_poller_ctx(void *ctx)
|
||||||
{
|
{
|
||||||
struct spdk_json_write_ctx *w;
|
struct spdk_json_write_ctx *w;
|
||||||
struct subsystem_init_poller_ctx *poller_ctx = ctx;
|
struct subsystem_init_poller_ctx *poller_ctx = ctx;
|
||||||
@ -1115,7 +1115,7 @@ spdk_rpc_subsystem_init_poller_ctx(void *ctx)
|
|||||||
}
|
}
|
||||||
|
|
||||||
static void
|
static void
|
||||||
spdk_rpc_framework_wait_init(struct spdk_jsonrpc_request *request,
|
rpc_framework_wait_init(struct spdk_jsonrpc_request *request,
|
||||||
const struct spdk_json_val *params)
|
const struct spdk_json_val *params)
|
||||||
{
|
{
|
||||||
struct spdk_json_write_ctx *w;
|
struct spdk_json_write_ctx *w;
|
||||||
@ -1133,9 +1133,9 @@ spdk_rpc_framework_wait_init(struct spdk_jsonrpc_request *request,
|
|||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
ctx->request = request;
|
ctx->request = request;
|
||||||
ctx->init_poller = SPDK_POLLER_REGISTER(spdk_rpc_subsystem_init_poller_ctx, ctx, 0);
|
ctx->init_poller = SPDK_POLLER_REGISTER(rpc_subsystem_init_poller_ctx, ctx, 0);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
SPDK_RPC_REGISTER("framework_wait_init", spdk_rpc_framework_wait_init,
|
SPDK_RPC_REGISTER("framework_wait_init", rpc_framework_wait_init,
|
||||||
SPDK_RPC_STARTUP | SPDK_RPC_RUNTIME)
|
SPDK_RPC_STARTUP | SPDK_RPC_RUNTIME)
|
||||||
SPDK_RPC_REGISTER_ALIAS_DEPRECATED(framework_wait_init, wait_subsystem_init)
|
SPDK_RPC_REGISTER_ALIAS_DEPRECATED(framework_wait_init, wait_subsystem_init)
|
||||||
|
@ -121,10 +121,10 @@ struct load_json_config_ctx {
|
|||||||
uint64_t timeout;
|
uint64_t timeout;
|
||||||
};
|
};
|
||||||
|
|
||||||
static void spdk_app_json_config_load_subsystem(void *_ctx);
|
static void app_json_config_load_subsystem(void *_ctx);
|
||||||
|
|
||||||
static void
|
static void
|
||||||
spdk_app_json_config_load_done(struct load_json_config_ctx *ctx, int rc)
|
app_json_config_load_done(struct load_json_config_ctx *ctx, int rc)
|
||||||
{
|
{
|
||||||
spdk_poller_unregister(&ctx->client_conn_poller);
|
spdk_poller_unregister(&ctx->client_conn_poller);
|
||||||
if (ctx->client_conn != NULL) {
|
if (ctx->client_conn != NULL) {
|
||||||
@ -181,7 +181,7 @@ rpc_client_poller(void *arg)
|
|||||||
/* No response yet */
|
/* No response yet */
|
||||||
return -1;
|
return -1;
|
||||||
} else if (rc < 0) {
|
} else if (rc < 0) {
|
||||||
spdk_app_json_config_load_done(ctx, rc);
|
app_json_config_load_done(ctx, rc);
|
||||||
return -1;
|
return -1;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -194,7 +194,7 @@ rpc_client_poller(void *arg)
|
|||||||
|
|
||||||
if (resp->error && ctx->stop_on_error) {
|
if (resp->error && ctx->stop_on_error) {
|
||||||
spdk_jsonrpc_client_free_response(resp);
|
spdk_jsonrpc_client_free_response(resp);
|
||||||
spdk_app_json_config_load_done(ctx, -EINVAL);
|
app_json_config_load_done(ctx, -EINVAL);
|
||||||
} else {
|
} else {
|
||||||
/* We have response so we must have callback for it. */
|
/* We have response so we must have callback for it. */
|
||||||
cb = ctx->client_resp_cb;
|
cb = ctx->client_resp_cb;
|
||||||
@ -220,11 +220,11 @@ rpc_client_connect_poller(void *_ctx)
|
|||||||
/* We are connected. Start regular poller and issue first request */
|
/* We are connected. Start regular poller and issue first request */
|
||||||
spdk_poller_unregister(&ctx->client_conn_poller);
|
spdk_poller_unregister(&ctx->client_conn_poller);
|
||||||
ctx->client_conn_poller = SPDK_POLLER_REGISTER(rpc_client_poller, ctx, 100);
|
ctx->client_conn_poller = SPDK_POLLER_REGISTER(rpc_client_poller, ctx, 100);
|
||||||
spdk_app_json_config_load_subsystem(ctx);
|
app_json_config_load_subsystem(ctx);
|
||||||
} else {
|
} else {
|
||||||
rc = rpc_client_check_timeout(ctx);
|
rc = rpc_client_check_timeout(ctx);
|
||||||
if (rc) {
|
if (rc) {
|
||||||
spdk_app_json_config_load_done(ctx, rc);
|
app_json_config_load_done(ctx, rc);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -300,22 +300,22 @@ static struct spdk_json_object_decoder jsonrpc_cmd_decoders[] = {
|
|||||||
{"params", offsetof(struct config_entry, params), cap_object, true}
|
{"params", offsetof(struct config_entry, params), cap_object, true}
|
||||||
};
|
};
|
||||||
|
|
||||||
static void spdk_app_json_config_load_subsystem_config_entry(void *_ctx);
|
static void app_json_config_load_subsystem_config_entry(void *_ctx);
|
||||||
|
|
||||||
static void
|
static void
|
||||||
spdk_app_json_config_load_subsystem_config_entry_next(struct load_json_config_ctx *ctx,
|
app_json_config_load_subsystem_config_entry_next(struct load_json_config_ctx *ctx,
|
||||||
struct spdk_jsonrpc_client_response *resp)
|
struct spdk_jsonrpc_client_response *resp)
|
||||||
{
|
{
|
||||||
/* Don't care about the response */
|
/* Don't care about the response */
|
||||||
spdk_jsonrpc_client_free_response(resp);
|
spdk_jsonrpc_client_free_response(resp);
|
||||||
|
|
||||||
ctx->config_it = spdk_json_next(ctx->config_it);
|
ctx->config_it = spdk_json_next(ctx->config_it);
|
||||||
spdk_app_json_config_load_subsystem_config_entry(ctx);
|
app_json_config_load_subsystem_config_entry(ctx);
|
||||||
}
|
}
|
||||||
|
|
||||||
/* Load "config" entry */
|
/* Load "config" entry */
|
||||||
static void
|
static void
|
||||||
spdk_app_json_config_load_subsystem_config_entry(void *_ctx)
|
app_json_config_load_subsystem_config_entry(void *_ctx)
|
||||||
{
|
{
|
||||||
struct load_json_config_ctx *ctx = _ctx;
|
struct load_json_config_ctx *ctx = _ctx;
|
||||||
struct spdk_jsonrpc_client_request *rpc_request;
|
struct spdk_jsonrpc_client_request *rpc_request;
|
||||||
@ -330,7 +330,7 @@ spdk_app_json_config_load_subsystem_config_entry(void *_ctx)
|
|||||||
(char *)ctx->subsystem_name->start);
|
(char *)ctx->subsystem_name->start);
|
||||||
ctx->subsystems_it = spdk_json_next(ctx->subsystems_it);
|
ctx->subsystems_it = spdk_json_next(ctx->subsystems_it);
|
||||||
/* Invoke later to avoid recurrency */
|
/* Invoke later to avoid recurrency */
|
||||||
spdk_thread_send_msg(ctx->thread, spdk_app_json_config_load_subsystem, ctx);
|
spdk_thread_send_msg(ctx->thread, app_json_config_load_subsystem, ctx);
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -340,7 +340,7 @@ spdk_app_json_config_load_subsystem_config_entry(void *_ctx)
|
|||||||
assert(params_end != NULL);
|
assert(params_end != NULL);
|
||||||
params_len = params_end->start - ctx->config->start + 1;
|
params_len = params_end->start - ctx->config->start + 1;
|
||||||
SPDK_ERRLOG("Failed to decode config entry: %.*s!\n", (int)params_len, (char *)ctx->config_it);
|
SPDK_ERRLOG("Failed to decode config entry: %.*s!\n", (int)params_len, (char *)ctx->config_it);
|
||||||
spdk_app_json_config_load_done(ctx, -EINVAL);
|
app_json_config_load_done(ctx, -EINVAL);
|
||||||
goto out;
|
goto out;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -349,7 +349,7 @@ spdk_app_json_config_load_subsystem_config_entry(void *_ctx)
|
|||||||
SPDK_DEBUG_APP_CFG("Method '%s' not allowed -> skipping\n", cfg.method);
|
SPDK_DEBUG_APP_CFG("Method '%s' not allowed -> skipping\n", cfg.method);
|
||||||
/* Invoke later to avoid recurrency */
|
/* Invoke later to avoid recurrency */
|
||||||
ctx->config_it = spdk_json_next(ctx->config_it);
|
ctx->config_it = spdk_json_next(ctx->config_it);
|
||||||
spdk_thread_send_msg(ctx->thread, spdk_app_json_config_load_subsystem_config_entry, ctx);
|
spdk_thread_send_msg(ctx->thread, app_json_config_load_subsystem_config_entry, ctx);
|
||||||
goto out;
|
goto out;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -364,14 +364,14 @@ spdk_app_json_config_load_subsystem_config_entry(void *_ctx)
|
|||||||
|
|
||||||
rpc_request = spdk_jsonrpc_client_create_request();
|
rpc_request = spdk_jsonrpc_client_create_request();
|
||||||
if (!rpc_request) {
|
if (!rpc_request) {
|
||||||
spdk_app_json_config_load_done(ctx, -errno);
|
app_json_config_load_done(ctx, -errno);
|
||||||
goto out;
|
goto out;
|
||||||
}
|
}
|
||||||
|
|
||||||
w = spdk_jsonrpc_begin_request(rpc_request, ctx->rpc_request_id, NULL);
|
w = spdk_jsonrpc_begin_request(rpc_request, ctx->rpc_request_id, NULL);
|
||||||
if (!w) {
|
if (!w) {
|
||||||
spdk_jsonrpc_client_free_request(rpc_request);
|
spdk_jsonrpc_client_free_request(rpc_request);
|
||||||
spdk_app_json_config_load_done(ctx, -ENOMEM);
|
app_json_config_load_done(ctx, -ENOMEM);
|
||||||
goto out;
|
goto out;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -383,9 +383,9 @@ spdk_app_json_config_load_subsystem_config_entry(void *_ctx)
|
|||||||
spdk_json_write_val_raw(w, cfg.params->start, params_len);
|
spdk_json_write_val_raw(w, cfg.params->start, params_len);
|
||||||
spdk_jsonrpc_end_request(rpc_request, w);
|
spdk_jsonrpc_end_request(rpc_request, w);
|
||||||
|
|
||||||
rc = client_send_request(ctx, rpc_request, spdk_app_json_config_load_subsystem_config_entry_next);
|
rc = client_send_request(ctx, rpc_request, app_json_config_load_subsystem_config_entry_next);
|
||||||
if (rc != 0) {
|
if (rc != 0) {
|
||||||
spdk_app_json_config_load_done(ctx, -rc);
|
app_json_config_load_done(ctx, -rc);
|
||||||
goto out;
|
goto out;
|
||||||
}
|
}
|
||||||
out:
|
out:
|
||||||
@ -398,7 +398,7 @@ subsystem_init_done(int rc, void *arg1)
|
|||||||
struct load_json_config_ctx *ctx = arg1;
|
struct load_json_config_ctx *ctx = arg1;
|
||||||
|
|
||||||
if (rc) {
|
if (rc) {
|
||||||
spdk_app_json_config_load_done(ctx, rc);
|
app_json_config_load_done(ctx, rc);
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -411,7 +411,7 @@ subsystem_init_done(int rc, void *arg1)
|
|||||||
ctx->subsystems_it = spdk_json_array_first(ctx->subsystems);
|
ctx->subsystems_it = spdk_json_array_first(ctx->subsystems);
|
||||||
}
|
}
|
||||||
|
|
||||||
spdk_app_json_config_load_subsystem(ctx);
|
app_json_config_load_subsystem(ctx);
|
||||||
}
|
}
|
||||||
|
|
||||||
static struct spdk_json_object_decoder subsystem_decoders[] = {
|
static struct spdk_json_object_decoder subsystem_decoders[] = {
|
||||||
@ -437,7 +437,7 @@ static struct spdk_json_object_decoder subsystem_decoders[] = {
|
|||||||
* configuration.
|
* configuration.
|
||||||
*/
|
*/
|
||||||
static void
|
static void
|
||||||
spdk_app_json_config_load_subsystem(void *_ctx)
|
app_json_config_load_subsystem(void *_ctx)
|
||||||
{
|
{
|
||||||
struct load_json_config_ctx *ctx = _ctx;
|
struct load_json_config_ctx *ctx = _ctx;
|
||||||
|
|
||||||
@ -446,7 +446,7 @@ spdk_app_json_config_load_subsystem(void *_ctx)
|
|||||||
SPDK_DEBUG_APP_CFG("No more entries for current state, calling 'framework_start_init'\n");
|
SPDK_DEBUG_APP_CFG("No more entries for current state, calling 'framework_start_init'\n");
|
||||||
spdk_subsystem_init(subsystem_init_done, ctx);
|
spdk_subsystem_init(subsystem_init_done, ctx);
|
||||||
} else {
|
} else {
|
||||||
spdk_app_json_config_load_done(ctx, 0);
|
app_json_config_load_done(ctx, 0);
|
||||||
}
|
}
|
||||||
|
|
||||||
return;
|
return;
|
||||||
@ -456,7 +456,7 @@ spdk_app_json_config_load_subsystem(void *_ctx)
|
|||||||
if (spdk_json_decode_object(ctx->subsystems_it, subsystem_decoders,
|
if (spdk_json_decode_object(ctx->subsystems_it, subsystem_decoders,
|
||||||
SPDK_COUNTOF(subsystem_decoders), ctx)) {
|
SPDK_COUNTOF(subsystem_decoders), ctx)) {
|
||||||
SPDK_ERRLOG("Failed to parse subsystem configuration\n");
|
SPDK_ERRLOG("Failed to parse subsystem configuration\n");
|
||||||
spdk_app_json_config_load_done(ctx, -EINVAL);
|
app_json_config_load_done(ctx, -EINVAL);
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -465,7 +465,7 @@ spdk_app_json_config_load_subsystem(void *_ctx)
|
|||||||
|
|
||||||
/* Get 'config' array first configuration entry */
|
/* Get 'config' array first configuration entry */
|
||||||
ctx->config_it = spdk_json_array_first(ctx->config);
|
ctx->config_it = spdk_json_array_first(ctx->config);
|
||||||
spdk_app_json_config_load_subsystem_config_entry(ctx);
|
app_json_config_load_subsystem_config_entry(ctx);
|
||||||
}
|
}
|
||||||
|
|
||||||
static void *
|
static void *
|
||||||
@ -485,7 +485,7 @@ read_file(const char *filename, size_t *size)
|
|||||||
}
|
}
|
||||||
|
|
||||||
static int
|
static int
|
||||||
spdk_app_json_config_read(const char *config_file, struct load_json_config_ctx *ctx)
|
app_json_config_read(const char *config_file, struct load_json_config_ctx *ctx)
|
||||||
{
|
{
|
||||||
struct spdk_json_val *values = NULL;
|
struct spdk_json_val *values = NULL;
|
||||||
void *json = NULL, *end;
|
void *json = NULL, *end;
|
||||||
@ -550,7 +550,7 @@ spdk_app_json_config_load(const char *json_config_file, const char *rpc_addr,
|
|||||||
ctx->stop_on_error = stop_on_error;
|
ctx->stop_on_error = stop_on_error;
|
||||||
ctx->thread = spdk_get_thread();
|
ctx->thread = spdk_get_thread();
|
||||||
|
|
||||||
rc = spdk_app_json_config_read(json_config_file, ctx);
|
rc = app_json_config_read(json_config_file, ctx);
|
||||||
if (rc) {
|
if (rc) {
|
||||||
goto fail;
|
goto fail;
|
||||||
}
|
}
|
||||||
@ -593,7 +593,7 @@ spdk_app_json_config_load(const char *json_config_file, const char *rpc_addr,
|
|||||||
return;
|
return;
|
||||||
|
|
||||||
fail:
|
fail:
|
||||||
spdk_app_json_config_load_done(ctx, -EINVAL);
|
app_json_config_load_done(ctx, -EINVAL);
|
||||||
}
|
}
|
||||||
|
|
||||||
SPDK_LOG_REGISTER_COMPONENT("app_config", SPDK_LOG_APP_CONFIG)
|
SPDK_LOG_REGISTER_COMPONENT("app_config", SPDK_LOG_APP_CONFIG)
|
||||||
|
@ -62,7 +62,7 @@ static bool g_framework_context_switch_monitor_enabled = true;
|
|||||||
static struct spdk_mempool *g_spdk_event_mempool = NULL;
|
static struct spdk_mempool *g_spdk_event_mempool = NULL;
|
||||||
|
|
||||||
static void
|
static void
|
||||||
spdk_reactor_construct(struct spdk_reactor *reactor, uint32_t lcore)
|
reactor_construct(struct spdk_reactor *reactor, uint32_t lcore)
|
||||||
{
|
{
|
||||||
reactor->lcore = lcore;
|
reactor->lcore = lcore;
|
||||||
reactor->flags.is_valid = true;
|
reactor->flags.is_valid = true;
|
||||||
@ -93,8 +93,8 @@ spdk_reactor_get(uint32_t lcore)
|
|||||||
return reactor;
|
return reactor;
|
||||||
}
|
}
|
||||||
|
|
||||||
static int spdk_reactor_thread_op(struct spdk_thread *thread, enum spdk_thread_op op);
|
static int reactor_thread_op(struct spdk_thread *thread, enum spdk_thread_op op);
|
||||||
static bool spdk_reactor_thread_op_supported(enum spdk_thread_op op);
|
static bool reactor_thread_op_supported(enum spdk_thread_op op);
|
||||||
|
|
||||||
int
|
int
|
||||||
spdk_reactors_init(void)
|
spdk_reactors_init(void)
|
||||||
@ -128,11 +128,11 @@ spdk_reactors_init(void)
|
|||||||
|
|
||||||
memset(g_reactors, 0, (last_core + 1) * sizeof(struct spdk_reactor));
|
memset(g_reactors, 0, (last_core + 1) * sizeof(struct spdk_reactor));
|
||||||
|
|
||||||
spdk_thread_lib_init_ext(spdk_reactor_thread_op, spdk_reactor_thread_op_supported,
|
spdk_thread_lib_init_ext(reactor_thread_op, reactor_thread_op_supported,
|
||||||
sizeof(struct spdk_lw_thread));
|
sizeof(struct spdk_lw_thread));
|
||||||
|
|
||||||
SPDK_ENV_FOREACH_CORE(i) {
|
SPDK_ENV_FOREACH_CORE(i) {
|
||||||
spdk_reactor_construct(&g_reactors[i], i);
|
reactor_construct(&g_reactors[i], i);
|
||||||
}
|
}
|
||||||
|
|
||||||
g_reactor_state = SPDK_REACTOR_STATE_INITIALIZED;
|
g_reactor_state = SPDK_REACTOR_STATE_INITIALIZED;
|
||||||
@ -573,7 +573,7 @@ _reactor_request_thread_reschedule(struct spdk_thread *thread)
|
|||||||
}
|
}
|
||||||
|
|
||||||
static int
|
static int
|
||||||
spdk_reactor_thread_op(struct spdk_thread *thread, enum spdk_thread_op op)
|
reactor_thread_op(struct spdk_thread *thread, enum spdk_thread_op op)
|
||||||
{
|
{
|
||||||
switch (op) {
|
switch (op) {
|
||||||
case SPDK_THREAD_OP_NEW:
|
case SPDK_THREAD_OP_NEW:
|
||||||
@ -587,7 +587,7 @@ spdk_reactor_thread_op(struct spdk_thread *thread, enum spdk_thread_op op)
|
|||||||
}
|
}
|
||||||
|
|
||||||
static bool
|
static bool
|
||||||
spdk_reactor_thread_op_supported(enum spdk_thread_op op)
|
reactor_thread_op_supported(enum spdk_thread_op op)
|
||||||
{
|
{
|
||||||
switch (op) {
|
switch (op) {
|
||||||
case SPDK_THREAD_OP_NEW:
|
case SPDK_THREAD_OP_NEW:
|
||||||
@ -609,7 +609,7 @@ struct call_reactor {
|
|||||||
};
|
};
|
||||||
|
|
||||||
static void
|
static void
|
||||||
spdk_on_reactor(void *arg1, void *arg2)
|
on_reactor(void *arg1, void *arg2)
|
||||||
{
|
{
|
||||||
struct call_reactor *cr = arg1;
|
struct call_reactor *cr = arg1;
|
||||||
struct spdk_event *evt;
|
struct spdk_event *evt;
|
||||||
@ -627,7 +627,7 @@ spdk_on_reactor(void *arg1, void *arg2)
|
|||||||
SPDK_DEBUGLOG(SPDK_LOG_REACTOR, "Continuing reactor iteration to %d\n",
|
SPDK_DEBUGLOG(SPDK_LOG_REACTOR, "Continuing reactor iteration to %d\n",
|
||||||
cr->cur_core);
|
cr->cur_core);
|
||||||
|
|
||||||
evt = spdk_event_allocate(cr->cur_core, spdk_on_reactor, arg1, NULL);
|
evt = spdk_event_allocate(cr->cur_core, on_reactor, arg1, NULL);
|
||||||
}
|
}
|
||||||
assert(evt != NULL);
|
assert(evt != NULL);
|
||||||
spdk_event_call(evt);
|
spdk_event_call(evt);
|
||||||
@ -655,7 +655,7 @@ spdk_for_each_reactor(spdk_event_fn fn, void *arg1, void *arg2, spdk_event_fn cp
|
|||||||
|
|
||||||
SPDK_DEBUGLOG(SPDK_LOG_REACTOR, "Starting reactor iteration from %d\n", cr->orig_core);
|
SPDK_DEBUGLOG(SPDK_LOG_REACTOR, "Starting reactor iteration from %d\n", cr->orig_core);
|
||||||
|
|
||||||
evt = spdk_event_allocate(cr->cur_core, spdk_on_reactor, cr, NULL);
|
evt = spdk_event_allocate(cr->cur_core, on_reactor, cr, NULL);
|
||||||
assert(evt != NULL);
|
assert(evt != NULL);
|
||||||
|
|
||||||
spdk_event_call(evt);
|
spdk_event_call(evt);
|
||||||
|
@ -46,7 +46,7 @@
|
|||||||
static struct spdk_poller *g_rpc_poller = NULL;
|
static struct spdk_poller *g_rpc_poller = NULL;
|
||||||
|
|
||||||
static int
|
static int
|
||||||
spdk_rpc_subsystem_poll(void *arg)
|
rpc_subsystem_poll(void *arg)
|
||||||
{
|
{
|
||||||
spdk_rpc_accept();
|
spdk_rpc_accept();
|
||||||
return -1;
|
return -1;
|
||||||
@ -76,7 +76,7 @@ spdk_rpc_initialize(const char *listen_addr)
|
|||||||
spdk_rpc_set_state(SPDK_RPC_STARTUP);
|
spdk_rpc_set_state(SPDK_RPC_STARTUP);
|
||||||
|
|
||||||
/* Register a poller to periodically check for RPCs */
|
/* Register a poller to periodically check for RPCs */
|
||||||
g_rpc_poller = SPDK_POLLER_REGISTER(spdk_rpc_subsystem_poll, NULL, RPC_SELECT_INTERVAL);
|
g_rpc_poller = SPDK_POLLER_REGISTER(rpc_subsystem_poll, NULL, RPC_SELECT_INTERVAL);
|
||||||
}
|
}
|
||||||
|
|
||||||
void
|
void
|
||||||
|
@ -44,7 +44,7 @@ test_create_reactor(void)
|
|||||||
|
|
||||||
g_reactors = &reactor;
|
g_reactors = &reactor;
|
||||||
|
|
||||||
spdk_reactor_construct(&reactor, 0);
|
reactor_construct(&reactor, 0);
|
||||||
|
|
||||||
CU_ASSERT(spdk_reactor_get(0) == &reactor);
|
CU_ASSERT(spdk_reactor_get(0) == &reactor);
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user