aboutsummaryrefslogtreecommitdiff
path: root/monitor.c
diff options
context:
space:
mode:
authorMarc-André Lureau <marcandre.lureau@redhat.com>2016-10-22 12:52:55 +0300
committerPaolo Bonzini <pbonzini@redhat.com>2016-10-24 15:27:21 +0200
commit5345fdb4467816c44f6752b3a1f4e73aa25919f9 (patch)
tree9930cf4370d2325d113408f7b314cd77aa43f8a3 /monitor.c
parentfbf3cc3a67a7131e258764aa1f19d5324e9e9f7a (diff)
char: use qemu_chr_fe* functions with CharBackend argument
This also switches from qemu_chr_add_handlers() to qemu_chr_fe_set_handlers(). Note that qemu_chr_fe_set_handlers() now takes the focus when fe_open (qemu_chr_add_handlers() did take the focus) Signed-off-by: Marc-André Lureau <marcandre.lureau@redhat.com> Message-Id: <20161022095318.17775-16-marcandre.lureau@redhat.com> Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>
Diffstat (limited to 'monitor.c')
-rw-r--r--monitor.c20
1 files changed, 10 insertions, 10 deletions
diff --git a/monitor.c b/monitor.c
index 40712f7046..1c6f28fca6 100644
--- a/monitor.c
+++ b/monitor.c
@@ -297,7 +297,7 @@ static void monitor_flush_locked(Monitor *mon)
len = qstring_get_length(mon->outbuf);
if (len && !mon->mux_out) {
- rc = qemu_chr_fe_write(mon->chr.chr, (const uint8_t *) buf, len);
+ rc = qemu_chr_fe_write(&mon->chr, (const uint8_t *) buf, len);
if ((rc < 0 && errno != EAGAIN) || (rc == len)) {
/* all flushed or error */
QDECREF(mon->outbuf);
@@ -312,7 +312,7 @@ static void monitor_flush_locked(Monitor *mon)
}
if (mon->out_watch == 0) {
mon->out_watch =
- qemu_chr_fe_add_watch(mon->chr.chr, G_IO_OUT | G_IO_HUP,
+ qemu_chr_fe_add_watch(&mon->chr, G_IO_OUT | G_IO_HUP,
monitor_unblocked, mon);
}
}
@@ -583,7 +583,7 @@ static void monitor_data_init(Monitor *mon)
static void monitor_data_destroy(Monitor *mon)
{
if (mon->chr.chr) {
- qemu_chr_add_handlers(mon->chr.chr, NULL, NULL, NULL, NULL);
+ qemu_chr_fe_set_handlers(&mon->chr, NULL, NULL, NULL, NULL, NULL);
}
if (monitor_is_qmp(mon)) {
json_message_parser_destroy(&mon->qmp.parser);
@@ -1746,7 +1746,7 @@ void qmp_getfd(const char *fdname, Error **errp)
mon_fd_t *monfd;
int fd;
- fd = qemu_chr_fe_get_msgfd(cur_mon->chr.chr);
+ fd = qemu_chr_fe_get_msgfd(&cur_mon->chr);
if (fd == -1) {
error_setg(errp, QERR_FD_NOT_SUPPLIED);
return;
@@ -1871,7 +1871,7 @@ AddfdInfo *qmp_add_fd(bool has_fdset_id, int64_t fdset_id, bool has_opaque,
Monitor *mon = cur_mon;
AddfdInfo *fdinfo;
- fd = qemu_chr_fe_get_msgfd(mon->chr.chr);
+ fd = qemu_chr_fe_get_msgfd(&mon->chr);
if (fd == -1) {
error_setg(errp, QERR_FD_NOT_SUPPLIED);
goto error;
@@ -3989,13 +3989,13 @@ void monitor_init(CharDriverState *chr, int flags)
}
if (monitor_is_qmp(mon)) {
- qemu_chr_add_handlers(chr, monitor_can_read, monitor_qmp_read,
- monitor_qmp_event, mon);
- qemu_chr_fe_set_echo(chr, true);
+ qemu_chr_fe_set_handlers(&mon->chr, monitor_can_read, monitor_qmp_read,
+ monitor_qmp_event, mon, NULL);
+ qemu_chr_fe_set_echo(&mon->chr, true);
json_message_parser_init(&mon->qmp.parser, handle_qmp_command);
} else {
- qemu_chr_add_handlers(chr, monitor_can_read, monitor_read,
- monitor_event, mon);
+ qemu_chr_fe_set_handlers(&mon->chr, monitor_can_read, monitor_read,
+ monitor_event, mon, NULL);
}
qemu_mutex_lock(&monitor_lock);