qom: Move HMP commands from monitor/ to qom/

This moves these commands from MAINTAINERS sections "Human
Monitor (HMP)" and "QMP" to "QOM".

Signed-off-by: Markus Armbruster <armbru@redhat.com>
Message-Id: <20230124121946.1139465-12-armbru@redhat.com>
Reviewed-by: Philippe Mathieu-Daudé <philmd@linaro.org>
master
Markus Armbruster 2023-01-24 13:19:25 +01:00
parent 85ea9dfedd
commit cffaca0fab
3 changed files with 67 additions and 68 deletions

View File

@ -40,7 +40,6 @@
#include "qapi/qmp/qerror.h"
#include "qapi/string-input-visitor.h"
#include "qapi/string-output-visitor.h"
#include "qom/object_interfaces.h"
#include "qemu/cutils.h"
#include "qemu/error-report.h"
#include "hw/core/cpu.h"
@ -1054,15 +1053,6 @@ void hmp_netdev_del(Monitor *mon, const QDict *qdict)
hmp_handle_error(mon, err);
}
void hmp_object_add(Monitor *mon, const QDict *qdict)
{
const char *options = qdict_get_str(qdict, "object");
Error *err = NULL;
user_creatable_add_from_str(options, &err);
hmp_handle_error(mon, err);
}
void hmp_getfd(Monitor *mon, const QDict *qdict)
{
const char *fdname = qdict_get_str(qdict, "fdname");
@ -1081,15 +1071,6 @@ void hmp_closefd(Monitor *mon, const QDict *qdict)
hmp_handle_error(mon, err);
}
void hmp_object_del(Monitor *mon, const QDict *qdict)
{
const char *id = qdict_get_str(qdict, "id");
Error *err = NULL;
user_creatable_del(id, &err);
hmp_handle_error(mon, err);
}
void hmp_info_iothreads(Monitor *mon, const QDict *qdict)
{
IOThreadInfoList *info_list = qmp_query_iothreads(NULL);

View File

@ -38,7 +38,6 @@
#include "sysemu/device_tree.h"
#include "qapi/qmp/qdict.h"
#include "qapi/qmp/qerror.h"
#include "qom/object_interfaces.h"
#include "monitor/hmp-target.h"
#include "monitor/hmp.h"
#include "exec/address-spaces.h"
@ -48,7 +47,6 @@
#include "qapi/qapi-commands-control.h"
#include "qapi/qapi-commands-migration.h"
#include "qapi/qapi-commands-misc.h"
#include "qapi/qapi-commands-qom.h"
#include "qapi/qapi-commands-run-state.h"
#include "qapi/qapi-commands-machine.h"
#include "qapi/qapi-init-commands.h"
@ -1310,30 +1308,6 @@ void device_add_completion(ReadLineState *rs, int nb_args, const char *str)
g_slist_free(list);
}
void object_add_completion(ReadLineState *rs, int nb_args, const char *str)
{
GSList *list, *elt;
size_t len;
if (nb_args != 2) {
return;
}
len = strlen(str);
readline_set_completion_index(rs, len);
list = elt = object_class_get_list(TYPE_USER_CREATABLE, false);
while (elt) {
const char *name;
name = object_class_get_name(OBJECT_CLASS(elt->data));
if (strcmp(name, TYPE_USER_CREATABLE)) {
readline_add_completion_of(rs, str, name);
}
elt = elt->next;
}
g_slist_free(list);
}
static int qdev_add_hotpluggable_device(Object *obj, void *opaque)
{
GSList **list = opaque;
@ -1391,29 +1365,6 @@ void device_del_completion(ReadLineState *rs, int nb_args, const char *str)
peripheral_device_del_completion(rs, str);
}
void object_del_completion(ReadLineState *rs, int nb_args, const char *str)
{
ObjectPropertyInfoList *list, *start;
size_t len;
if (nb_args != 2) {
return;
}
len = strlen(str);
readline_set_completion_index(rs, len);
start = list = qmp_qom_list("/objects", NULL);
while (list) {
ObjectPropertyInfo *info = list->value;
if (!strncmp(info->type, "child<", 5)) {
readline_add_completion_of(rs, str, info->name);
}
list = list->next;
}
qapi_free_ObjectPropertyInfoList(start);
}
void set_link_completion(ReadLineState *rs, int nb_args, const char *str)
{
size_t len;

View File

@ -13,7 +13,9 @@
#include "qapi/qapi-commands-qom.h"
#include "qapi/qmp/qdict.h"
#include "qapi/qmp/qjson.h"
#include "qemu/readline.h"
#include "qom/object.h"
#include "qom/object_interfaces.h"
void hmp_qom_list(Monitor *mon, const QDict *qdict)
{
@ -150,3 +152,68 @@ void hmp_info_qom_tree(Monitor *mon, const QDict *dict)
}
print_qom_composition(mon, obj, 0);
}
void hmp_object_add(Monitor *mon, const QDict *qdict)
{
const char *options = qdict_get_str(qdict, "object");
Error *err = NULL;
user_creatable_add_from_str(options, &err);
hmp_handle_error(mon, err);
}
void hmp_object_del(Monitor *mon, const QDict *qdict)
{
const char *id = qdict_get_str(qdict, "id");
Error *err = NULL;
user_creatable_del(id, &err);
hmp_handle_error(mon, err);
}
void object_add_completion(ReadLineState *rs, int nb_args, const char *str)
{
GSList *list, *elt;
size_t len;
if (nb_args != 2) {
return;
}
len = strlen(str);
readline_set_completion_index(rs, len);
list = elt = object_class_get_list(TYPE_USER_CREATABLE, false);
while (elt) {
const char *name;
name = object_class_get_name(OBJECT_CLASS(elt->data));
if (strcmp(name, TYPE_USER_CREATABLE)) {
readline_add_completion_of(rs, str, name);
}
elt = elt->next;
}
g_slist_free(list);
}
void object_del_completion(ReadLineState *rs, int nb_args, const char *str)
{
ObjectPropertyInfoList *list, *start;
size_t len;
if (nb_args != 2) {
return;
}
len = strlen(str);
readline_set_completion_index(rs, len);
start = list = qmp_qom_list("/objects", NULL);
while (list) {
ObjectPropertyInfo *info = list->value;
if (!strncmp(info->type, "child<", 5)) {
readline_add_completion_of(rs, str, info->name);
}
list = list->next;
}
qapi_free_ObjectPropertyInfoList(start);
}