aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorGleb Natapov <gleb@redhat.com>2010-12-08 13:35:04 +0200
committerBlue Swirl <blauwirbel@gmail.com>2010-12-11 21:32:45 +0000
commitdb07c0f84ba2bedea4b8201ccb62602fd5e64c28 (patch)
treee0fb7f3558be52f0b053692cf3acb91b324bb3bc
parentcdedd0061306bf204c5751584f69f1bcc9834f14 (diff)
Add get_fw_dev_path callback to scsi bus.
Signed-off-by: Gleb Natapov <gleb@redhat.com> Signed-off-by: Blue Swirl <blauwirbel@gmail.com>
-rw-r--r--hw/scsi-bus.c23
1 files changed, 23 insertions, 0 deletions
diff --git a/hw/scsi-bus.c b/hw/scsi-bus.c
index 93f0e9abc1..7febb86e77 100644
--- a/hw/scsi-bus.c
+++ b/hw/scsi-bus.c
@@ -5,9 +5,12 @@
#include "qdev.h"
#include "blockdev.h"
+static char *scsibus_get_fw_dev_path(DeviceState *dev);
+
static struct BusInfo scsi_bus_info = {
.name = "SCSI",
.size = sizeof(SCSIBus),
+ .get_fw_dev_path = scsibus_get_fw_dev_path,
.props = (Property[]) {
DEFINE_PROP_UINT32("scsi-id", SCSIDevice, id, -1),
DEFINE_PROP_END_OF_LIST(),
@@ -518,3 +521,23 @@ void scsi_req_complete(SCSIRequest *req)
req->tag,
req->status);
}
+
+static char *scsibus_get_fw_dev_path(DeviceState *dev)
+{
+ SCSIDevice *d = (SCSIDevice*)dev;
+ SCSIBus *bus = scsi_bus_from_device(d);
+ char path[100];
+ int i;
+
+ for (i = 0; i < bus->ndev; i++) {
+ if (bus->devs[i] == d) {
+ break;
+ }
+ }
+
+ assert(i != bus->ndev);
+
+ snprintf(path, sizeof(path), "%s@%x", qdev_fw_name(dev), i);
+
+ return strdup(path);
+}