diff --git a/app/spdk_tgt/Makefile b/app/spdk_tgt/Makefile index 087458d7a..a3dca0806 100644 --- a/app/spdk_tgt/Makefile +++ b/app/spdk_tgt/Makefile @@ -46,6 +46,11 @@ SPDK_LIB_LIST += app_rpc log_rpc bdev_rpc ifeq ($(OS),Linux) SPDK_LIB_LIST += event_nbd nbd + +ifeq ($(CONFIG_VHOST),y) +SPDK_LIB_LIST += vhost rte_vhost event_vhost +endif + endif LIBS += $(BLOCKDEV_MODULES_LINKER_ARGS) \ diff --git a/app/spdk_tgt/spdk_tgt.c b/app/spdk_tgt/spdk_tgt.c index 636898fbc..b74801989 100644 --- a/app/spdk_tgt/spdk_tgt.c +++ b/app/spdk_tgt/spdk_tgt.c @@ -36,15 +36,31 @@ #include "spdk/env.h" #include "spdk/event.h" #include "spdk/log.h" +#include "spdk/vhost.h" + +/* TODO: this should be handled by configure */ +#if defined(SPDK_CONFIG_VHOST) && !defined(__linux__) +#undef SPDK_CONFIG_VHOST +#endif static void spdk_tgt_usage(void) { +#ifdef SPDK_CONFIG_VHOST + printf(" -S dir directory where to create vhost sockets (default: pwd)\n"); +#endif } static void spdk_tgt_parse_arg(int ch, char *arg) { + switch (ch) { +#ifdef SPDK_CONFIG_VHOST + case 'S': + spdk_vhost_set_socket_path(arg); + break; +#endif + } } static void