diff --git a/include/spdk_internal/event.h b/include/spdk_internal/event.h index 6f0c1fe87..004ead609 100644 --- a/include/spdk_internal/event.h +++ b/include/spdk_internal/event.h @@ -132,7 +132,7 @@ struct spdk_subsystem { TAILQ_HEAD(spdk_subsystem_list, spdk_subsystem); extern struct spdk_subsystem_list g_subsystems; -struct spdk_subsystem *spdk_subsystem_find(struct spdk_subsystem_list *list, const char *name); +struct spdk_subsystem *spdk_subsystem_find(const char *name); struct spdk_subsystem_depend { const char *name; diff --git a/lib/event/subsystem.c b/lib/event/subsystem.c index 6451336da..eef40ef9a 100644 --- a/lib/event/subsystem.c +++ b/lib/event/subsystem.c @@ -62,8 +62,8 @@ spdk_add_subsystem_depend(struct spdk_subsystem_depend *depend) TAILQ_INSERT_TAIL(&g_subsystems_deps, depend, tailq); } -struct spdk_subsystem * -spdk_subsystem_find(struct spdk_subsystem_list *list, const char *name) +static struct spdk_subsystem * +_subsystem_find(struct spdk_subsystem_list *list, const char *name) { struct spdk_subsystem *iter; @@ -76,6 +76,12 @@ spdk_subsystem_find(struct spdk_subsystem_list *list, const char *name) return NULL; } +struct spdk_subsystem * +spdk_subsystem_find(const char *name) +{ + return _subsystem_find(&g_subsystems, name); +} + static void subsystem_sort(void) { @@ -91,7 +97,7 @@ subsystem_sort(void) TAILQ_FOREACH(subsystem_dep, &g_subsystems_deps, tailq) { if (strcmp(subsystem->name, subsystem_dep->name) == 0) { depends_on = true; - depends_on_sorted = !!spdk_subsystem_find(&subsystems_list, subsystem_dep->depends_on); + depends_on_sorted = !!_subsystem_find(&subsystems_list, subsystem_dep->depends_on); if (depends_on_sorted) { continue; } @@ -160,12 +166,12 @@ spdk_subsystem_init(spdk_subsystem_init_fn cb_fn, void *cb_arg) /* Verify that all dependency name and depends_on subsystems are registered */ TAILQ_FOREACH(dep, &g_subsystems_deps, tailq) { - if (!spdk_subsystem_find(&g_subsystems, dep->name)) { + if (!spdk_subsystem_find(dep->name)) { SPDK_ERRLOG("subsystem %s is missing\n", dep->name); g_subsystem_start_fn(-1, g_subsystem_start_arg); return; } - if (!spdk_subsystem_find(&g_subsystems, dep->depends_on)) { + if (!spdk_subsystem_find(dep->depends_on)) { SPDK_ERRLOG("subsystem %s dependency %s is missing\n", dep->name, dep->depends_on); g_subsystem_start_fn(-1, g_subsystem_start_arg); diff --git a/module/event/rpc/subsystem_rpc.c b/module/event/rpc/subsystem_rpc.c index fa18013ed..edc9669bf 100644 --- a/module/event/rpc/subsystem_rpc.c +++ b/module/event/rpc/subsystem_rpc.c @@ -96,7 +96,7 @@ spdk_rpc_framework_get_config(struct spdk_jsonrpc_request *request, return; } - subsystem = spdk_subsystem_find(&g_subsystems, req.name); + subsystem = spdk_subsystem_find(req.name); if (!subsystem) { spdk_jsonrpc_send_error_response_fmt(request, SPDK_JSONRPC_ERROR_INVALID_PARAMS, "Subsystem '%s' not found", req.name);