[Top][All Lists]
[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
- [Qemu-devel] [PATCH 0/6] qdev patches: properties, id=<tag>, more device info, Gerd Hoffmann, 2009/07/15
- [Qemu-devel] [PATCH 2/6] qdev: factor out driver search to qdev_find_info(), Gerd Hoffmann, 2009/07/15
- [Qemu-devel] [PATCH 3/6] qdev: add no_user, alias and desc,
Gerd Hoffmann <=
- [Qemu-devel] [PATCH 4/6] qdev: add user-specified identifier to devices., Gerd Hoffmann, 2009/07/15
- [Qemu-devel] [PATCH 5/6] qdev: add id= support for pci nics., Gerd Hoffmann, 2009/07/15
- [Qemu-devel] [PATCH 6/6] qdev: print device id in "info pci"., Gerd Hoffmann, 2009/07/15
- [Qemu-devel] [PATCH 1/6] qdev: rework device properties., Gerd Hoffmann, 2009/07/15