diff --git a/include/spdk/vhost.h b/include/spdk/vhost.h index cb2507e14..0539d7086 100644 --- a/include/spdk/vhost.h +++ b/include/spdk/vhost.h @@ -43,8 +43,8 @@ #include "spdk/event.h" -void spdk_vhost_subsystem_init(void); -int spdk_vhost_subsystem_fini(void); +int spdk_vhost_init(void); +int spdk_vhost_fini(void); /** * \param event event object. event arg1 is optional path to vhost socket. diff --git a/lib/event/subsystems/vhost/vhost.c b/lib/event/subsystems/vhost/vhost.c index aede5904d..f34d8589e 100644 --- a/lib/event/subsystems/vhost/vhost.c +++ b/lib/event/subsystems/vhost/vhost.c @@ -37,5 +37,21 @@ #include "spdk_internal/event.h" +static void +spdk_vhost_subsystem_init(void) +{ + int rc = 0; + + rc = spdk_vhost_init(); + + spdk_subsystem_init_next(rc); +} + +static int +spdk_vhost_subsystem_fini(void) +{ + return spdk_vhost_fini(); +} + SPDK_SUBSYSTEM_REGISTER(vhost, spdk_vhost_subsystem_init, spdk_vhost_subsystem_fini, NULL) SPDK_SUBSYSTEM_DEPEND(vhost, scsi) diff --git a/lib/vhost/task.c b/lib/vhost/task.c index c601b0d5f..59695283f 100644 --- a/lib/vhost/task.c +++ b/lib/vhost/task.c @@ -85,23 +85,21 @@ spdk_vhost_task_get(struct spdk_vhost_scsi_dev *vdev) return task; } -void -spdk_vhost_subsystem_init(void) +int +spdk_vhost_init(void) { - int rc = 0; - g_task_pool = rte_mempool_create("vhost task pool", 16384, sizeof(struct spdk_vhost_task), 128, 0, NULL, NULL, NULL, NULL, SOCKET_ID_ANY, 0); if (!g_task_pool) { SPDK_ERRLOG("create task pool failed\n"); - rc = -1; + return -1; } - spdk_subsystem_init_next(rc); + return 0; } int -spdk_vhost_subsystem_fini(void) +spdk_vhost_fini(void) { return 0; }