[Top][All Lists]
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[Qemu-devel] [RFC 4/9] vhost: Pass device path to vhost_dev_init()
From: |
Nicholas A. Bellinger |
Subject: |
[Qemu-devel] [RFC 4/9] vhost: Pass device path to vhost_dev_init() |
Date: |
Tue, 24 Jul 2012 22:34:01 +0000 |
From: Stefan Hajnoczi <address@hidden>
The path to /dev/vhost-net is currently hardcoded in vhost_dev_init().
This needs to be changed so that /dev/vhost-scsi can be used. Pass in
the device path instead of hardcoding it.
Signed-off-by: Stefan Hajnoczi <address@hidden>
Cc: Paolo Bonzini <address@hidden>
Cc: Michael S. Tsirkin <address@hidden>
Signed-off-by: Nicholas Bellinger <address@hidden>
---
hw/vhost.c | 5 +++--
hw/vhost.h | 3 ++-
hw/vhost_net.c | 2 +-
3 files changed, 6 insertions(+), 4 deletions(-)
diff --git a/hw/vhost.c b/hw/vhost.c
index 0fd8da8..d0ce5aa 100644
--- a/hw/vhost.c
+++ b/hw/vhost.c
@@ -747,14 +747,15 @@ static void vhost_eventfd_del(MemoryListener *listener,
{
}
-int vhost_dev_init(struct vhost_dev *hdev, int devfd, bool force)
+int vhost_dev_init(struct vhost_dev *hdev, int devfd, const char *devpath,
+ bool force)
{
uint64_t features;
int r;
if (devfd >= 0) {
hdev->control = devfd;
} else {
- hdev->control = open("/dev/vhost-net", O_RDWR);
+ hdev->control = open(devpath, O_RDWR);
if (hdev->control < 0) {
return -errno;
}
diff --git a/hw/vhost.h b/hw/vhost.h
index 80e64df..0c47229 100644
--- a/hw/vhost.h
+++ b/hw/vhost.h
@@ -44,7 +44,8 @@ struct vhost_dev {
bool force;
};
-int vhost_dev_init(struct vhost_dev *hdev, int devfd, bool force);
+int vhost_dev_init(struct vhost_dev *hdev, int devfd, const char *devpath,
+ bool force);
void vhost_dev_cleanup(struct vhost_dev *hdev);
bool vhost_dev_query(struct vhost_dev *hdev, VirtIODevice *vdev);
int vhost_dev_start(struct vhost_dev *hdev, VirtIODevice *vdev);
diff --git a/hw/vhost_net.c b/hw/vhost_net.c
index 75f8211..9faadfd 100644
--- a/hw/vhost_net.c
+++ b/hw/vhost_net.c
@@ -109,7 +109,7 @@ struct vhost_net *vhost_net_init(VLANClientState *backend,
int devfd,
(1 << VHOST_NET_F_VIRTIO_NET_HDR);
net->backend = r;
- r = vhost_dev_init(&net->dev, devfd, force);
+ r = vhost_dev_init(&net->dev, devfd, "/dev/vhost-net", force);
if (r < 0) {
goto fail;
}
--
1.7.2.5
- [Qemu-devel] [RFC 0/9] vhost-scsi: Add support for host virtualized target, Nicholas A. Bellinger, 2012/07/24
- [Qemu-devel] [RFC 1/9] notifier: add validity check and notify function, Nicholas A. Bellinger, 2012/07/24
- [Qemu-devel] [RFC 2/9] virtio-pci: support host notifiers in TCG mode, Nicholas A. Bellinger, 2012/07/24
- [Qemu-devel] [RFC 3/9] virtio-pci: check that event notification worked, Nicholas A. Bellinger, 2012/07/24
- [Qemu-devel] [RFC 4/9] vhost: Pass device path to vhost_dev_init(),
Nicholas A. Bellinger <=
- [Qemu-devel] [RFC 5/9] virtio-scsi: Add wwpn and tgpt properties, Nicholas A. Bellinger, 2012/07/24
- [Qemu-devel] [RFC 6/9] virtio-scsi: Open and initialize /dev/vhost-scsi, Nicholas A. Bellinger, 2012/07/24
- [Qemu-devel] [RFC 7/9] virtio-scsi: Start/stop vhost, Nicholas A. Bellinger, 2012/07/24
- [Qemu-devel] [RFC 8/9] virtio-scsi: Set max_target=0 during vhost-scsi operation, Nicholas A. Bellinger, 2012/07/24
- [Qemu-devel] [RFC 9/9] vhost-scsi: add -vhost-scsi host device, Nicholas A. Bellinger, 2012/07/24
- Re: [Qemu-devel] [RFC 0/9] vhost-scsi: Add support for host virtualized target, Zhi Yong Wu, 2012/07/24