mirror of
https://github.com/Motorhead1991/qemu.git
synced 2025-08-02 23:33:54 -06:00
char: remaining switch to CharBackend in frontend
Similar to previous change, for the remaining CharDriverState front ends users. Signed-off-by: Marc-André Lureau <marcandre.lureau@redhat.com> Message-Id: <20161022095318.17775-13-marcandre.lureau@redhat.com> Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>
This commit is contained in:
parent
becdfa00cf
commit
32a6ebecd2
14 changed files with 211 additions and 164 deletions
19
monitor.c
19
monitor.c
|
@ -186,7 +186,7 @@ typedef struct {
|
|||
} MonitorQAPIEventConf;
|
||||
|
||||
struct Monitor {
|
||||
CharDriverState *chr;
|
||||
CharBackend chr;
|
||||
int reset_seen;
|
||||
int flags;
|
||||
int suspend_cnt;
|
||||
|
@ -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, (const uint8_t *) buf, len);
|
||||
rc = qemu_chr_fe_write(mon->chr.chr, (const uint8_t *) buf, len);
|
||||
if ((rc < 0 && errno != EAGAIN) || (rc == len)) {
|
||||
/* all flushed or error */
|
||||
QDECREF(mon->outbuf);
|
||||
|
@ -311,8 +311,9 @@ static void monitor_flush_locked(Monitor *mon)
|
|||
mon->outbuf = tmp;
|
||||
}
|
||||
if (mon->out_watch == 0) {
|
||||
mon->out_watch = qemu_chr_fe_add_watch(mon->chr, G_IO_OUT|G_IO_HUP,
|
||||
monitor_unblocked, mon);
|
||||
mon->out_watch =
|
||||
qemu_chr_fe_add_watch(mon->chr.chr, G_IO_OUT | G_IO_HUP,
|
||||
monitor_unblocked, mon);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -581,8 +582,8 @@ static void monitor_data_init(Monitor *mon)
|
|||
|
||||
static void monitor_data_destroy(Monitor *mon)
|
||||
{
|
||||
if (mon->chr) {
|
||||
qemu_chr_add_handlers(mon->chr, NULL, NULL, NULL, NULL);
|
||||
if (mon->chr.chr) {
|
||||
qemu_chr_add_handlers(mon->chr.chr, NULL, NULL, NULL, NULL);
|
||||
}
|
||||
if (monitor_is_qmp(mon)) {
|
||||
json_message_parser_destroy(&mon->qmp.parser);
|
||||
|
@ -1745,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);
|
||||
fd = qemu_chr_fe_get_msgfd(cur_mon->chr.chr);
|
||||
if (fd == -1) {
|
||||
error_setg(errp, QERR_FD_NOT_SUPPLIED);
|
||||
return;
|
||||
|
@ -1870,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);
|
||||
fd = qemu_chr_fe_get_msgfd(mon->chr.chr);
|
||||
if (fd == -1) {
|
||||
error_setg(errp, QERR_FD_NOT_SUPPLIED);
|
||||
goto error;
|
||||
|
@ -3977,7 +3978,7 @@ void monitor_init(CharDriverState *chr, int flags)
|
|||
mon = g_malloc(sizeof(*mon));
|
||||
monitor_data_init(mon);
|
||||
|
||||
mon->chr = chr;
|
||||
qemu_chr_fe_init(&mon->chr, chr, &error_abort);
|
||||
mon->flags = flags;
|
||||
if (flags & MONITOR_USE_READLINE) {
|
||||
mon->rs = readline_init(monitor_readline_printf,
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue