2009-03-06 02:01:23 +03:00
|
|
|
#ifndef MONITOR_H
|
|
|
|
#define MONITOR_H
|
|
|
|
|
|
|
|
#include "qemu-common.h"
|
2012-12-17 21:19:43 +04:00
|
|
|
#include "qapi/qmp/qdict.h"
|
2012-12-17 21:19:44 +04:00
|
|
|
#include "block/block.h"
|
2013-11-14 14:54:15 +04:00
|
|
|
#include "qemu/readline.h"
|
2009-03-06 02:01:23 +03:00
|
|
|
|
|
|
|
extern Monitor *cur_mon;
|
|
|
|
|
2009-03-06 02:01:42 +03:00
|
|
|
/* flags for monitor_init */
|
|
|
|
#define MONITOR_IS_DEFAULT 0x01
|
2009-03-06 02:01:51 +03:00
|
|
|
#define MONITOR_USE_READLINE 0x02
|
2009-11-27 03:58:51 +03:00
|
|
|
#define MONITOR_USE_CONTROL 0x04
|
2010-06-07 18:42:31 +04:00
|
|
|
#define MONITOR_USE_PRETTY 0x08
|
2009-03-06 02:01:42 +03:00
|
|
|
|
2015-03-06 22:01:05 +03:00
|
|
|
bool monitor_cur_is_qmp(void);
|
2010-02-11 19:05:43 +03:00
|
|
|
|
2009-03-06 02:01:42 +03:00
|
|
|
void monitor_init(CharDriverState *chr, int flags);
|
2009-03-06 02:01:23 +03:00
|
|
|
|
2009-03-06 02:01:51 +03:00
|
|
|
int monitor_suspend(Monitor *mon);
|
2009-03-06 02:01:23 +03:00
|
|
|
void monitor_resume(Monitor *mon);
|
|
|
|
|
2010-02-11 04:50:01 +03:00
|
|
|
int monitor_read_bdrv_key_start(Monitor *mon, BlockDriverState *bs,
|
2014-10-07 15:59:15 +04:00
|
|
|
BlockCompletionFunc *completion_cb,
|
2010-02-11 04:50:01 +03:00
|
|
|
void *opaque);
|
2011-11-22 23:58:31 +04:00
|
|
|
int monitor_read_block_device_key(Monitor *mon, const char *device,
|
2014-10-07 15:59:15 +04:00
|
|
|
BlockCompletionFunc *completion_cb,
|
2011-11-22 23:58:31 +04:00
|
|
|
void *opaque);
|
2009-03-06 02:01:23 +03:00
|
|
|
|
2012-09-20 18:50:32 +04:00
|
|
|
int monitor_get_fd(Monitor *mon, const char *fdname, Error **errp);
|
2015-02-09 16:03:19 +03:00
|
|
|
int monitor_fd_param(Monitor *mon, const char *fdname, Error **errp);
|
2009-07-22 12:11:41 +04:00
|
|
|
|
2010-09-23 23:28:05 +04:00
|
|
|
void monitor_vprintf(Monitor *mon, const char *fmt, va_list ap)
|
|
|
|
GCC_FMT_ATTR(2, 0);
|
2010-09-23 23:28:03 +04:00
|
|
|
void monitor_printf(Monitor *mon, const char *fmt, ...) GCC_FMT_ATTR(2, 3);
|
2009-03-06 02:01:23 +03:00
|
|
|
void monitor_flush(Monitor *mon);
|
2011-10-06 21:02:57 +04:00
|
|
|
int monitor_set_cpu(int cpu_index);
|
2011-10-24 16:53:44 +04:00
|
|
|
int monitor_get_cpu_index(void);
|
2009-03-06 02:01:23 +03:00
|
|
|
|
2011-09-02 21:34:50 +04:00
|
|
|
void monitor_read_command(Monitor *mon, int show_prompt);
|
|
|
|
int monitor_read_password(Monitor *mon, ReadLineFunc *readline_func,
|
|
|
|
void *opaque);
|
2010-02-17 12:52:26 +03:00
|
|
|
|
qmp: Wean off qerror_report()
The traditional QMP command handler interface
int qmp_FOO(Monitor *mon, const QDict *params, QObject **ret_data);
doesn't provide for returning an Error object. Instead, the handler
is expected to stash it in the monitor with qerror_report().
When we rebased QMP on top of QAPI, we didn't change this interface.
Instead, commit 776574d introduced "middle mode" as a temporary aid
for converting existing QMP commands to QAPI one by one. More than
three years later, we're still using it.
Middle mode has two effects:
* Instead of the native input marshallers
static void qmp_marshal_input_FOO(QDict *, QObject **, Error **)
it generates input marshallers conforming to the traditional QMP
command handler interface.
* It suppresses generation of code to register them with
qmp_register_command()
This permits giving them internal linkage.
As long as we need qmp-commands.hx, we can't use the registry behind
qmp_register_command(), so the latter has to stay for now.
The former has to go to get rid of qerror_report(). Changing all QMP
commands to fit the QAPI mold in one go was impractical back when we
started, but by now there are just a few stragglers left:
do_qmp_capabilities(), qmp_qom_set(), qmp_qom_get(), qmp_object_add(),
qmp_netdev_add(), do_device_add().
Switch middle mode to generate native input marshallers, and adapt the
stragglers. Simplifies both the monitor code and the stragglers.
Rename do_qmp_capabilities() to qmp_capabilities(), and
do_device_add() to qmp_device_add, because that's how QMP command
handlers are named today.
Signed-off-by: Markus Armbruster <armbru@redhat.com>
Reviewed-by: Stefan Hajnoczi <stefanha@redhat.com>
Reviewed-by: Eric Blake <eblake@redhat.com>
Reviewed-by: Luiz Capitulino <lcapitulino@redhat.com>
2015-03-13 19:25:50 +03:00
|
|
|
void qmp_qom_set(QDict *qdict, QObject **ret, Error **errp);
|
|
|
|
void qmp_qom_get(QDict *qdict, QObject **ret, Error **errp);
|
|
|
|
void qmp_object_add(QDict *qdict, QObject **ret, Error **errp);
|
2013-12-21 02:21:10 +04:00
|
|
|
void object_add(const char *type, const char *id, const QDict *qdict,
|
|
|
|
Visitor *v, Error **errp);
|
2011-12-13 00:29:35 +04:00
|
|
|
|
2012-10-18 23:19:32 +04:00
|
|
|
AddfdInfo *monitor_fdset_add_fd(int fd, bool has_fdset_id, int64_t fdset_id,
|
|
|
|
bool has_opaque, const char *opaque,
|
|
|
|
Error **errp);
|
2012-08-15 00:43:47 +04:00
|
|
|
int monitor_fdset_get_fd(int64_t fdset_id, int flags);
|
|
|
|
int monitor_fdset_dup_fd_add(int64_t fdset_id, int dup_fd);
|
2014-08-17 13:45:17 +04:00
|
|
|
void monitor_fdset_dup_fd_remove(int dup_fd);
|
2012-08-15 00:43:47 +04:00
|
|
|
int monitor_fdset_dup_fd_find(int dup_fd);
|
|
|
|
|
2009-03-06 02:01:23 +03:00
|
|
|
#endif /* !MONITOR_H */
|