From 3052a742e3e3c81da2bc8c1b5e7c213e146c8bf1 Mon Sep 17 00:00:00 2001 From: Daniel Verkamp Date: Thu, 8 Mar 2018 15:55:13 -0700 Subject: [PATCH] app/spdk_tgt: add vhost to unified target Change-Id: I23366906ac8169954331c0f1be75d406607f2f9e Signed-off-by: Daniel Verkamp Reviewed-on: https://review.gerrithub.io/403227 Reviewed-by: Jim Harris Tested-by: SPDK Automated Test System Reviewed-by: Changpeng Liu --- app/spdk_tgt/Makefile | 5 +++++ app/spdk_tgt/spdk_tgt.c | 16 ++++++++++++++++ 2 files changed, 21 insertions(+) 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