monitor: rename monitor_init* to monitor_new*
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. Reviewed-by: Marc-André Lureau <marcandre.lureau@redhat.com> Reviewed-by: Dr. David Alan Gilbert <dave@treblig.org> Tested-by: Peter Krempa <pkrempa@redhat.com> Signed-off-by: Daniel P. Berrangé <berrange@redhat.com> Message-ID: <20260706135824.2623960-5-berrange@redhat.com> Signed-off-by: Markus Armbruster <armbru@redhat.com>
Daniel P. Berrangé committed
Jul 6, 2026 at 14:57 UTC
fc500ce4d3f2f38cafe0bb0fd93d7d9878e354bf
9 files changed
+16
-16
chardev/char.c
+1
-1
@@ -805,7 +805,7 @@ static Chardev *qemu_chr_new_from_name(const char *label, const char *filename,
805
806
if (qemu_opt_get_bool(opts, "mux", 0)) {
807
assert(permit_mux_mon);
808
- monitor_init_hmp(chr, true, &err);
808
+ monitor_new_hmp(chr, true, &err);
809
if (err) {
810
error_report_err(err);
811
object_unparent(OBJECT(chr));
gdbstub/system.c
+1
-1
@@ -390,7 +390,7 @@ bool gdbserver_start(const char *device, Error **errp)
390
/* Initialize a monitor terminal for gdb */
391
mon_chr = qemu_chardev_new(NULL, TYPE_CHARDEV_GDB,
392
NULL, NULL, &error_abort);
393
- monitor_init_hmp(mon_chr, false, &error_abort);
393
+ monitor_new_hmp(mon_chr, false, &error_abort);
394
} else {
395
qemu_chr_fe_deinit(&gdbserver_system_state.chr, true);
396
mon_chr = gdbserver_system_state.mon_chr;
include/monitor/monitor.h
+4
-4
@@ -19,10 +19,10 @@ bool monitor_cur_is_qmp(void);
19
20
void monitor_init_globals(void);
21
void monitor_init_globals_core(void);
22
-void monitor_init_qmp(Chardev *chr, bool pretty, Error **errp);
23
-void monitor_init_hmp(Chardev *chr, bool use_readline, Error **errp);
24
-int monitor_init(MonitorOptions *opts, bool allow_hmp, Error **errp);
25
-int monitor_init_opts(QemuOpts *opts, Error **errp);
22
+void monitor_new_qmp(Chardev *chr, bool pretty, Error **errp);
23
+void monitor_new_hmp(Chardev *chr, bool use_readline, Error **errp);
24
+int monitor_new(MonitorOptions *opts, bool allow_hmp, Error **errp);
25
+int monitor_new_opts(QemuOpts *opts, Error **errp);
26
void monitor_cleanup(void);
27
28
int monitor_suspend(Monitor *mon);
monitor/hmp.c
+1
-1
@@ -1524,7 +1524,7 @@ static void monitor_readline_flush(void *opaque)
1524
monitor_flush(&mon->parent_obj);
1525
}
1526
1527
-void monitor_init_hmp(Chardev *chr, bool use_readline, Error **errp)
1527
+void monitor_new_hmp(Chardev *chr, bool use_readline, Error **errp)
1528
{
1529
MonitorHMP *mon = g_new0(MonitorHMP, 1);
1530
monitor/monitor.c
+5
-5
@@ -715,7 +715,7 @@ void monitor_init_globals(void)
715
aio_co_schedule(iohandler_get_aio_context(), qmp_dispatcher_co);
716
}
717
718
-int monitor_init(MonitorOptions *opts, bool allow_hmp, Error **errp)
718
+int monitor_new(MonitorOptions *opts, bool allow_hmp, Error **errp)
719
{
720
ERRP_GUARD();
721
Chardev *chr;
@@ -732,7 +732,7 @@ int monitor_init(MonitorOptions *opts, bool allow_hmp, Error **errp)
732
733
switch (opts->mode) {
734
case MONITOR_MODE_CONTROL:
735
- monitor_init_qmp(chr, opts->pretty, errp);
735
+ monitor_new_qmp(chr, opts->pretty, errp);
736
break;
737
case MONITOR_MODE_READLINE:
738
if (!allow_hmp) {
@@ -743,7 +743,7 @@ int monitor_init(MonitorOptions *opts, bool allow_hmp, Error **errp)
743
error_setg(errp, "'pretty' is not compatible with HMP monitors");
744
return -1;
745
}
746
- monitor_init_hmp(chr, true, errp);
746
+ monitor_new_hmp(chr, true, errp);
747
break;
748
default:
749
g_assert_not_reached();
@@ -752,7 +752,7 @@ int monitor_init(MonitorOptions *opts, bool allow_hmp, Error **errp)
752
return *errp ? -1 : 0;
753
}
754
755
-int monitor_init_opts(QemuOpts *opts, Error **errp)
755
+int monitor_new_opts(QemuOpts *opts, Error **errp)
756
{
757
Visitor *v;
758
MonitorOptions *options;
@@ -765,7 +765,7 @@ int monitor_init_opts(QemuOpts *opts, Error **errp)
765
return -1;
766
}
767
768
- ret = monitor_init(options, true, errp);
768
+ ret = monitor_new(options, true, errp);
769
qapi_free_MonitorOptions(options);
770
return ret;
771
}
monitor/qmp.c
+1
-1
@@ -513,7 +513,7 @@ static void monitor_qmp_setup_handlers_bh(void *opaque)
513
monitor_list_append(&mon->parent_obj);
514
}
515
516
-void monitor_init_qmp(Chardev *chr, bool pretty, Error **errp)
516
+void monitor_new_qmp(Chardev *chr, bool pretty, Error **errp)
517
{
518
MonitorQMP *mon = g_new0(MonitorQMP, 1);
519
storage-daemon/qemu-storage-daemon.c
+1
-1
@@ -330,7 +330,7 @@ static void process_options(int argc, char *argv[], bool pre_init_pass)
330
visit_free(v);
331
332
/* TODO Catch duplicate monitor IDs */
333
- monitor_init(monitor, false, &error_fatal);
333
+ monitor_new(monitor, false, &error_fatal);
334
qapi_free_MonitorOptions(monitor);
335
break;
336
}
stubs/monitor-internal.c
+1
-1
@@ -8,6 +8,6 @@ int monitor_get_fd(Monitor *mon, const char *name, Error **errp)
8
return -1;
9
}
10
11
-void monitor_init_hmp(Chardev *chr, bool use_readline, Error **errp)
11
+void monitor_new_hmp(Chardev *chr, bool use_readline, Error **errp)
12
{
13
}
system/vl.c
+1
-1
@@ -1247,7 +1247,7 @@ static int fsdev_init_func(void *opaque, QemuOpts *opts, Error **errp)
1247
1248
static int mon_init_func(void *opaque, QemuOpts *opts, Error **errp)
1249
{
1250
- return monitor_init_opts(opts, errp);
1250
+ return monitor_new_opts(opts, errp);
1251
}
1252
1253
static void monitor_parse(const char *str, const char *mode, bool pretty)