lib/vhost: remove searching for controller by full path

A somewhat hidden functionality was present in spdk_vhost_dev_find().
Caller could match a vhost controller by controller name (socket filename)
or by full path to the socket.
This function is used by vhost RPC too.

The functionality of matching by full path was not documented,
nor matches what is presented in spdk_vhost_dev_get_name()
or vhost_get_controllers RPC.

This patch removes this functionality as part of series
to enable non-vhost-user type controllers, which might
not use the path to sockets.

Signed-off-by: Tomasz Zawadzki <tomasz.zawadzki@intel.com>
Change-Id: I0e5ce75ac80ed8d1da962eabba86af69f59a43db
Reviewed-on: https://review.spdk.io/gerrit/c/spdk/spdk/+/10436
Community-CI: Broadcom CI <spdk-ci.pdl@broadcom.com>
Community-CI: Mellanox Build Bot
Tested-by: SPDK CI Jenkins <sys_sgci@intel.com>
Reviewed-by: Changpeng Liu <changpeng.liu@intel.com>
Reviewed-by: Jim Harris <james.r.harris@intel.com>
Reviewed-by: Konrad Sztyber <konrad.sztyber@intel.com>
This commit is contained in:
Tomasz Zawadzki 2021-11-26 10:15:01 +01:00 committed by Jim Harris
parent f0f6413d13
commit 130dc6d1e9

View File

@ -869,11 +869,6 @@ struct spdk_vhost_dev *
spdk_vhost_dev_find(const char *ctrlr_name)
{
struct spdk_vhost_dev *vdev;
size_t dev_dirname_len = strlen(dev_dirname);
if (strncmp(ctrlr_name, dev_dirname, dev_dirname_len) == 0) {
ctrlr_name += dev_dirname_len;
}
TAILQ_FOREACH(vdev, &g_vhost_devices, tailq) {
if (strcmp(vdev->name, ctrlr_name) == 0) {
@ -1498,9 +1493,15 @@ vhost_new_connection_cb(int vid, const char *ifname)
{
struct spdk_vhost_dev *vdev;
struct spdk_vhost_session *vsession;
size_t dev_dirname_len;
pthread_mutex_lock(&g_vhost_mutex);
dev_dirname_len = strlen(dev_dirname);
if (strncmp(ifname, dev_dirname, dev_dirname_len) == 0) {
ifname += dev_dirname_len;
}
vdev = spdk_vhost_dev_find(ifname);
if (vdev == NULL) {
SPDK_ERRLOG("Couldn't find device with vid %d to create connection for.\n", vid);