qemu-commits
[Top][All Lists]
Advanced

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

[Qemu-commits] [COMMIT 3320e56] qdev: add no_user, alias and desc


From: Anthony Liguori
Subject: [Qemu-commits] [COMMIT 3320e56] qdev: add no_user, alias and desc
Date: Thu, 16 Jul 2009 23:12:50 -0000

From: Gerd Hoffmann <address@hidden>

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>
Signed-off-by: Anthony Liguori <address@hidden>

diff --git a/hw/qdev.c b/hw/qdev.c
index cca242f..b76ba5b 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;
 }
 
diff --git a/hw/qdev.h b/hw/qdev.h
index a8a4bcb..73d19fa 100644
--- a/hw/qdev.h
+++ b/hw/qdev.h
@@ -95,8 +95,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;




reply via email to

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