bdev/virtio: remove unused virtio_user_dev parts

Several fields in struct virtio_user_dev are not referenced anywhere (a
few have cleanup code but no other assignments); remove them.

Also drop is_vhost_user_by_type() and virtio_user_handle_cq(), which
aren't used anywhere.

Change-Id: I7c80ccbadbd5263a2886dc9028108b898d6485ae
Signed-off-by: Daniel Verkamp <daniel.verkamp@intel.com>
Reviewed-on: https://review.gerrithub.io/382505
Reviewed-by: Dariusz Stojaczyk <dariuszx.stojaczyk@intel.com>
Reviewed-by: Jim Harris <james.r.harris@intel.com>
Tested-by: SPDK Automated Test System <sys_sgsw@intel.com>
This commit is contained in:
Daniel Verkamp 2017-10-13 13:07:55 -07:00 committed by Jim Harris
parent 64096b6031
commit 5aecabfbd5
2 changed files with 1 additions and 30 deletions

View File

@ -153,25 +153,12 @@ int virtio_user_stop_device(struct virtio_user_dev *dev)
return virtio_user_queue_setup(dev, virtio_user_stop_queue);
}
int
is_vhost_user_by_type(const char *path)
{
struct stat sb;
if (stat(path, &sb) == -1)
return 0;
return S_ISSOCK(sb.st_mode);
}
static int
virtio_user_dev_setup(struct virtio_user_dev *dev)
{
uint16_t i;
dev->vhostfd = -1;
dev->vhostfds = NULL;
dev->tapfds = NULL;
for (i = 0; i < VIRTIO_MAX_VIRTQUEUES; ++i) {
dev->callfds[i] = -1;
@ -242,14 +229,5 @@ err:
void
virtio_user_dev_uninit(struct virtio_user_dev *dev)
{
uint32_t i;
close(dev->vhostfd);
if (dev->vhostfds) {
for (i = 0; i < dev->vdev.max_queues; ++i)
close(dev->vhostfds[i]);
free(dev->vhostfds);
free(dev->tapfds);
}
}

View File

@ -49,27 +49,20 @@ struct virtio_user_dev {
/* for vhost_user backend */
int vhostfd;
/* for vhost_kernel backend */
char *ifname;
int *vhostfds;
int *tapfds;
/* for both vhost_user and vhost_kernel */
int callfds[VIRTIO_MAX_VIRTQUEUES];
int kickfds[VIRTIO_MAX_VIRTQUEUES];
uint32_t queue_size;
uint8_t status;
uint8_t port_id;
char path[PATH_MAX];
struct vring vrings[VIRTIO_MAX_VIRTQUEUES];
struct virtio_user_backend_ops *ops;
};
int is_vhost_user_by_type(const char *path);
int virtio_user_start_device(struct virtio_user_dev *dev);
int virtio_user_stop_device(struct virtio_user_dev *dev);
struct virtio_dev *virtio_user_dev_init(char *path, int queue_size);
void virtio_user_dev_uninit(struct virtio_user_dev *dev);
void virtio_user_handle_cq(struct virtio_user_dev *dev, uint16_t queue_idx);
#endif