[Top][All Lists]
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[Qemu-devel] [PATCH v3 04/17] qdev: Give qtree names precedence over use
From: |
Jan Kiszka |
Subject: |
[Qemu-devel] [PATCH v3 04/17] qdev: Give qtree names precedence over user-assigned IDs |
Date: |
Sun, 23 May 2010 12:59:17 +0200 |
From: Jan Kiszka <address@hidden>
As the user may specify ambiguous device IDs, let's search for their
official names first before considering the user-supplied identifiers.
Signed-off-by: Jan Kiszka <address@hidden>
---
docs/qdev-device-use.txt | 4 +++-
hw/qdev.c | 18 +++++++++---------
2 files changed, 12 insertions(+), 10 deletions(-)
diff --git a/docs/qdev-device-use.txt b/docs/qdev-device-use.txt
index 74d4960..0160191 100644
--- a/docs/qdev-device-use.txt
+++ b/docs/qdev-device-use.txt
@@ -25,7 +25,9 @@ omitted in the path. Example: /i440FX-pcihost/PIIX3
abbreviates
/i440FX-pcihost/pci.0/PIIX3/isa.0 as none of the buses has siblings.
Existing devices can be addressed either via a unique ID if it was
-assigned during creation or via the device tree path:
+assigned during creation or via the device tree path. In conflicts,
+the latter has precedence. A device tree path has the following
+structure:
/full_bus_address/driver_name[.instance_number]
or
diff --git a/hw/qdev.c b/hw/qdev.c
index 6b4a629..eeadf4a 100644
--- a/hw/qdev.c
+++ b/hw/qdev.c
@@ -535,16 +535,10 @@ static DeviceState *qbus_find_dev(BusState *bus, const
char *elem)
/*
* try to match in order:
- * (1) instance id, if present
- * (2) driver name [.instance]
- * (3) driver alias [.instance], if present
+ * (1) driver name [.instance]
+ * (2) driver alias [.instance], if present
+ * (3) instance id, if present
*/
- QLIST_FOREACH(dev, &bus->children, sibling) {
- if (dev->id && strcmp(dev->id, elem) == 0) {
- return dev;
- }
- }
-
if (sscanf(elem, "%127[^.].%u", buf, &instance) == 2) {
elem = buf;
} else {
@@ -565,6 +559,12 @@ static DeviceState *qbus_find_dev(BusState *bus, const
char *elem)
return dev;
}
}
+
+ QLIST_FOREACH(dev, &bus->children, sibling) {
+ if (dev->id && strcmp(dev->id, elem) == 0) {
+ return dev;
+ }
+ }
return NULL;
}
--
1.6.0.2
- [Qemu-devel] [PATCH v3 03/17] qdev: Allow device addressing via 'driver.instance', (continued)
- [Qemu-devel] [PATCH v3 03/17] qdev: Allow device addressing via 'driver.instance', Jan Kiszka, 2010/05/23
- [Qemu-devel] [PATCH v3 06/17] qdev: Allow device specification by qtree path for device_del, Jan Kiszka, 2010/05/23
- [Qemu-devel] Re: [PATCH v3 06/17] qdev: Allow device specification by qtree path for device_del, Luiz Capitulino, 2010/05/27
- Re: [Qemu-devel] Re: [PATCH v3 06/17] qdev: Allow device specification by qtree path for device_del, Markus Armbruster, 2010/05/28
- Re: [Qemu-devel] Re: [PATCH v3 06/17] qdev: Allow device specification by qtree path for device_del, Jan Kiszka, 2010/05/28
- Re: [Qemu-devel] Re: [PATCH v3 06/17] qdev: Allow device specification by qtree path for device_del, Markus Armbruster, 2010/05/29
- Re: [Qemu-devel] Re: [PATCH v3 06/17] qdev: Allow device specification by qtree path for device_del, Jan Kiszka, 2010/05/29
[Qemu-devel] [PATCH v3 04/17] qdev: Give qtree names precedence over user-assigned IDs,
Jan Kiszka <=
- Re: [Qemu-devel] [PATCH v3 04/17] qdev: Give qtree names precedence over user-assigned IDs, Markus Armbruster, 2010/05/29
- Re: [Qemu-devel] [PATCH v3 04/17] qdev: Give qtree names precedence over user-assigned IDs, Avi Kivity, 2010/05/30
- Re: [Qemu-devel] [PATCH v3 04/17] qdev: Give qtree names precedence over user-assigned IDs, Markus Armbruster, 2010/05/31
- Re: [Qemu-devel] [PATCH v3 04/17] qdev: Give qtree names precedence over user-assigned IDs, Gerd Hoffmann, 2010/05/31
- Re: [Qemu-devel] [PATCH v3 04/17] qdev: Give qtree names precedence over user-assigned IDs, Markus Armbruster, 2010/05/31
- [Qemu-devel] [PATCH] qdev: Reject duplicate and anti-social device IDs, Markus Armbruster, 2010/05/31
- [Qemu-devel] Re: [PATCH] qdev: Reject duplicate and anti-social device IDs, Gerd Hoffmann, 2010/05/31
[Qemu-devel] [PATCH v3 05/17] qdev: Convert device and bus lists to QTAILQ, Jan Kiszka, 2010/05/23
[Qemu-devel] [PATCH v3 01/17] Add dependency of JSON unit tests on config-host.h, Jan Kiszka, 2010/05/23
[Qemu-devel] [PATCH v3 11/17] Add QBuffer, Jan Kiszka, 2010/05/23