monitor: add monitor_cur_hmp() helper
This will help to simplify the code in the following changes. Reviewed-by: Dr. David Alan Gilbert <dave@treblig.org> Signed-off-by: Marc-André Lureau <marcandre.lureau@redhat.com> Message-ID: <20260828-qemu-no-hmp-v5-33-9227de146347@redhat.com>
This commit is contained in:
1 parent
06c1600b55
commit
7204d4c2c0
4 files changed
+22
No files matched your search
@@ -36,6 +36,8 @@ struct MonitorDef {
|
||||
void monitor_new_hmp(const char *id, const char *chardev_id,
|
||||
bool use_readline, Error **errp);
|
||||
|
||||
MonitorHMP *monitor_cur_hmp(void);
|
||||
|
||||
int monitor_vprintf(Monitor *mon, const char *fmt, va_list ap)
|
||||
G_GNUC_PRINTF(2, 0);
|
||||
int monitor_printf(Monitor *mon, const char *fmt, ...) G_GNUC_PRINTF(2, 3);
|
||||
|
||||
@@ -47,6 +47,16 @@
|
||||
|
||||
OBJECT_DEFINE_TYPE(MonitorHMP, monitor_hmp, MONITOR_HMP, MONITOR);
|
||||
|
||||
MonitorHMP *monitor_cur_hmp(void)
|
||||
{
|
||||
Monitor *mon = monitor_cur();
|
||||
if (mon) {
|
||||
return (MonitorHMP *)object_dynamic_cast(OBJECT(mon),
|
||||
TYPE_MONITOR_HMP);
|
||||
}
|
||||
return NULL;
|
||||
}
|
||||
|
||||
static void monitor_hmp_finalize(Object *obj)
|
||||
{
|
||||
MonitorHMP *hmp = MONITOR_HMP(obj);
|
||||
|
||||
@@ -7,6 +7,7 @@ stub_ss.add(files('fdset.c'))
|
||||
stub_ss.add(files('iothread-lock.c'))
|
||||
stub_ss.add(files('is-daemonized.c'))
|
||||
stub_ss.add(files('monitor-core.c'))
|
||||
stub_ss.add(files('monitor-hmp.c'))
|
||||
stub_ss.add(files('replay-mode.c'))
|
||||
stub_ss.add(files('trace-control.c'))
|
||||
|
||||
|
||||
@@ -0,0 +1,9 @@
|
||||
/* SPDX-License-Identifier: GPL-2.0-or-later */
|
||||
|
||||
#include "qemu/osdep.h"
|
||||
#include "monitor/hmp.h"
|
||||
|
||||
MonitorHMP *monitor_cur_hmp(void)
|
||||
{
|
||||
return NULL;
|
||||
}
|
||||
Reference in new issue
Block a user