From 0a49531fabb5ec3ed5865a5a9b1377b644bb3395 Mon Sep 17 00:00:00 2001 From: Changpeng Liu Date: Thu, 1 Jun 2017 14:53:41 +0800 Subject: [PATCH] vhost: remove direct DPDK API call from vhost library Change-Id: I5bad83197824dfb9042540c573134962a917b8bd Signed-off-by: Changpeng Liu Reviewed-on: https://review.gerrithub.io/363152 Tested-by: SPDK Automated Test System Reviewed-by: Ben Walker Reviewed-by: Tomasz Zawadzki --- lib/vhost/vhost.c | 18 ++++++++++++------ 1 file changed, 12 insertions(+), 6 deletions(-) diff --git a/lib/vhost/vhost.c b/lib/vhost/vhost.c index f5b8822a5..2446e5713 100644 --- a/lib/vhost/vhost.c +++ b/lib/vhost/vhost.c @@ -297,7 +297,8 @@ spdk_vhost_dev_register(struct spdk_vhost_dev *vdev, SPDK_ERRLOG("Cannot remove %s: not a socket.\n", path); return -EINVAL; } else if (unlink(path) != 0) { - rte_exit(EXIT_FAILURE, "Cannot remove %s.\n", path); + SPDK_ERRLOG("Cannot remove %s.\n", path); + abort(); } } @@ -550,7 +551,8 @@ spdk_vhost_startup(void *arg1, void *arg2) if (basename && strlen(basename) > 0) { ret = snprintf(dev_dirname, sizeof(dev_dirname) - 2, "%s", basename); if ((size_t)ret >= sizeof(dev_dirname) - 2) { - rte_exit(EXIT_FAILURE, "Char dev dir path length %d is too long\n", ret); + SPDK_ERRLOG("Char dev dir path length %d is too long\n", ret); + abort(); } if (dev_dirname[ret - 1] != '/') { @@ -560,8 +562,10 @@ spdk_vhost_startup(void *arg1, void *arg2) } ret = spdk_vhost_scsi_controller_construct(); - if (ret != 0) - rte_exit(EXIT_FAILURE, "Cannot construct vhost controllers\n"); + if (ret != 0) { + SPDK_ERRLOG("Cannot construct vhost controllers\n"); + abort(); + } } static void * @@ -590,8 +594,10 @@ void spdk_vhost_shutdown_cb(void) { pthread_t tid; - if (pthread_create(&tid, NULL, &session_shutdown, NULL) < 0) - rte_panic("Failed to start session shutdown thread (%d): %s", errno, strerror(errno)); + if (pthread_create(&tid, NULL, &session_shutdown, NULL) < 0) { + SPDK_ERRLOG("Failed to start session shutdown thread (%d): %s", errno, strerror(errno)); + abort(); + } pthread_detach(tid); }