diff --git a/app/vhost/vhost.c b/app/vhost/vhost.c index ecf48e520..383f617df 100644 --- a/app/vhost/vhost.c +++ b/app/vhost/vhost.c @@ -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(); diff --git a/include/spdk/vhost.h b/include/spdk/vhost.h index f7b0e73af..30bd8b13d 100644 --- a/include/spdk/vhost.h +++ b/include/spdk/vhost.h @@ -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. */ diff --git a/lib/vhost/vhost.c b/lib/vhost/vhost.c index 70dc8af45..13cdd23de 100644 --- a/lib/vhost/vhost.c +++ b/lib/vhost/vhost.c @@ -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; }