mirror of https://github.com/xemu-project/xemu.git
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>
This commit is contained in:
parent
cdedd00613
commit
db07c0f84b
|
@ -5,9 +5,12 @@
|
||||||
#include "qdev.h"
|
#include "qdev.h"
|
||||||
#include "blockdev.h"
|
#include "blockdev.h"
|
||||||
|
|
||||||
|
static char *scsibus_get_fw_dev_path(DeviceState *dev);
|
||||||
|
|
||||||
static struct BusInfo scsi_bus_info = {
|
static struct BusInfo scsi_bus_info = {
|
||||||
.name = "SCSI",
|
.name = "SCSI",
|
||||||
.size = sizeof(SCSIBus),
|
.size = sizeof(SCSIBus),
|
||||||
|
.get_fw_dev_path = scsibus_get_fw_dev_path,
|
||||||
.props = (Property[]) {
|
.props = (Property[]) {
|
||||||
DEFINE_PROP_UINT32("scsi-id", SCSIDevice, id, -1),
|
DEFINE_PROP_UINT32("scsi-id", SCSIDevice, id, -1),
|
||||||
DEFINE_PROP_END_OF_LIST(),
|
DEFINE_PROP_END_OF_LIST(),
|
||||||
|
@ -518,3 +521,23 @@ void scsi_req_complete(SCSIRequest *req)
|
||||||
req->tag,
|
req->tag,
|
||||||
req->status);
|
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);
|
||||||
|
}
|
||||||
|
|
Loading…
Reference in New Issue