qemu-devel
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[Qemu-devel] [PATCH 3/6] qdev: add no_user, alias and desc


From: Gerd Hoffmann
Subject: [Qemu-devel] [PATCH 3/6] qdev: add no_user, alias and desc
Date: Wed, 15 Jul 2009 13:43:33 +0200

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 <address@hidden>
---
 hw/qdev.c |   12 ++++++++++++
 hw/qdev.h |    3 +++
 2 files changed, 15 insertions(+), 0 deletions(-)

diff --git a/hw/qdev.c b/hw/qdev.c
index 644a5be..53e9b00 100644
--- a/hw/qdev.c
+++ b/hw/qdev.c
@@ -51,6 +51,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;
@@ -58,6 +59,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;
 }
 
diff --git a/hw/qdev.h b/hw/qdev.h
index 9ecc9ec..115c2d0 100644
--- a/hw/qdev.h
+++ b/hw/qdev.h
@@ -87,8 +87,11 @@ typedef void (*SCSIAttachFn)(DeviceState *host, 
BlockDriverState *bdrv,
 
 struct DeviceInfo {
     const char *name;
+    const char *alias;
+    const char *desc;
     size_t size;
     Property *props;
+    int no_user;
 
     /* Private to qdev / bus.  */
     qdev_initfn init;
-- 
1.6.2.5





reply via email to

[Prev in Thread] Current Thread [Next in Thread]