mirror of https://gitee.com/openkylin/qemu.git
monitor: convert do_device_del() to QObject, QError
Signed-off-by: Markus Armbruster <armbru@redhat.com> Signed-off-by: Luiz Capitulino <lcapitulino@redhat.com>
This commit is contained in:
parent
cc601cb785
commit
17a38eaa2f
|
@ -799,15 +799,15 @@ int do_device_add(Monitor *mon, const QDict *qdict, QObject **ret_data)
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
void do_device_del(Monitor *mon, const QDict *qdict)
|
int do_device_del(Monitor *mon, const QDict *qdict, QObject **ret_data)
|
||||||
{
|
{
|
||||||
const char *id = qdict_get_str(qdict, "id");
|
const char *id = qdict_get_str(qdict, "id");
|
||||||
DeviceState *dev;
|
DeviceState *dev;
|
||||||
|
|
||||||
dev = qdev_find_recursive(main_system_bus, id);
|
dev = qdev_find_recursive(main_system_bus, id);
|
||||||
if (NULL == dev) {
|
if (NULL == dev) {
|
||||||
error_report("Device '%s' not found", id);
|
qerror_report(QERR_DEVICE_NOT_FOUND, id);
|
||||||
return;
|
return -1;
|
||||||
}
|
}
|
||||||
qdev_unplug(dev);
|
return qdev_unplug(dev);
|
||||||
}
|
}
|
||||||
|
|
|
@ -176,7 +176,7 @@ void qbus_free(BusState *bus);
|
||||||
void do_info_qtree(Monitor *mon);
|
void do_info_qtree(Monitor *mon);
|
||||||
void do_info_qdm(Monitor *mon);
|
void do_info_qdm(Monitor *mon);
|
||||||
int do_device_add(Monitor *mon, const QDict *qdict, QObject **ret_data);
|
int do_device_add(Monitor *mon, const QDict *qdict, QObject **ret_data);
|
||||||
void do_device_del(Monitor *mon, const QDict *qdict);
|
int do_device_del(Monitor *mon, const QDict *qdict, QObject **ret_data);
|
||||||
|
|
||||||
/*** qdev-properties.c ***/
|
/*** qdev-properties.c ***/
|
||||||
|
|
||||||
|
|
|
@ -589,7 +589,8 @@ ETEXI
|
||||||
.args_type = "id:s",
|
.args_type = "id:s",
|
||||||
.params = "device",
|
.params = "device",
|
||||||
.help = "remove device",
|
.help = "remove device",
|
||||||
.mhandler.cmd = do_device_del,
|
.user_print = monitor_user_noop,
|
||||||
|
.mhandler.cmd_new = do_device_del,
|
||||||
},
|
},
|
||||||
|
|
||||||
STEXI
|
STEXI
|
||||||
|
|
Loading…
Reference in New Issue