From: "Daniel P. Berrangé" <berrange@redhat.com>
To: qemu-devel@nongnu.org
Cc: "Paolo Bonzini" <pbonzini@redhat.com>,
"Markus Armbruster" <armbru@redhat.com>,
"Christian Brauner" <brauner@kernel.org>,
"Alex Bennée" <alex.bennee@linaro.org>,
"Philippe Mathieu-Daudé" <philmd@linaro.org>,
"Fabiano Rosas" <farosas@suse.de>,
"Marc-André Lureau" <marcandre.lureau@redhat.com>,
"Peter Xu" <peterx@redhat.com>, "Kevin Wolf" <kwolf@redhat.com>,
"Daniel P. Berrangé" <berrange@redhat.com>,
qemu-block@nongnu.org,
"Dr. David Alan Gilbert" <dave@treblig.org>,
"Eric Blake" <eblake@redhat.com>
Subject: [PATCH 02/17] monitor: replace 'common' with 'parent' in MonitorQMP
Date: Fri, 10 Apr 2026 17:04:43 +0100 [thread overview]
Message-ID: <20260410160458.3778874-3-berrange@redhat.com> (raw)
In-Reply-To: <20260410160458.3778874-1-berrange@redhat.com>
The field name 'parent' is standard practice for QOM structs
so align the QMP monitor.
Signed-off-by: Daniel P. Berrangé <berrange@redhat.com>
---
monitor/monitor-internal.h | 2 +-
monitor/monitor.c | 4 ++--
monitor/qmp-cmds-control.c | 4 ++--
monitor/qmp.c | 40 +++++++++++++++++++-------------------
4 files changed, 25 insertions(+), 25 deletions(-)
diff --git a/monitor/monitor-internal.h b/monitor/monitor-internal.h
index ae0cf8c1da..0922588ad9 100644
--- a/monitor/monitor-internal.h
+++ b/monitor/monitor-internal.h
@@ -132,7 +132,7 @@ struct MonitorHMP {
};
typedef struct {
- Monitor common;
+ Monitor parent;
JSONMessageParser parser;
bool pretty;
/*
diff --git a/monitor/monitor.c b/monitor/monitor.c
index 6532796edb..6b183edcf5 100644
--- a/monitor/monitor.c
+++ b/monitor/monitor.c
@@ -308,7 +308,7 @@ static void monitor_qapi_event_emit(QAPIEvent event, QDict *qdict)
continue;
}
- qmp_mon = container_of(mon, MonitorQMP, common);
+ qmp_mon = container_of(mon, MonitorQMP, parent);
{
QEMU_LOCK_GUARD(&mon->mon_lock);
if (qmp_mon->commands == &qmp_cap_negotiation_commands) {
@@ -625,7 +625,7 @@ void monitor_data_destroy(Monitor *mon)
g_free(mon->mon_cpu_path);
qemu_chr_fe_deinit(&mon->chr, false);
if (monitor_is_qmp(mon)) {
- monitor_data_destroy_qmp(container_of(mon, MonitorQMP, common));
+ monitor_data_destroy_qmp(container_of(mon, MonitorQMP, parent));
} else {
readline_free(container_of(mon, MonitorHMP, parent)->rs);
}
diff --git a/monitor/qmp-cmds-control.c b/monitor/qmp-cmds-control.c
index 150ca9f5cb..ca471bc1c7 100644
--- a/monitor/qmp-cmds-control.c
+++ b/monitor/qmp-cmds-control.c
@@ -76,7 +76,7 @@ void qmp_qmp_capabilities(bool has_enable, QMPCapabilityList *enable,
MonitorQMP *mon;
assert(monitor_is_qmp(cur_mon));
- mon = container_of(cur_mon, MonitorQMP, common);
+ mon = container_of(cur_mon, MonitorQMP, parent);
if (mon->commands == &qmp_commands) {
error_set(errp, ERROR_CLASS_COMMAND_NOT_FOUND,
@@ -126,7 +126,7 @@ CommandInfoList *qmp_query_commands(Error **errp)
MonitorQMP *mon;
assert(monitor_is_qmp(cur_mon));
- mon = container_of(cur_mon, MonitorQMP, common);
+ mon = container_of(cur_mon, MonitorQMP, parent);
qmp_for_each_command(mon->commands, query_commands_cb, &list);
diff --git a/monitor/qmp.c b/monitor/qmp.c
index 687019811f..69d9e40e32 100644
--- a/monitor/qmp.c
+++ b/monitor/qmp.c
@@ -80,7 +80,7 @@ static void monitor_qmp_caps_reset(MonitorQMP *mon)
{
memset(mon->capab_offered, 0, sizeof(mon->capab_offered));
memset(mon->capab, 0, sizeof(mon->capab));
- mon->capab_offered[QMP_CAPABILITY_OOB] = mon->common.use_io_thread;
+ mon->capab_offered[QMP_CAPABILITY_OOB] = mon->parent.use_io_thread;
}
static void qmp_request_free(QMPRequest *req)
@@ -124,7 +124,7 @@ static void monitor_qmp_cleanup_queue_and_resume(MonitorQMP *mon)
* when we get here while the monitor is suspended. An
* unfortunately timed CHR_EVENT_CLOSED can do the trick.
*/
- monitor_resume(&mon->common);
+ monitor_resume(&mon->parent);
}
}
@@ -139,7 +139,7 @@ void qmp_send_response(MonitorQMP *mon, const QDict *rsp)
trace_monitor_qmp_respond(mon, json->str);
g_string_append_c(json, '\n');
- monitor_puts(&mon->common, json->str);
+ monitor_puts(&mon->parent, json->str);
g_string_free(json, true);
}
@@ -166,7 +166,7 @@ static void monitor_qmp_dispatch(MonitorQMP *mon, QObject *req)
QDict *error;
rsp = qmp_dispatch(mon->commands, req, qmp_oob_enabled(mon),
- &mon->common);
+ &mon->parent);
if (mon->commands == &qmp_cap_negotiation_commands) {
error = qdict_get_qdict(rsp, "error");
@@ -207,7 +207,7 @@ static QMPRequest *monitor_qmp_requests_pop_any_with_lock(void)
continue;
}
- qmp_mon = container_of(mon, MonitorQMP, common);
+ qmp_mon = container_of(mon, MonitorQMP, parent);
qemu_mutex_lock(&qmp_mon->qmp_queue_lock);
req_obj = g_queue_pop_head(qmp_mon->qmp_requests);
if (req_obj) {
@@ -302,7 +302,7 @@ void coroutine_fn monitor_qmp_dispatcher_co(void *data)
oob_enabled = qmp_oob_enabled(mon);
if (oob_enabled
&& mon->qmp_requests->length == QMP_REQ_QUEUE_LEN_MAX - 1) {
- monitor_resume(&mon->common);
+ monitor_resume(&mon->parent);
}
/*
@@ -343,7 +343,7 @@ void coroutine_fn monitor_qmp_dispatcher_co(void *data)
}
if (!oob_enabled) {
- monitor_resume(&mon->common);
+ monitor_resume(&mon->parent);
}
qmp_request_free(req_obj);
@@ -408,7 +408,7 @@ static void handle_qmp_command(void *opaque, QObject *req, Error *err)
*/
if (!qmp_oob_enabled(mon) ||
mon->qmp_requests->length == QMP_REQ_QUEUE_LEN_MAX - 1) {
- monitor_suspend(&mon->common);
+ monitor_suspend(&mon->parent);
}
/*
@@ -462,7 +462,7 @@ static void monitor_qmp_event(void *opaque, QEMUChrEvent event)
switch (event) {
case CHR_EVENT_OPENED:
- WITH_QEMU_LOCK_GUARD(&mon->common.mon_lock) {
+ WITH_QEMU_LOCK_GUARD(&mon->parent.mon_lock) {
mon->commands = &qmp_cap_negotiation_commands;
monitor_qmp_caps_reset(mon);
}
@@ -504,27 +504,27 @@ static void monitor_qmp_setup_handlers_bh(void *opaque)
MonitorQMP *mon = opaque;
GMainContext *context;
- assert(mon->common.use_io_thread);
+ assert(mon->parent.use_io_thread);
context = iothread_get_g_main_context(mon_iothread);
assert(context);
- qemu_chr_fe_set_handlers(&mon->common.chr, monitor_can_read,
+ qemu_chr_fe_set_handlers(&mon->parent.chr, monitor_can_read,
monitor_qmp_read, monitor_qmp_event,
- NULL, &mon->common, context, true);
- monitor_list_append(&mon->common);
+ NULL, &mon->parent, context, true);
+ monitor_list_append(&mon->parent);
}
void monitor_init_qmp(Chardev *chr, bool pretty, Error **errp)
{
MonitorQMP *mon = g_new0(MonitorQMP, 1);
- if (!qemu_chr_fe_init(&mon->common.chr, chr, errp)) {
+ if (!qemu_chr_fe_init(&mon->parent.chr, chr, errp)) {
g_free(mon);
return;
}
- qemu_chr_fe_set_echo(&mon->common.chr, true);
+ qemu_chr_fe_set_echo(&mon->parent.chr, true);
/* Note: we run QMP monitor in I/O thread when @chr supports that */
- monitor_data_init(&mon->common, true, false,
+ monitor_data_init(&mon->parent, true, false,
qemu_chr_has_feature(chr, QEMU_CHAR_FEATURE_GCONTEXT));
mon->pretty = pretty;
@@ -533,7 +533,7 @@ void monitor_init_qmp(Chardev *chr, bool pretty, Error **errp)
mon->qmp_requests = g_queue_new();
json_message_parser_init(&mon->parser, handle_qmp_command, mon, NULL);
- if (mon->common.use_io_thread) {
+ if (mon->parent.use_io_thread) {
/*
* Make sure the old iowatch is gone. It's possible when
* e.g. the chardev is in client mode, with wait=on.
@@ -553,9 +553,9 @@ void monitor_init_qmp(Chardev *chr, bool pretty, Error **errp)
monitor_qmp_setup_handlers_bh, mon);
/* The bottom half will add @mon to @mon_list */
} else {
- qemu_chr_fe_set_handlers(&mon->common.chr, monitor_can_read,
+ qemu_chr_fe_set_handlers(&mon->parent.chr, monitor_can_read,
monitor_qmp_read, monitor_qmp_event,
- NULL, &mon->common, NULL, true);
- monitor_list_append(&mon->common);
+ NULL, &mon->parent, NULL, true);
+ monitor_list_append(&mon->parent);
}
}
--
2.53.0
next prev parent reply other threads:[~2026-04-10 16:06 UTC|newest]
Thread overview: 32+ messages / expand[flat|nested] mbox.gz Atom feed top
2026-04-10 16:04 [PATCH RFC 00/17] monitor: turn QMP and HMP into QOM objects Daniel P. Berrangé
2026-04-10 16:04 ` [PATCH 01/17] monitor: replace 'common' with 'parent' in MonitorHMP Daniel P. Berrangé
2026-04-10 21:05 ` Dr. David Alan Gilbert
2026-04-10 16:04 ` Daniel P. Berrangé [this message]
2026-04-14 15:15 ` [PATCH 02/17] monitor: replace 'common' with 'parent' in MonitorQMP Mark Cave-Ayland
2026-04-14 15:25 ` Daniel P. Berrangé
2026-04-14 17:54 ` Dr. David Alan Gilbert
2026-04-10 16:04 ` [PATCH 03/17] monitor: rename monitor_init* to monitor_new* Daniel P. Berrangé
2026-04-10 22:57 ` Dr. David Alan Gilbert
2026-04-10 16:04 ` [PATCH 04/17] monitor: minimal conversion of monitors to QOM Daniel P. Berrangé
2026-04-10 23:32 ` Dr. David Alan Gilbert
2026-04-10 16:04 ` [PATCH 05/17] monitor: remove 'skip_flush' field Daniel P. Berrangé
2026-04-13 1:28 ` Dr. David Alan Gilbert
2026-04-13 10:00 ` Daniel P. Berrangé
2026-04-13 15:22 ` Dr. David Alan Gilbert
2026-04-10 16:04 ` [PATCH 06/17] monitor: move monitor_data_(init|destroy) into QOM init/finalize Daniel P. Berrangé
2026-04-10 16:04 ` [PATCH 07/17] monitor: use class methods for monitor_vprintf Daniel P. Berrangé
2026-04-13 1:32 ` Dr. David Alan Gilbert
2026-04-10 16:04 ` [PATCH 08/17] monitor: use class methods for monitor_qapi_event_emit Daniel P. Berrangé
2026-04-10 16:04 ` [PATCH 09/17] monitor: use class methods for monitor_accept_input Daniel P. Berrangé
2026-04-13 17:43 ` Dr. David Alan Gilbert
2026-04-10 16:04 ` [PATCH 10/17] monitor: use dynamic cast in monitor_qmp_requests_pop_any_with_lock Daniel P. Berrangé
2026-04-10 16:04 ` [PATCH 11/17] util: use dynamic cast in error vreport Daniel P. Berrangé
2026-04-10 16:04 ` [PATCH 12/17] monitor: drop unused monitor_cur_is_qmp Daniel P. Berrangé
2026-04-10 16:04 ` [PATCH 13/17] monitor: use dynamic cast in QMP commands Daniel P. Berrangé
2026-04-10 16:04 ` [PATCH 14/17] monitor: use dynamic cast in monitor_is_hmp_non_interactive Daniel P. Berrangé
2026-04-10 16:04 ` [PATCH 15/17] monitor: drop unused monitor_is_qmp method Daniel P. Berrangé
2026-04-10 16:04 ` [PATCH 16/17] monitor: eliminate monitor_is_hmp_non_interactive method Daniel P. Berrangé
2026-04-13 22:47 ` Dr. David Alan Gilbert
2026-04-10 16:04 ` [PATCH 17/17] FIXME: monitor: implement "user creatable" interface Daniel P. Berrangé
2026-04-27 6:35 ` [PATCH RFC 00/17] monitor: turn QMP and HMP into QOM objects Markus Armbruster
2026-04-27 7:04 ` Daniel P. Berrangé
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=20260410160458.3778874-3-berrange@redhat.com \
--to=berrange@redhat.com \
--cc=alex.bennee@linaro.org \
--cc=armbru@redhat.com \
--cc=brauner@kernel.org \
--cc=dave@treblig.org \
--cc=eblake@redhat.com \
--cc=farosas@suse.de \
--cc=kwolf@redhat.com \
--cc=marcandre.lureau@redhat.com \
--cc=pbonzini@redhat.com \
--cc=peterx@redhat.com \
--cc=philmd@linaro.org \
--cc=qemu-block@nongnu.org \
--cc=qemu-devel@nongnu.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.