Commit f32f9ffcfe for qemu.org
commit f32f9ffcfec61face1b9a684d19f64cc2cbcd6ce
Author: Philippe Mathieu-Daudé <philmd@oss.qualcomm.com>
Date: Wed Aug 12 19:33:08 2026 +0200
monitor: Replace container_of(MonitorHMP, parent_obj) -> MONITOR_HMP()
By replacing the container_of(MonitorHMP) use in ui/ui-hmp-cmds.c
we can remove its incorrect inclusion of "monitor/monitor-internal.h"
header, using the public "monitor/monitor.h" instead.
Signed-off-by: Philippe Mathieu-Daudé <philmd@oss.qualcomm.com>
Reviewed-by: Marc-André Lureau <marcandre.lureau@redhat.com>
Message-Id: <20260812211708.92824-23-philmd@oss.qualcomm.com>
diff --git a/monitor/hmp-cmds.c b/monitor/hmp-cmds.c
index bcd0a1fc87..4e8d996dbb 100644
--- a/monitor/hmp-cmds.c
+++ b/monitor/hmp-cmds.c
@@ -290,7 +290,7 @@ void hmp_info_sync_profile(Monitor *mon, const QDict *qdict)
void hmp_info_history(Monitor *mon, const QDict *qdict)
{
- MonitorHMP *hmp = container_of(mon, MonitorHMP, parent_obj);
+ MonitorHMP *hmp = MONITOR_HMP(mon);
int i;
const char *str;
diff --git a/monitor/hmp.c b/monitor/hmp.c
index 46f8d4a6ed..22b1972d34 100644
--- a/monitor/hmp.c
+++ b/monitor/hmp.c
@@ -1520,7 +1520,7 @@ cleanup:
static void monitor_read(void *opaque, const uint8_t *buf, int size)
{
Monitor *mon = opaque;
- MonitorHMP *hmp = container_of(mon, MonitorHMP, parent_obj);
+ MonitorHMP *hmp = MONITOR_HMP(mon);
int i;
if (hmp->rs) {
diff --git a/ui/ui-hmp-cmds.c b/ui/ui-hmp-cmds.c
index 24cf3a6710..806a7bece7 100644
--- a/ui/ui-hmp-cmds.c
+++ b/ui/ui-hmp-cmds.c
@@ -19,7 +19,7 @@
#endif
#include "monitor/hmp.h"
#include "monitor/hmp-completion.h"
-#include "monitor/monitor-internal.h"
+#include "monitor/monitor.h"
#include "qapi/error.h"
#include "qapi/qapi-commands-ui.h"
#include "qobject/qdict.h"
@@ -343,7 +343,7 @@ void hmp_change_vnc(Monitor *mon, const char *device, const char *target,
return;
}
if (!arg) {
- MonitorHMP *hmp = container_of(mon, MonitorHMP, parent_obj);
+ MonitorHMP *hmp = MONITOR_HMP(mon);
monitor_read_password(hmp, hmp_change_read_arg, NULL);
} else {
qmp_change_vnc_password(arg, errp);