[Top][All Lists]
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[Qemu-devel] [PATCH 23/23] move mux focus field from CharDriverState to
From: |
Gerd Hoffmann |
Subject: |
[Qemu-devel] [PATCH 23/23] move mux focus field from CharDriverState to MuxDriver |
Date: |
Mon, 7 Sep 2009 18:06:25 +0200 |
Now that monitor stopped using focus we can make it internal
to the mux driver.
Signed-off-by: Gerd Hoffmann <address@hidden>
---
qemu-char.c | 27 ++++++++++++++-------------
qemu-char.h | 1 -
2 files changed, 14 insertions(+), 14 deletions(-)
diff --git a/qemu-char.c b/qemu-char.c
index daa8587..f46cef5 100644
--- a/qemu-char.c
+++ b/qemu-char.c
@@ -233,6 +233,7 @@ typedef struct {
IOEventHandler *chr_event[MAX_MUX];
void *ext_opaque[MAX_MUX];
CharDriverState *drv;
+ int focus;
int mux_cnt;
int term_got_escape;
int max_size;
@@ -361,11 +362,11 @@ static int mux_proc_byte(CharDriverState *chr, MuxDriver
*d, int ch)
break;
case 'c':
/* Switch to the next registered device */
- mux_chr_send_event(d, chr->focus, CHR_EVENT_MUX_OUT);
- chr->focus++;
- if (chr->focus >= d->mux_cnt)
- chr->focus = 0;
- mux_chr_send_event(d, chr->focus, CHR_EVENT_MUX_IN);
+ mux_chr_send_event(d, d->focus, CHR_EVENT_MUX_OUT);
+ d->focus++;
+ if (d->focus >= d->mux_cnt)
+ d->focus = 0;
+ mux_chr_send_event(d, d->focus, CHR_EVENT_MUX_IN);
break;
case 't':
d->timestamps = !d->timestamps;
@@ -384,8 +385,8 @@ static int mux_proc_byte(CharDriverState *chr, MuxDriver
*d, int ch)
static void mux_chr_accept_input(CharDriverState *chr)
{
- int m = chr->focus;
MuxDriver *d = chr->opaque;
+ int m = d->focus;
while (d->prod[m] != d->cons[m] &&
d->chr_can_read[m] &&
@@ -399,7 +400,7 @@ static int mux_chr_can_read(void *opaque)
{
CharDriverState *chr = opaque;
MuxDriver *d = chr->opaque;
- int m = chr->focus;
+ int m = d->focus;
if ((d->prod[m] - d->cons[m]) < MUX_BUFFER_SIZE)
return 1;
@@ -412,7 +413,7 @@ static void mux_chr_read(void *opaque, const uint8_t *buf,
int size)
{
CharDriverState *chr = opaque;
MuxDriver *d = chr->opaque;
- int m = chr->focus;
+ int m = d->focus;
int i;
mux_chr_accept_input (opaque);
@@ -456,11 +457,11 @@ static void mux_chr_update_read_handler(CharDriverState
*chr)
qemu_chr_add_handlers(d->drv, mux_chr_can_read, mux_chr_read,
mux_chr_event, chr);
}
- if (-1 != chr->focus)
- mux_chr_send_event(d, chr->focus, CHR_EVENT_MUX_OUT);
- chr->focus = d->mux_cnt;
+ if (-1 != d->focus)
+ mux_chr_send_event(d, d->focus, CHR_EVENT_MUX_OUT);
+ d->focus = d->mux_cnt;
d->mux_cnt++;
- mux_chr_send_event(d, chr->focus, CHR_EVENT_MUX_IN);
+ mux_chr_send_event(d, d->focus, CHR_EVENT_MUX_IN);
}
static CharDriverState *qemu_chr_open_mux(CharDriverState *drv)
@@ -473,7 +474,7 @@ static CharDriverState *qemu_chr_open_mux(CharDriverState
*drv)
chr->opaque = d;
d->drv = drv;
- chr->focus = -1;
+ d->focus = -1;
chr->chr_write = mux_chr_write;
chr->chr_update_read_handler = mux_chr_update_read_handler;
chr->chr_accept_input = mux_chr_accept_input;
diff --git a/qemu-char.h b/qemu-char.h
index 0bf8944..d12ab11 100644
--- a/qemu-char.h
+++ b/qemu-char.h
@@ -63,7 +63,6 @@ struct CharDriverState {
void (*chr_close)(struct CharDriverState *chr);
void (*chr_accept_input)(struct CharDriverState *chr);
void *opaque;
- int focus;
QEMUBH *bh;
char *label;
char *filename;
--
1.6.2.5
- [Qemu-devel] [PATCH 14/23] convert braille chardev to QemuOpts., (continued)
- [Qemu-devel] [PATCH 14/23] convert braille chardev to QemuOpts., Gerd Hoffmann, 2009/09/07
- [Qemu-devel] [PATCH 12/23] convert stdio chardev to QemuOpts., Gerd Hoffmann, 2009/09/07
- [Qemu-devel] [PATCH 10/23] convert unix+tcp chardevs to QemuOpts., Gerd Hoffmann, 2009/09/07
- [Qemu-devel] [PATCH 01/23] QemuOpts: split option parser into two functions., Gerd Hoffmann, 2009/09/07
- [Qemu-devel] [PATCH 08/23] sockets: add inet_connect_opts, Gerd Hoffmann, 2009/09/07
- [Qemu-devel] [PATCH 13/23] convert msmouse chardev to QemuOpts., Gerd Hoffmann, 2009/09/07
- [Qemu-devel] [PATCH 09/23] sockets: add inet_listen_opts, Gerd Hoffmann, 2009/09/07
- [Qemu-devel] [PATCH 15/23] convert windows console chardev to QemuOpts., Gerd Hoffmann, 2009/09/07
- [Qemu-devel] [PATCH 21/23] qdev: add parser for chardev properties, Gerd Hoffmann, 2009/09/07
- [Qemu-devel] [PATCH 17/23] convert vc chardev to QemuOpts., Gerd Hoffmann, 2009/09/07
- [Qemu-devel] [PATCH 23/23] move mux focus field from CharDriverState to MuxDriver,
Gerd Hoffmann <=
- [Qemu-devel] [PATCH 22/23] monitor: fix muxing, Gerd Hoffmann, 2009/09/07
- [Qemu-devel] [PATCH 20/23] Allow -serial chardev:<name>, Gerd Hoffmann, 2009/09/07
- [Qemu-devel] [PATCH 19/23] convert udp chardev to QemuOpts., Gerd Hoffmann, 2009/09/07
- [Qemu-devel] [PATCH 18/23] convert mux chardev to QemuOpts., Gerd Hoffmann, 2009/09/07
- [Qemu-devel] [PATCH 16/23] convert tty + parport chardevs to QemuOpts., Gerd Hoffmann, 2009/09/07