Commit a0484cad authored by Daniel Verkamp's avatar Daniel Verkamp Committed by Jim Harris
Browse files

vhost: merge spdk_vhost_startup() into spdk_vhost_init()



This allows vhost initialization to be fully handled in the event
framework subsystem.

Change-Id: Ic0ff11f3765cc553b7ca183027209fb6dd131364
Signed-off-by: default avatarDaniel Verkamp <daniel.verkamp@intel.com>
Reviewed-on: https://review.gerrithub.io/403226


Tested-by: default avatarSPDK Automated Test System <sys_sgsw@intel.com>
Reviewed-by: default avatarJim Harris <james.r.harris@intel.com>
Reviewed-by: default avatarChangpeng Liu <changpeng.liu@intel.com>
parent fc0a2362
Loading
Loading
Loading
Loading
+6 −1
Original line number Diff line number Diff line
@@ -90,6 +90,11 @@ vhost_parse_arg(int ch, char *arg)
	}
}

static void
vhost_started(void *arg1, void *arg2)
{
}

int
main(int argc, char *argv[])
{
@@ -109,7 +114,7 @@ main(int argc, char *argv[])
	}

	/* Blocks until the application is exiting */
	rc = spdk_app_start(&opts, spdk_vhost_startup, NULL, NULL);
	rc = spdk_app_start(&opts, vhost_started, NULL, NULL);

	spdk_app_fini();

+0 −8
Original line number Diff line number Diff line
@@ -77,14 +77,6 @@ int spdk_vhost_init(void);
 */
void spdk_vhost_fini(spdk_vhost_fini_cb fini_cb);

/**
 * Init vhost application. This is called once by SPDK app layer.
 *
 * \param arg1 unused.
 * \param arg2 unused.
 */
void spdk_vhost_startup(void *arg1, void *arg2);

/**
 * Deinit vhost application. This is called once by SPDK app layer.
 */
+14 −23
Original line number Diff line number Diff line
@@ -1118,29 +1118,6 @@ spdk_vhost_set_socket_path(const char *basename)
	return 0;
}

void
spdk_vhost_startup(void *arg1, void *arg2)
{
	int ret;

	ret = spdk_vhost_scsi_controller_construct();
	if (ret != 0) {
		SPDK_ERRLOG("Cannot construct vhost controllers\n");
		goto out;
	}

	ret = spdk_vhost_blk_controller_construct();
	if (ret != 0) {
		SPDK_ERRLOG("Cannot construct vhost block controllers\n");
		goto out;
	}

	return;

out:
	spdk_app_stop(-1);
}

static void *
session_shutdown(void *arg)
{
@@ -1291,6 +1268,7 @@ int
spdk_vhost_init(void)
{
	uint32_t last_core;
	int ret;

	last_core = spdk_env_get_last_core();
	g_num_ctrlrs = calloc(last_core + 1, sizeof(uint32_t));
@@ -1299,6 +1277,19 @@ spdk_vhost_init(void)
			    last_core + 1);
		return -1;
	}

	ret = spdk_vhost_scsi_controller_construct();
	if (ret != 0) {
		SPDK_ERRLOG("Cannot construct vhost controllers\n");
		return -1;
	}

	ret = spdk_vhost_blk_controller_construct();
	if (ret != 0) {
		SPDK_ERRLOG("Cannot construct vhost block controllers\n");
		return -1;
	}

	return 0;
}