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>
This commit is contained in:
parent
b6b6114460
commit
3320e56e54
12
hw/qdev.c
12
hw/qdev.c
|
@ -50,6 +50,7 @@ static DeviceInfo *qdev_find_info(BusInfo *bus_info, const char *name)
|
||||||
{
|
{
|
||||||
DeviceInfo *info;
|
DeviceInfo *info;
|
||||||
|
|
||||||
|
/* first check device names */
|
||||||
for (info = device_info_list; info != NULL; info = info->next) {
|
for (info = device_info_list; info != NULL; info = info->next) {
|
||||||
if (bus_info && info->bus_info != bus_info)
|
if (bus_info && info->bus_info != bus_info)
|
||||||
continue;
|
continue;
|
||||||
|
@ -57,6 +58,17 @@ static DeviceInfo *qdev_find_info(BusInfo *bus_info, const char *name)
|
||||||
continue;
|
continue;
|
||||||
return info;
|
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;
|
return NULL;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -95,8 +95,11 @@ typedef void (*SCSIAttachFn)(DeviceState *host, BlockDriverState *bdrv,
|
||||||
|
|
||||||
struct DeviceInfo {
|
struct DeviceInfo {
|
||||||
const char *name;
|
const char *name;
|
||||||
|
const char *alias;
|
||||||
|
const char *desc;
|
||||||
size_t size;
|
size_t size;
|
||||||
Property *props;
|
Property *props;
|
||||||
|
int no_user;
|
||||||
|
|
||||||
/* Private to qdev / bus. */
|
/* Private to qdev / bus. */
|
||||||
qdev_initfn init;
|
qdev_initfn init;
|
||||||
|
|
Loading…
Reference in a new issue