lib/event: remove list arg from spdk_subsystem_find

This is part of a larger effort to remove the g_subsystems and
g_subsystems_deps variables from the spdk_event map file. The
implementation of those variables should be internal to the
library.

Signed-off-by: Seth Howell <seth.howell@intel.com>
Change-Id: I3c2c04933859c6c484a903e666df10f810b26709
Reviewed-on: https://review.spdk.io/gerrit/c/spdk/spdk/+/1785
Community-CI: Mellanox Build Bot
Tested-by: SPDK CI Jenkins <sys_sgci@intel.com>
Reviewed-by: Aleksey Marchuk <alexeymar@mellanox.com>
Reviewed-by: Shuhei Matsumoto <shuhei.matsumoto.xt@hitachi.com>
Reviewed-by: Jim Harris <james.r.harris@intel.com>
This commit is contained in:
Seth Howell 2020-04-09 12:00:08 -07:00 committed by Tomasz Zawadzki
parent 749c917fc1
commit d02d16ffdf
3 changed files with 13 additions and 7 deletions

View File

@ -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;

View File

@ -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);

View File

@ -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);