vhost: remove direct DPDK API call from vhost library

Change-Id: I5bad83197824dfb9042540c573134962a917b8bd
Signed-off-by: Changpeng Liu <changpeng.liu@intel.com>
Reviewed-on: https://review.gerrithub.io/363152
Tested-by: SPDK Automated Test System <sys_sgsw@intel.com>
Reviewed-by: Ben Walker <benjamin.walker@intel.com>
Reviewed-by: Tomasz Zawadzki <tomasz.zawadzki@intel.com>
This commit is contained in:
Changpeng Liu 2017-06-01 14:53:41 +08:00 committed by Ben Walker
parent 151de2c479
commit 0a49531fab

View File

@ -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);
}