[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[Qemu-devel] [PATCH 1/4] qdev: support to get a device firmware path dir
From: |
arei.gonglei |
Subject: |
[Qemu-devel] [PATCH 1/4] qdev: support to get a device firmware path directly |
Date: |
Mon, 19 Jan 2015 21:23:35 +0800 |
From: Gonglei <address@hidden>
commit 6b1566c (qdev: Introduce FWPathProvider interface) did a
good job for supproting to get firmware path on some different
architectures.
Moreover further more, we can use the interface to get firmware
path name for a device which isn't attached a specific bus,
such as virtio-bus, scsi-bus etc.
When the device (such as vhost-scsi) realize the TYPE_FW_PATH_PROVIDER
interface, we should introduce a new function to get the correct firmware
path name for it.
Signed-off-by: Gonglei <address@hidden>
---
hw/core/qdev.c | 14 ++++++++++++++
1 file changed, 14 insertions(+)
diff --git a/hw/core/qdev.c b/hw/core/qdev.c
index 901f289..fb0a150 100644
--- a/hw/core/qdev.c
+++ b/hw/core/qdev.c
@@ -768,6 +768,14 @@ static char *qdev_get_fw_dev_path_from_handler(BusState
*bus, DeviceState *dev)
return d;
}
+static char *qdev_get_own_fw_dev_path_from_handler(BusState *bus,
+ DeviceState *dev)
+{
+ Object *obj = OBJECT(dev);
+
+ return fw_path_provider_try_get_dev_path(obj, bus, dev);
+}
+
static int qdev_get_fw_dev_path_helper(DeviceState *dev, char *p, int size)
{
int l = 0;
@@ -780,6 +788,12 @@ static int qdev_get_fw_dev_path_helper(DeviceState *dev,
char *p, int size)
d = bus_get_fw_dev_path(dev->parent_bus, dev);
}
if (d) {
+ l += snprintf(p + l, size - l, "%s/", d);
+ g_free(d);
+ }
+
+ d = qdev_get_own_fw_dev_path_from_handler(dev->parent_bus, dev);
+ if (d) {
l += snprintf(p + l, size - l, "%s", d);
g_free(d);
} else {
--
1.7.12.4
[Qemu-devel] [PATCH 2/4] vhost-scsi: add bootindex property, arei.gonglei, 2015/01/19
[Qemu-devel] [PATCH 3/4] vhost-scsi: realize the TYPE_FW_PATH_PROVIDER interface, arei.gonglei, 2015/01/19
[Qemu-devel] [PATCH 4/4] vhost-scsi: add an ioctl interface to get target id, arei.gonglei, 2015/01/19