hw/intc: Avoid using Monitor in INTERRUPT_STATS_PROVIDER::print_info()

Replace Monitor API by HumanReadableText one (see commit f2de406f29
"docs/devel: document expectations for QAPI data modelling for QMP"
for rationale).

Signed-off-by: Philippe Mathieu-Daudé <philmd@linaro.org>
Reviewed-by: Daniel P. Berrangé <berrange@redhat.com>
Message-Id: <20240610063518.50680-2-philmd@linaro.org>
This commit is contained in:
Philippe Mathieu-Daudé 2024-06-07 12:47:04 +02:00
parent a58e653aa2
commit b2580720d0
9 changed files with 57 additions and 68 deletions

View file

@ -25,6 +25,7 @@
#include "qapi/qapi-commands-machine.h"
#include "qapi/qapi-commands-misc.h"
#include "qapi/qmp/qdict.h"
#include "qapi/type-helpers.h"
#include "qemu/cutils.h"
#include "hw/intc/intc.h"
#include "qemu/log.h"
@ -92,7 +93,12 @@ static int hmp_info_pic_foreach(Object *obj, void *opaque)
intc = INTERRUPT_STATS_PROVIDER(obj);
k = INTERRUPT_STATS_PROVIDER_GET_CLASS(obj);
if (k->print_info) {
k->print_info(intc, mon);
g_autoptr(GString) buf = g_string_new("");
g_autoptr(HumanReadableText) info = NULL;
k->print_info(intc, buf);
info = human_readable_text_from_str(buf);
monitor_puts(mon, info->human_readable_text);
} else {
monitor_printf(mon, "Interrupt controller information not available for %s.\n",
object_get_typename(obj));