These functions access mon_cpu_path, which is a MonitorHMP-specific field. Narrowing their signatures from Monitor* to MonitorHMP* makes the type system enforce what was already true at runtime: every caller is in an HMP context. The expression parser's MONITOR_HMP() casts are safe because it is only reachable from handle_hmp_command(), they will be dropped with later patches. 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-36-9227de146347@redhat.com>
52 lines
1.6 KiB
C
52 lines
1.6 KiB
C
#ifndef MONITOR_H
|
|
#define MONITOR_H
|
|
|
|
#include "qapi/qapi-types-misc.h"
|
|
#include "qemu/coroutine-core.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_QMP "monitor-qmp"
|
|
OBJECT_DECLARE_TYPE(MonitorQMP, MonitorQMPClass, MONITOR_QMP);
|
|
|
|
typedef struct MonitorOptions MonitorOptions;
|
|
|
|
#define QMP_REQ_QUEUE_LEN_MAX 8
|
|
|
|
extern QemuOptsList qemu_mon_opts;
|
|
|
|
Monitor *monitor_cur(void);
|
|
Monitor *monitor_set_cur(Coroutine *co, Monitor *mon);
|
|
|
|
void monitor_init_globals(void);
|
|
void monitor_init_globals_core(void);
|
|
char *monitor_compat_id(void);
|
|
void monitor_new_qmp(const char *id, const char *chardev_id,
|
|
bool pretty, Error **errp);
|
|
int monitor_new(MonitorOptions *opts, bool allow_hmp, Error **errp);
|
|
int monitor_new_opts(QemuOpts *opts, Error **errp);
|
|
void monitor_cleanup(void);
|
|
|
|
void monitor_suspend(Monitor *mon);
|
|
void monitor_resume(Monitor *mon);
|
|
|
|
int monitor_get_fd(Monitor *mon, const char *fdname, Error **errp);
|
|
int monitor_fd_param(Monitor *mon, const char *fdname, Error **errp);
|
|
|
|
int monitor_puts(Monitor *mon, const char *str);
|
|
void monitor_flush(Monitor *mon);
|
|
|
|
int monitor_puts_locked(Monitor *mon, const char *str);
|
|
void monitor_flush_locked(Monitor *mon);
|
|
|
|
AddfdInfo *monitor_fdset_add_fd(int fd, bool has_fdset_id, int64_t fdset_id,
|
|
const char *opaque, Error **errp);
|
|
int monitor_fdset_dup_fd_add(int64_t fdset_id, int flags, Error **errp);
|
|
void monitor_fdset_dup_fd_remove(int dup_fd);
|
|
|
|
#endif /* MONITOR_H */
|