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: Daniel Verkamp <daniel.verkamp@intel.com>
Reviewed-on: https://review.gerrithub.io/403226
Tested-by: SPDK Automated Test System <sys_sgsw@intel.com>
Reviewed-by: Jim Harris <james.r.harris@intel.com>
Reviewed-by: Changpeng Liu <changpeng.liu@intel.com>
This commit is contained in:
Daniel Verkamp 2018-03-08 15:48:23 -07:00 committed by Jim Harris
parent fc0a23627e
commit a0484cad21
3 changed files with 20 additions and 32 deletions

View File

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

View File

@ -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.
*/

View File

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