All of lore.kernel.org
 help / color / mirror / Atom feed
From: "Dr. David Alan Gilbert" <dave@treblig.org>
To: "Daniel P. Berrangé" <berrange@redhat.com>
Cc: qemu-devel@nongnu.org, "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>,
	qemu-block@nongnu.org, "Eric Blake" <eblake@redhat.com>
Subject: Re: [PATCH 03/17] monitor: rename monitor_init* to monitor_new*
Date: Fri, 10 Apr 2026 22:57:54 +0000	[thread overview]
Message-ID: <admAcuqIMrtQ80l4@gallifrey> (raw)
In-Reply-To: <20260410160458.3778874-4-berrange@redhat.com>

* Daniel P. Berrangé (berrange@redhat.com) wrote:
> The current "monitor_init" functions will clash with the methods of the
> same name that are required by QOM. To ease the transition to QOM,
> rename them out of the way.
> 
> Signed-off-by: Daniel P. Berrangé <berrange@redhat.com>

Reviewed-by: Dr. David Alan Gilbert <dave@treblig.org>

> ---
>  chardev/char.c                       |  2 +-
>  gdbstub/system.c                     |  2 +-
>  include/monitor/monitor.h            |  8 ++++----
>  monitor/hmp.c                        |  2 +-
>  monitor/monitor.c                    | 10 +++++-----
>  monitor/qmp.c                        |  2 +-
>  storage-daemon/qemu-storage-daemon.c |  2 +-
>  stubs/monitor-internal.c             |  2 +-
>  system/vl.c                          |  2 +-
>  9 files changed, 16 insertions(+), 16 deletions(-)
> 
> diff --git a/chardev/char.c b/chardev/char.c
> index 48b326d57b..b59972f325 100644
> --- a/chardev/char.c
> +++ b/chardev/char.c
> @@ -786,7 +786,7 @@ static Chardev *qemu_chr_new_from_name(const char *label, const char *filename,
>  
>      if (qemu_opt_get_bool(opts, "mux", 0)) {
>          assert(permit_mux_mon);
> -        monitor_init_hmp(chr, true, &err);
> +        monitor_new_hmp(chr, true, &err);
>          if (err) {
>              error_report_err(err);
>              object_unparent(OBJECT(chr));
> diff --git a/gdbstub/system.c b/gdbstub/system.c
> index e86c5870ab..20dcf7878d 100644
> --- a/gdbstub/system.c
> +++ b/gdbstub/system.c
> @@ -388,7 +388,7 @@ bool gdbserver_start(const char *device, Error **errp)
>          /* Initialize a monitor terminal for gdb */
>          mon_chr = qemu_chardev_new(NULL, TYPE_CHARDEV_GDB,
>                                     NULL, NULL, &error_abort);
> -        monitor_init_hmp(mon_chr, false, &error_abort);
> +        monitor_new_hmp(mon_chr, false, &error_abort);
>      } else {
>          qemu_chr_fe_deinit(&gdbserver_system_state.chr, true);
>          mon_chr = gdbserver_system_state.mon_chr;
> diff --git a/include/monitor/monitor.h b/include/monitor/monitor.h
> index 296690e1f1..bfbb440550 100644
> --- a/include/monitor/monitor.h
> +++ b/include/monitor/monitor.h
> @@ -19,10 +19,10 @@ bool monitor_cur_is_qmp(void);
>  
>  void monitor_init_globals(void);
>  void monitor_init_globals_core(void);
> -void monitor_init_qmp(Chardev *chr, bool pretty, Error **errp);
> -void monitor_init_hmp(Chardev *chr, bool use_readline, Error **errp);
> -int monitor_init(MonitorOptions *opts, bool allow_hmp, Error **errp);
> -int monitor_init_opts(QemuOpts *opts, Error **errp);
> +void monitor_new_qmp(Chardev *chr, bool pretty, Error **errp);
> +void monitor_new_hmp(Chardev *chr, bool use_readline, Error **errp);
> +int monitor_new(MonitorOptions *opts, bool allow_hmp, Error **errp);
> +int monitor_new_opts(QemuOpts *opts, Error **errp);
>  void monitor_cleanup(void);
>  
>  int monitor_suspend(Monitor *mon);
> diff --git a/monitor/hmp.c b/monitor/hmp.c
> index af346d190b..6dfeca84b5 100644
> --- a/monitor/hmp.c
> +++ b/monitor/hmp.c
> @@ -1516,7 +1516,7 @@ static void monitor_readline_flush(void *opaque)
>      monitor_flush(&mon->parent);
>  }
>  
> -void monitor_init_hmp(Chardev *chr, bool use_readline, Error **errp)
> +void monitor_new_hmp(Chardev *chr, bool use_readline, Error **errp)
>  {
>      MonitorHMP *mon = g_new0(MonitorHMP, 1);
>  
> diff --git a/monitor/monitor.c b/monitor/monitor.c
> index 6b183edcf5..393fb7795e 100644
> --- a/monitor/monitor.c
> +++ b/monitor/monitor.c
> @@ -715,7 +715,7 @@ void monitor_init_globals(void)
>      aio_co_schedule(iohandler_get_aio_context(), qmp_dispatcher_co);
>  }
>  
> -int monitor_init(MonitorOptions *opts, bool allow_hmp, Error **errp)
> +int monitor_new(MonitorOptions *opts, bool allow_hmp, Error **errp)
>  {
>      ERRP_GUARD();
>      Chardev *chr;
> @@ -732,7 +732,7 @@ int monitor_init(MonitorOptions *opts, bool allow_hmp, Error **errp)
>  
>      switch (opts->mode) {
>      case MONITOR_MODE_CONTROL:
> -        monitor_init_qmp(chr, opts->pretty, errp);
> +        monitor_new_qmp(chr, opts->pretty, errp);
>          break;
>      case MONITOR_MODE_READLINE:
>          if (!allow_hmp) {
> @@ -743,7 +743,7 @@ int monitor_init(MonitorOptions *opts, bool allow_hmp, Error **errp)
>              error_setg(errp, "'pretty' is not compatible with HMP monitors");
>              return -1;
>          }
> -        monitor_init_hmp(chr, true, errp);
> +        monitor_new_hmp(chr, true, errp);
>          break;
>      default:
>          g_assert_not_reached();
> @@ -752,7 +752,7 @@ int monitor_init(MonitorOptions *opts, bool allow_hmp, Error **errp)
>      return *errp ? -1 : 0;
>  }
>  
> -int monitor_init_opts(QemuOpts *opts, Error **errp)
> +int monitor_new_opts(QemuOpts *opts, Error **errp)
>  {
>      Visitor *v;
>      MonitorOptions *options;
> @@ -765,7 +765,7 @@ int monitor_init_opts(QemuOpts *opts, Error **errp)
>          return -1;
>      }
>  
> -    ret = monitor_init(options, true, errp);
> +    ret = monitor_new(options, true, errp);
>      qapi_free_MonitorOptions(options);
>      return ret;
>  }
> diff --git a/monitor/qmp.c b/monitor/qmp.c
> index 69d9e40e32..9caee70624 100644
> --- a/monitor/qmp.c
> +++ b/monitor/qmp.c
> @@ -513,7 +513,7 @@ static void monitor_qmp_setup_handlers_bh(void *opaque)
>      monitor_list_append(&mon->parent);
>  }
>  
> -void monitor_init_qmp(Chardev *chr, bool pretty, Error **errp)
> +void monitor_new_qmp(Chardev *chr, bool pretty, Error **errp)
>  {
>      MonitorQMP *mon = g_new0(MonitorQMP, 1);
>  
> diff --git a/storage-daemon/qemu-storage-daemon.c b/storage-daemon/qemu-storage-daemon.c
> index eb72561358..50dbfbd97a 100644
> --- a/storage-daemon/qemu-storage-daemon.c
> +++ b/storage-daemon/qemu-storage-daemon.c
> @@ -330,7 +330,7 @@ static void process_options(int argc, char *argv[], bool pre_init_pass)
>                  visit_free(v);
>  
>                  /* TODO Catch duplicate monitor IDs */
> -                monitor_init(monitor, false, &error_fatal);
> +                monitor_new(monitor, false, &error_fatal);
>                  qapi_free_MonitorOptions(monitor);
>                  break;
>              }
> diff --git a/stubs/monitor-internal.c b/stubs/monitor-internal.c
> index 4fece49d53..23d58da184 100644
> --- a/stubs/monitor-internal.c
> +++ b/stubs/monitor-internal.c
> @@ -8,6 +8,6 @@ int monitor_get_fd(Monitor *mon, const char *name, Error **errp)
>      return -1;
>  }
>  
> -void monitor_init_hmp(Chardev *chr, bool use_readline, Error **errp)
> +void monitor_new_hmp(Chardev *chr, bool use_readline, Error **errp)
>  {
>  }
> diff --git a/system/vl.c b/system/vl.c
> index 246623b319..2391811a46 100644
> --- a/system/vl.c
> +++ b/system/vl.c
> @@ -1244,7 +1244,7 @@ static int fsdev_init_func(void *opaque, QemuOpts *opts, Error **errp)
>  
>  static int mon_init_func(void *opaque, QemuOpts *opts, Error **errp)
>  {
> -    return monitor_init_opts(opts, errp);
> +    return monitor_new_opts(opts, errp);
>  }
>  
>  static void monitor_parse(const char *str, const char *mode, bool pretty)
> -- 
> 2.53.0
> 
-- 
 -----Open up your eyes, open up your mind, open up your code -------   
/ Dr. David Alan Gilbert    |       Running GNU/Linux       | Happy  \ 
\        dave @ treblig.org |                               | In Hex /
 \ _________________________|_____ http://www.treblig.org   |_______/


  reply	other threads:[~2026-04-10 22:58 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 ` [PATCH 02/17] monitor: replace 'common' with 'parent' in MonitorQMP Daniel P. Berrangé
2026-04-14 15:15   ` 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 [this message]
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=admAcuqIMrtQ80l4@gallifrey \
    --to=dave@treblig.org \
    --cc=alex.bennee@linaro.org \
    --cc=armbru@redhat.com \
    --cc=berrange@redhat.com \
    --cc=brauner@kernel.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.