summary refs log tree commit diff stats
path: root/hw/qdev.c
diff options
context:
space:
mode:
authorGerd Hoffmann <kraxel@redhat.com>2009-07-15 13:43:33 +0200
committerAnthony Liguori <aliguori@us.ibm.com>2009-07-16 17:28:52 -0500
commit3320e56e54021acab2d6eeb4797ddac30c2411ef (patch)
tree2b0aeeb8e342d28f55f245e90068908efb39a7c3 /hw/qdev.c
parentb6b611446077537b542c20804d3c850daff27845 (diff)
downloadfocaccia-qemu-3320e56e54021acab2d6eeb4797ddac30c2411ef.tar.gz
focaccia-qemu-3320e56e54021acab2d6eeb4797ddac30c2411ef.zip
qdev: add no_user, alias and desc
no_user: prevent users from adding certain devices.
desc: description of the device.
alias: to allow user friendly shortcuts on the command line, i.e.
  -device usbmouse  instead of  -device "QEMU USB Mouse"  or
  -device lsi       instead of  -device lsi53c895a

Signed-off-by: Gerd Hoffmann <kraxel@redhat.com>
Signed-off-by: Anthony Liguori <aliguori@us.ibm.com>
Diffstat (limited to 'hw/qdev.c')
-rw-r--r--hw/qdev.c12
1 files changed, 12 insertions, 0 deletions
diff --git a/hw/qdev.c b/hw/qdev.c
index cca242f8ee..b76ba5bb3e 100644
--- a/hw/qdev.c
+++ b/hw/qdev.c
@@ -50,6 +50,7 @@ static DeviceInfo *qdev_find_info(BusInfo *bus_info, const char *name)
 {
     DeviceInfo *info;
 
+    /* first check device names */
     for (info = device_info_list; info != NULL; info = info->next) {
         if (bus_info && info->bus_info != bus_info)
             continue;
@@ -57,6 +58,17 @@ static DeviceInfo *qdev_find_info(BusInfo *bus_info, const char *name)
             continue;
         return info;
     }
+
+    /* failing that check the aliases */
+    for (info = device_info_list; info != NULL; info = info->next) {
+        if (bus_info && info->bus_info != bus_info)
+            continue;
+        if (!info->alias)
+            continue;
+        if (strcmp(info->alias, name) != 0)
+            continue;
+        return info;
+    }
     return NULL;
 }