From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from [140.186.70.92] (port=55456 helo=eggs.gnu.org) by lists.gnu.org with esmtp (Exim 4.43) id 1PCWGr-0007nO-37 for qemu-devel@nongnu.org; Sun, 31 Oct 2010 07:40:22 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1PCWGp-0008FJ-B6 for qemu-devel@nongnu.org; Sun, 31 Oct 2010 07:40:20 -0400 Received: from mx1.redhat.com ([209.132.183.28]:49891) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1PCWGo-0008F2-RN for qemu-devel@nongnu.org; Sun, 31 Oct 2010 07:40:19 -0400 From: Gleb Natapov Date: Sun, 31 Oct 2010 13:40:06 +0200 Message-Id: <1288525209-3303-6-git-send-email-gleb@redhat.com> In-Reply-To: <1288525209-3303-1-git-send-email-gleb@redhat.com> References: <1288525209-3303-1-git-send-email-gleb@redhat.com> Subject: [Qemu-devel] [PATCHv2 5/8] Add get_dev_path callback to IDE bus. List-Id: qemu-devel.nongnu.org List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , To: qemu-devel@nongnu.org Cc: blauwirbel@gmail.com, alex.williamson@redhat.com, armbru@redhat.com, kvm@vger.kernel.org Signed-off-by: Gleb Natapov --- hw/ide/qdev.c | 14 ++++++++++++++ 1 files changed, 14 insertions(+), 0 deletions(-) diff --git a/hw/ide/qdev.c b/hw/ide/qdev.c index 3ad2138..7db2f19 100644 --- a/hw/ide/qdev.c +++ b/hw/ide/qdev.c @@ -24,9 +24,12 @@ /* --------------------------------- */ +static char *idebus_get_dev_path(DeviceState *dev); + static struct BusInfo ide_bus_info = { .name = "IDE", .size = sizeof(IDEBus), + .get_dev_path = idebus_get_dev_path, }; void ide_bus_new(IDEBus *idebus, DeviceState *dev, uint8_t bus_id) @@ -35,6 +38,17 @@ void ide_bus_new(IDEBus *idebus, DeviceState *dev, uint8_t bus_id) idebus->bus_id = bus_id; } +static char *idebus_get_dev_path(DeviceState *dev) +{ + IDEDevice *d = (IDEDevice*)dev; + char path[30]; + + snprintf(path, sizeof(path), "%s@%d:%d", qdev_driver_name(dev), + ((IDEBus*)dev->parent_bus)->bus_id, d->unit); + + return strdup(path); +} + static int ide_qdev_init(DeviceState *qdev, DeviceInfo *base) { IDEDevice *dev = DO_UPCAST(IDEDevice, qdev, qdev); -- 1.7.1