mirror of
https://github.com/qemu/qemu.git
synced 2026-07-08 17:56:38 +00:00
monitor: minimal conversion of monitors to QOM
This introduces abstract QOM type "monitor", with concrete subtypes "monitor-hmp" and "monitor-qmp". This is the bare minimum conversion of just the type declarations and replacing g_new/g_free with object_new/object_unref. Command line option "-monitor" now creates a "monitor-hmp" object "/objects/compat_monitorNNN" in addition to the character device "/chardevs/compat_monitorNNN". NNN counts up from zero. Exception: "-monitor chardev:ID" creates a "monitor-hmp" object "/objects/ID", and does not create a character device. "-qmp" and "-qmp-pretty" work the same, except they create a "monitor-qmp" object. "-mon" now creates either a "monitor-hmp" or "monitor-qmp" object "/objects/ID" if the option argument provides an ID, else "/objects/compat_monitorNNN". "-gdbstub" and "-serial mon:..." now create a "monitor-hmp" object "/objects/compat_monitorNNN". Note that the object's name in "/objects/" matches the QemuOpts ID when it exists. The only cases where it doesn't exist are "-mon" without ID, "-gdbstub" and "-serial mon:". A future patch will make "monitor-hmp" and "monitor-qmp" work with "-object" and "object-add". Note: there is a slight change in the NNN values assigned. The old code would increment the counter for every monitor added (except for -mon, -serial mon:..., -gdbstub), regardless of whether it needed a "compat_monitorNNN" ID assignment. Now it is only incremented when an automatic ID assigned is needed (but even for -mon, -serial mon:..., -gdbstub). Signed-off-by: Daniel P. Berrangé <berrange@redhat.com> Message-ID: <20260706135824.2623960-6-berrange@redhat.com> Reviewed-by: Markus Armbruster <armbru@redhat.com> [Commit message made slightly more precise] Signed-off-by: Markus Armbruster <armbru@redhat.com>
This commit is contained in:
committed by
Markus Armbruster
parent
fc500ce4d3
commit
f96eac8a4f
@@ -5,8 +5,17 @@
|
||||
#include "qapi/qapi-types-misc.h"
|
||||
#include "qemu/readline.h"
|
||||
#include "exec/hwaddr.h"
|
||||
#include "qom/object.h"
|
||||
|
||||
#define TYPE_MONITOR "monitor"
|
||||
OBJECT_DECLARE_TYPE(Monitor, MonitorClass, MONITOR);
|
||||
|
||||
#define TYPE_MONITOR_HMP "monitor-hmp"
|
||||
OBJECT_DECLARE_TYPE(MonitorHMP, MonitorHMPClass, MONITOR_HMP);
|
||||
|
||||
#define TYPE_MONITOR_QMP "monitor-qmp"
|
||||
OBJECT_DECLARE_TYPE(MonitorQMP, MonitorQMPClass, MONITOR_QMP);
|
||||
|
||||
typedef struct MonitorHMP MonitorHMP;
|
||||
typedef struct MonitorOptions MonitorOptions;
|
||||
|
||||
#define QMP_REQ_QUEUE_LEN_MAX 8
|
||||
@@ -19,8 +28,11 @@ bool monitor_cur_is_qmp(void);
|
||||
|
||||
void monitor_init_globals(void);
|
||||
void monitor_init_globals_core(void);
|
||||
void monitor_new_qmp(Chardev *chr, bool pretty, Error **errp);
|
||||
void monitor_new_hmp(Chardev *chr, bool use_readline, Error **errp);
|
||||
char *monitor_compat_id(void);
|
||||
void monitor_new_qmp(const char *id, Chardev *chr,
|
||||
bool pretty, Error **errp);
|
||||
void monitor_new_hmp(const char *id, 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);
|
||||
|
||||
Reference in New Issue
Block a user