vhost_net_init will use VhostNetOptions to get all its arguments

vhost_dev_init will replace devfd and devpath with a single opaque argument.
This is initialised with a file descriptor. When TAP is used (through
vhost_net), open /dev/vhost-net and pass the fd as an opaque parameter in
VhostNetOptions. The same applies to vhost-scsi - open /dev/vhost-scsi and
pass the fd.

Signed-off-by: Antonios Motakis <a.motakis@virtualopensystems.com>
Signed-off-by: Nikolay Nikolaev <n.nikolaev@virtualopensystems.com>
Reviewed-by: Michael S. Tsirkin <mst@redhat.com>
Signed-off-by: Michael S. Tsirkin <mst@redhat.com>
This commit is contained in:
Nikolay Nikolaev 2014-05-27 15:05:22 +03:00 committed by Michael S. Tsirkin
parent ed8b4afe5f
commit 81647a655f
6 changed files with 45 additions and 27 deletions

View file

@ -808,19 +808,13 @@ static void vhost_virtqueue_cleanup(struct vhost_virtqueue *vq)
event_notifier_cleanup(&vq->masked_notifier);
}
int vhost_dev_init(struct vhost_dev *hdev, int devfd, const char *devpath,
int vhost_dev_init(struct vhost_dev *hdev, void *opaque,
bool force)
{
uint64_t features;
int i, r;
if (devfd >= 0) {
hdev->control = devfd;
} else {
hdev->control = open(devpath, O_RDWR);
if (hdev->control < 0) {
return -errno;
}
}
hdev->control = (uintptr_t) opaque;;
r = ioctl(hdev->control, VHOST_SET_OWNER, NULL);
if (r < 0) {
goto fail;