@samitouri / QOSamiQemu / commits / f32f9ffcfe

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>

Philippe Mathieu-Daudé committed Aug 12, 2026 at 19:33 UTC f32f9ffcfec61face1b9a684d19f64cc2cbcd6ce
3 files changed +4 -4
monitor/hmp-cmds.c
+1 -1
@@ -290,7 +290,7 @@ void hmp_info_sync_profile(Monitor *mon, const QDict *qdict)
290
291 void hmp_info_history(Monitor *mon, const QDict *qdict)
292 {
293 - MonitorHMP *hmp = container_of(mon, MonitorHMP, parent_obj);
293 + MonitorHMP *hmp = MONITOR_HMP(mon);
294 int i;
295 const char *str;
296
monitor/hmp.c
+1 -1
@@ -1520,7 +1520,7 @@ cleanup:
1520 static void monitor_read(void *opaque, const uint8_t *buf, int size)
1521 {
1522 Monitor *mon = opaque;
1523 - MonitorHMP *hmp = container_of(mon, MonitorHMP, parent_obj);
1523 + MonitorHMP *hmp = MONITOR_HMP(mon);
1524 int i;
1525
1526 if (hmp->rs) {
ui/ui-hmp-cmds.c
+2 -2
@@ -19,7 +19,7 @@
19 #endif
20 #include "monitor/hmp.h"
21 #include "monitor/hmp-completion.h"
22 -#include "monitor/monitor-internal.h"
22 +#include "monitor/monitor.h"
23 #include "qapi/error.h"
24 #include "qapi/qapi-commands-ui.h"
25 #include "qobject/qdict.h"
@@ -343,7 +343,7 @@ void hmp_change_vnc(Monitor *mon, const char *device, const char *target,
343 return;
344 }
345 if (!arg) {
346 - MonitorHMP *hmp = container_of(mon, MonitorHMP, parent_obj);
346 + MonitorHMP *hmp = MONITOR_HMP(mon);
347 monitor_read_password(hmp, hmp_change_read_arg, NULL);
348 } else {
349 qmp_change_vnc_password(arg, errp);