diff --git a/lib/event/app.c b/lib/event/app.c index b0bb5fb46..5cdd33e1e 100644 --- a/lib/event/app.c +++ b/lib/event/app.c @@ -163,7 +163,7 @@ static const struct option g_cmdline_options[] = { "\n" \ static void -spdk_app_config_dump_global_section(FILE *fp) +app_config_dump_global_section(FILE *fp) { struct spdk_cpuset *coremask; @@ -202,7 +202,7 @@ spdk_app_get_running_config(char **config_str, char *name) /* Buffered IO */ setvbuf(fp, vbuf, _IOFBF, BUFSIZ); - spdk_app_config_dump_global_section(fp); + app_config_dump_global_section(fp); spdk_subsystem_config(fp); length = ftell(fp); @@ -251,7 +251,7 @@ __shutdown_signal(int signo) } static int -spdk_app_opts_validate(const char *app_opts) +app_opts_validate(const char *app_opts) { int i = 0, j; @@ -292,7 +292,7 @@ spdk_app_opts_init(struct spdk_app_opts *opts) } static int -spdk_app_setup_signal_handlers(struct spdk_app_opts *opts) +app_setup_signal_handlers(struct spdk_app_opts *opts) { struct sigaction sigact; sigset_t sigmask; @@ -342,7 +342,7 @@ spdk_app_setup_signal_handlers(struct spdk_app_opts *opts) } static void -spdk_app_start_application(void) +app_start_application(void) { assert(spdk_get_thread() == g_app_thread); @@ -350,7 +350,7 @@ spdk_app_start_application(void) } static void -spdk_app_start_rpc(int rc, void *arg1) +app_start_rpc(int rc, void *arg1) { if (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); if (!g_delay_subsystem_init) { spdk_rpc_set_state(SPDK_RPC_RUNTIME); - spdk_app_start_application(); + app_start_application(); } } static struct spdk_conf * -spdk_app_setup_conf(const char *config_file) +app_setup_conf(const char *config_file) { struct spdk_conf *config; int rc; @@ -392,7 +392,7 @@ error: } 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; 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 -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; char *bdf; @@ -458,7 +458,7 @@ spdk_app_read_config_file_global_params(struct spdk_app_opts *opts) 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) { free(opts->pci_blacklist); return rc; @@ -477,7 +477,7 @@ spdk_app_read_config_file_global_params(struct spdk_app_opts *opts) 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) { free(opts->pci_whitelist); return rc; @@ -487,7 +487,7 @@ spdk_app_read_config_file_global_params(struct spdk_app_opts *opts) } 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 = {}; int rc; @@ -521,7 +521,7 @@ spdk_app_setup_env(struct spdk_app_opts *opts) } static int -spdk_app_setup_trace(struct spdk_app_opts *opts) +app_setup_trace(struct spdk_app_opts *opts) { char shm_name[64]; uint64_t tpoint_group_mask; @@ -563,11 +563,11 @@ bootstrap_fn(void *arg1) { if (g_spdk_app.json_config_file) { 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); } else { if (!g_delay_subsystem_init) { - spdk_subsystem_init(spdk_app_start_rpc, NULL); + spdk_subsystem_init(app_start_rpc, NULL); } else { 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 - config = spdk_app_setup_conf(opts->config_file); + config = app_setup_conf(opts->config_file); if (config == NULL) { 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); 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_backtrace_level(SPDK_APP_DEFAULT_BACKTRACE_LOG_LEVEL); - if (spdk_app_setup_env(opts) < 0) { + if (app_setup_env(opts) < 0) { 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 - * ahead of spdk_app_setup_signal_handlers(). + * Note the call to app_setup_trace() is located here + * ahead of app_setup_signal_handlers(). * That's because there is not an easy/direct clean * 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; } - if ((rc = spdk_app_setup_signal_handlers(opts)) != 0) { + if ((rc = app_setup_signal_handlers(opts)) != 0) { return 1; } @@ -819,7 +819,7 @@ spdk_app_parse_args(int argc, char **argv, struct spdk_app_opts *opts, } if (app_getopt_str != NULL) { - ch = spdk_app_opts_validate(app_getopt_str); + ch = app_opts_validate(app_getopt_str); if (ch) { SPDK_ERRLOG("Duplicated option '%c' between the generic and application specific spdk opts.\n", ch); @@ -931,7 +931,7 @@ spdk_app_parse_args(int argc, char **argv, struct spdk_app_opts *opts, 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) { free(opts->pci_blacklist); opts->pci_blacklist = NULL; @@ -966,7 +966,7 @@ spdk_app_parse_args(int argc, char **argv, struct spdk_app_opts *opts, 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) { free(opts->pci_whitelist); opts->pci_whitelist = NULL; @@ -1056,7 +1056,7 @@ spdk_app_usage(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_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_app_start_application(); + app_start_application(); w = spdk_jsonrpc_begin_result(request); spdk_json_write_bool(w, true); @@ -1078,8 +1078,8 @@ spdk_rpc_framework_start_init_cpl(int rc, void *arg1) } static void -spdk_rpc_framework_start_init(struct spdk_jsonrpc_request *request, - const struct spdk_json_val *params) +rpc_framework_start_init(struct spdk_jsonrpc_request *request, + const struct spdk_json_val *params) { if (params != NULL) { spdk_jsonrpc_send_error_response(request, SPDK_JSONRPC_ERROR_INVALID_PARAMS, @@ -1087,9 +1087,9 @@ spdk_rpc_framework_start_init(struct spdk_jsonrpc_request *request, 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) struct subsystem_init_poller_ctx { @@ -1098,7 +1098,7 @@ struct subsystem_init_poller_ctx { }; static int -spdk_rpc_subsystem_init_poller_ctx(void *ctx) +rpc_subsystem_init_poller_ctx(void *ctx) { struct spdk_json_write_ctx *w; struct subsystem_init_poller_ctx *poller_ctx = ctx; @@ -1115,8 +1115,8 @@ spdk_rpc_subsystem_init_poller_ctx(void *ctx) } static void -spdk_rpc_framework_wait_init(struct spdk_jsonrpc_request *request, - const struct spdk_json_val *params) +rpc_framework_wait_init(struct spdk_jsonrpc_request *request, + const struct spdk_json_val *params) { struct spdk_json_write_ctx *w; struct subsystem_init_poller_ctx *ctx; @@ -1133,9 +1133,9 @@ spdk_rpc_framework_wait_init(struct spdk_jsonrpc_request *request, return; } 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_REGISTER_ALIAS_DEPRECATED(framework_wait_init, wait_subsystem_init) diff --git a/lib/event/json_config.c b/lib/event/json_config.c index ebc1f5174..684490301 100644 --- a/lib/event/json_config.c +++ b/lib/event/json_config.c @@ -121,10 +121,10 @@ struct load_json_config_ctx { uint64_t timeout; }; -static void spdk_app_json_config_load_subsystem(void *_ctx); +static void app_json_config_load_subsystem(void *_ctx); 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); if (ctx->client_conn != NULL) { @@ -181,7 +181,7 @@ rpc_client_poller(void *arg) /* No response yet */ return -1; } else if (rc < 0) { - spdk_app_json_config_load_done(ctx, rc); + app_json_config_load_done(ctx, rc); return -1; } @@ -194,7 +194,7 @@ rpc_client_poller(void *arg) if (resp->error && ctx->stop_on_error) { spdk_jsonrpc_client_free_response(resp); - spdk_app_json_config_load_done(ctx, -EINVAL); + app_json_config_load_done(ctx, -EINVAL); } else { /* We have response so we must have callback for it. */ 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 */ spdk_poller_unregister(&ctx->client_conn_poller); 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 { rc = rpc_client_check_timeout(ctx); 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} }; -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 -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) { /* Don't care about the response */ spdk_jsonrpc_client_free_response(resp); 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 */ 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 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); ctx->subsystems_it = spdk_json_next(ctx->subsystems_it); /* 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; } @@ -340,7 +340,7 @@ spdk_app_json_config_load_subsystem_config_entry(void *_ctx) assert(params_end != NULL); 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_app_json_config_load_done(ctx, -EINVAL); + app_json_config_load_done(ctx, -EINVAL); 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); /* Invoke later to avoid recurrency */ 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; } @@ -364,14 +364,14 @@ spdk_app_json_config_load_subsystem_config_entry(void *_ctx) rpc_request = spdk_jsonrpc_client_create_request(); if (!rpc_request) { - spdk_app_json_config_load_done(ctx, -errno); + app_json_config_load_done(ctx, -errno); goto out; } w = spdk_jsonrpc_begin_request(rpc_request, ctx->rpc_request_id, NULL); if (!w) { spdk_jsonrpc_client_free_request(rpc_request); - spdk_app_json_config_load_done(ctx, -ENOMEM); + app_json_config_load_done(ctx, -ENOMEM); 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_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) { - spdk_app_json_config_load_done(ctx, -rc); + app_json_config_load_done(ctx, -rc); goto out; } out: @@ -398,7 +398,7 @@ subsystem_init_done(int rc, void *arg1) struct load_json_config_ctx *ctx = arg1; if (rc) { - spdk_app_json_config_load_done(ctx, rc); + app_json_config_load_done(ctx, rc); return; } @@ -411,7 +411,7 @@ subsystem_init_done(int rc, void *arg1) 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[] = { @@ -437,7 +437,7 @@ static struct spdk_json_object_decoder subsystem_decoders[] = { * configuration. */ static void -spdk_app_json_config_load_subsystem(void *_ctx) +app_json_config_load_subsystem(void *_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_subsystem_init(subsystem_init_done, ctx); } else { - spdk_app_json_config_load_done(ctx, 0); + app_json_config_load_done(ctx, 0); } return; @@ -456,7 +456,7 @@ spdk_app_json_config_load_subsystem(void *_ctx) if (spdk_json_decode_object(ctx->subsystems_it, subsystem_decoders, SPDK_COUNTOF(subsystem_decoders), ctx)) { SPDK_ERRLOG("Failed to parse subsystem configuration\n"); - spdk_app_json_config_load_done(ctx, -EINVAL); + app_json_config_load_done(ctx, -EINVAL); return; } @@ -465,7 +465,7 @@ spdk_app_json_config_load_subsystem(void *_ctx) /* Get 'config' array first configuration entry */ 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 * @@ -485,7 +485,7 @@ read_file(const char *filename, size_t *size) } 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; 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->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) { goto fail; } @@ -593,7 +593,7 @@ spdk_app_json_config_load(const char *json_config_file, const char *rpc_addr, return; 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) diff --git a/lib/event/reactor.c b/lib/event/reactor.c index 7998248d5..e13de75dd 100644 --- a/lib/event/reactor.c +++ b/lib/event/reactor.c @@ -62,7 +62,7 @@ static bool g_framework_context_switch_monitor_enabled = true; static struct spdk_mempool *g_spdk_event_mempool = NULL; 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->flags.is_valid = true; @@ -93,8 +93,8 @@ spdk_reactor_get(uint32_t lcore) return reactor; } -static int spdk_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 int reactor_thread_op(struct spdk_thread *thread, enum spdk_thread_op op); +static bool reactor_thread_op_supported(enum spdk_thread_op op); int spdk_reactors_init(void) @@ -128,11 +128,11 @@ spdk_reactors_init(void) 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)); 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; @@ -573,7 +573,7 @@ _reactor_request_thread_reschedule(struct spdk_thread *thread) } 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) { case SPDK_THREAD_OP_NEW: @@ -587,7 +587,7 @@ spdk_reactor_thread_op(struct spdk_thread *thread, enum spdk_thread_op op) } static bool -spdk_reactor_thread_op_supported(enum spdk_thread_op op) +reactor_thread_op_supported(enum spdk_thread_op op) { switch (op) { case SPDK_THREAD_OP_NEW: @@ -609,7 +609,7 @@ struct call_reactor { }; static void -spdk_on_reactor(void *arg1, void *arg2) +on_reactor(void *arg1, void *arg2) { struct call_reactor *cr = arg1; 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", 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); 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); - 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); spdk_event_call(evt); diff --git a/lib/event/rpc.c b/lib/event/rpc.c index 2d962b465..dc3523a29 100644 --- a/lib/event/rpc.c +++ b/lib/event/rpc.c @@ -46,7 +46,7 @@ static struct spdk_poller *g_rpc_poller = NULL; static int -spdk_rpc_subsystem_poll(void *arg) +rpc_subsystem_poll(void *arg) { spdk_rpc_accept(); return -1; @@ -76,7 +76,7 @@ spdk_rpc_initialize(const char *listen_addr) spdk_rpc_set_state(SPDK_RPC_STARTUP); /* 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 diff --git a/test/unit/lib/event/reactor.c/reactor_ut.c b/test/unit/lib/event/reactor.c/reactor_ut.c index 7c3d27898..ae6120284 100644 --- a/test/unit/lib/event/reactor.c/reactor_ut.c +++ b/test/unit/lib/event/reactor.c/reactor_ut.c @@ -44,7 +44,7 @@ test_create_reactor(void) g_reactors = &reactor; - spdk_reactor_construct(&reactor, 0); + reactor_construct(&reactor, 0); CU_ASSERT(spdk_reactor_get(0) == &reactor);