Commit d02d16ff authored by Seth Howell's avatar Seth Howell Committed by Tomasz Zawadzki
Browse files

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: default avatarSeth 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: default avatarSPDK CI Jenkins <sys_sgci@intel.com>
Reviewed-by: default avatarAleksey Marchuk <alexeymar@mellanox.com>
Reviewed-by: default avatarShuhei Matsumoto <shuhei.matsumoto.xt@hitachi.com>
Reviewed-by: default avatarJim Harris <james.r.harris@intel.com>
parent 749c917f
Loading
Loading
Loading
Loading
+1 −1
Original line number Diff line number Diff line
@@ -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;
+11 −5
Original line number Diff line number Diff line
@@ -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);
+1 −1
Original line number Diff line number Diff line
@@ -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);