OSDN Git Service

Add get_fw_dev_path callback to IDE bus.
authorGleb Natapov <gleb@redhat.com>
Wed, 8 Dec 2010 11:34:59 +0000 (13:34 +0200)
committerBlue Swirl <blauwirbel@gmail.com>
Sat, 11 Dec 2010 21:27:48 +0000 (21:27 +0000)
Signed-off-by: Gleb Natapov <gleb@redhat.com>
Signed-off-by: Blue Swirl <blauwirbel@gmail.com>
hw/ide/qdev.c

index 88ff657..01a181b 100644 (file)
 
 /* --------------------------------- */
 
+static char *idebus_get_fw_dev_path(DeviceState *dev);
+
 static struct BusInfo ide_bus_info = {
     .name  = "IDE",
     .size  = sizeof(IDEBus),
+    .get_fw_dev_path = idebus_get_fw_dev_path,
 };
 
 void ide_bus_new(IDEBus *idebus, DeviceState *dev, int bus_id)
@@ -35,6 +38,16 @@ void ide_bus_new(IDEBus *idebus, DeviceState *dev, int bus_id)
     idebus->bus_id = bus_id;
 }
 
+static char *idebus_get_fw_dev_path(DeviceState *dev)
+{
+    char path[30];
+
+    snprintf(path, sizeof(path), "%s@%d", qdev_fw_name(dev),
+             ((IDEBus*)dev->parent_bus)->bus_id);
+
+    return strdup(path);
+}
+
 static int ide_qdev_init(DeviceState *qdev, DeviceInfo *base)
 {
     IDEDevice *dev = DO_UPCAST(IDEDevice, qdev, qdev);