From: "Kazu" <kazoo@r3.dion.ne.jp>
To: qemu-devel@nongnu.org
Subject: Re: [Qemu-devel] qemu vl.c
Date: Sat, 3 Feb 2007 13:20:57 +0900 [thread overview]
Message-ID: <001b01c7474a$b46b4770$0464a8c0@athlon> (raw)
In-Reply-To: E1HCp8Z-0003rY-2d@savannah.gnu.org
[-- Attachment #1: Type: text/plain, Size: 428 bytes --]
Hi,
An attached patch cleans serial for Win32.
Regards,
Kazu
Sent: Friday, February 02, 2007 12:30 PM Thiemo Seufer wrote:
> CVSROOT: /sources/qemu
> Module name: qemu
> Changes by: Thiemo Seufer <ths> 07/02/02 03:30:55
>
> Modified files:
> . : vl.c
>
> Log message:
> Mingw build fix, by Johannes Schindelin.
>
> CVSWeb URLs:
>
http://cvs.savannah.gnu.org/viewcvs/qemu/vl.c?cvsroot=qemu&r1=1.245&r2=1.246
>
>
[-- Attachment #2: qemu-20070202-serial.patch --]
[-- Type: application/octet-stream, Size: 4781 bytes --]
Index: vl.c
===================================================================
RCS file: /sources/qemu/qemu/vl.c,v
retrieving revision 1.246
diff -u -r1.246 vl.c
--- vl.c 2 Feb 2007 03:30:54 -0000 1.246
+++ vl.c 2 Feb 2007 04:58:36 -0000
@@ -1875,7 +1875,6 @@
#ifdef _WIN32
typedef struct {
- CharDriverState *chr;
int max_size;
HANDLE hcom, hrecv, hsend;
OVERLAPPED orecv, osend;
@@ -1891,8 +1890,10 @@
static int win_chr_poll(void *opaque);
static int win_chr_pipe_poll(void *opaque);
-static void win_chr_close2(WinCharState *s)
+static void win_chr_close(CharDriverState *chr)
{
+ WinCharState *s = chr->opaque;
+
if (s->hsend) {
CloseHandle(s->hsend);
s->hsend = NULL;
@@ -1906,19 +1907,14 @@
s->hcom = NULL;
}
if (s->fpipe)
- qemu_del_polling_cb(win_chr_pipe_poll, s);
+ qemu_del_polling_cb(win_chr_pipe_poll, chr);
else
- qemu_del_polling_cb(win_chr_poll, s);
+ qemu_del_polling_cb(win_chr_poll, chr);
}
-static void win_chr_close(CharDriverState *chr)
+static int win_chr_init(CharDriverState *chr, const char *filename)
{
WinCharState *s = chr->opaque;
- win_chr_close2(s);
-}
-
-static int win_chr_init(WinCharState *s, CharDriverState *chr, const char *filename)
-{
COMMCONFIG comcfg;
COMMTIMEOUTS cto = { 0, 0, 0, 0, 0};
COMSTAT comstat;
@@ -1975,12 +1971,11 @@
fprintf(stderr, "Failed ClearCommError\n");
goto fail;
}
- s->chr = chr;
- qemu_add_polling_cb(win_chr_poll, s);
+ qemu_add_polling_cb(win_chr_poll, chr);
return 0;
fail:
- win_chr_close2(s);
+ win_chr_close(chr);
return -1;
}
@@ -2018,14 +2013,17 @@
return len1 - len;
}
-static int win_chr_read_poll(WinCharState *s)
+static int win_chr_read_poll(CharDriverState *chr)
{
- s->max_size = qemu_chr_can_read(s->chr);
+ WinCharState *s = chr->opaque;
+
+ s->max_size = qemu_chr_can_read(chr);
return s->max_size;
}
-static void win_chr_readfile(WinCharState *s)
+static void win_chr_readfile(CharDriverState *chr)
{
+ WinCharState *s = chr->opaque;
int ret, err;
uint8_t buf[1024];
DWORD size;
@@ -2041,31 +2039,34 @@
}
if (size > 0) {
- qemu_chr_read(s->chr, buf, size);
+ qemu_chr_read(chr, buf, size);
}
}
-static void win_chr_read(WinCharState *s)
+static void win_chr_read(CharDriverState *chr)
{
+ WinCharState *s = chr->opaque;
+
if (s->len > s->max_size)
s->len = s->max_size;
if (s->len == 0)
return;
- win_chr_readfile(s);
+ win_chr_readfile(chr);
}
static int win_chr_poll(void *opaque)
{
- WinCharState *s = opaque;
+ CharDriverState *chr = opaque;
+ WinCharState *s = chr->opaque;
COMSTAT status;
DWORD comerr;
ClearCommError(s->hcom, &comerr, &status);
if (status.cbInQue > 0) {
s->len = status.cbInQue;
- win_chr_read_poll(s);
- win_chr_read(s);
+ win_chr_read_poll(chr);
+ win_chr_read(chr);
return 1;
}
return 0;
@@ -2088,7 +2089,7 @@
chr->chr_write = win_chr_write;
chr->chr_close = win_chr_close;
- if (win_chr_init(s, chr, filename) < 0) {
+ if (win_chr_init(chr, filename) < 0) {
free(s);
free(chr);
return NULL;
@@ -2099,21 +2100,23 @@
static int win_chr_pipe_poll(void *opaque)
{
- WinCharState *s = opaque;
+ CharDriverState *chr = opaque;
+ WinCharState *s = chr->opaque;
DWORD size;
PeekNamedPipe(s->hcom, NULL, 0, NULL, &size, NULL);
if (size > 0) {
s->len = size;
- win_chr_read_poll(s);
- win_chr_read(s);
+ win_chr_read_poll(chr);
+ win_chr_read(chr);
return 1;
}
return 0;
}
-static int win_chr_pipe_init(WinCharState *s, const char *filename)
+static int win_chr_pipe_init(CharDriverState *chr, const char *filename)
{
+ WinCharState *s = chr->opaque;
OVERLAPPED ov;
int ret;
DWORD size;
@@ -2165,11 +2168,11 @@
CloseHandle(ov.hEvent);
ov.hEvent = NULL;
}
- qemu_add_polling_cb(win_chr_pipe_poll, s);
+ qemu_add_polling_cb(win_chr_pipe_poll, chr);
return 0;
fail:
- win_chr_close2(s);
+ win_chr_close(chr);
return -1;
}
@@ -2191,7 +2194,7 @@
chr->chr_write = win_chr_write;
chr->chr_close = win_chr_close;
- if (win_chr_pipe_init(s, filename) < 0) {
+ if (win_chr_pipe_init(chr, filename) < 0) {
free(s);
free(chr);
return NULL;
next prev parent reply other threads:[~2007-02-03 4:51 UTC|newest]
Thread overview: 146+ messages / expand[flat|nested] mbox.gz Atom feed top
2007-02-02 3:30 [Qemu-devel] qemu vl.c Thiemo Seufer
2007-02-03 4:20 ` Kazu [this message]
2007-02-05 11:52 ` Johannes Schindelin
-- strict thread matches above, loose matches on Subject: below --
2008-03-24 2:31 Paul Brook
2008-03-09 23:43 Aurelien Jarno
2008-02-03 3:45 Andrzej Zaborowski
2008-01-14 3:11 Andrzej Zaborowski
2008-01-08 19:32 Thiemo Seufer
2008-01-05 19:41 Andrzej Zaborowski
2007-12-24 13:58 Andrzej Zaborowski
2007-12-16 13:17 Andrzej Zaborowski
2007-12-16 14:30 ` Paul Brook
2007-12-16 15:26 ` Anders
2007-12-17 0:58 ` Paul Brook
2007-12-17 21:36 ` Avi Kivity
2007-12-17 23:46 ` Anders
2007-12-18 0:40 ` andrzej zaborowski
2007-12-18 16:48 ` Avi Kivity
2007-12-18 23:57 ` Anders
2007-12-16 11:48 Andrzej Zaborowski
2007-12-06 22:11 Andrzej Zaborowski
2007-12-03 3:01 Andrzej Zaborowski
2007-11-24 23:27 Andrzej Zaborowski
2007-11-19 1:05 Jocelyn Mayer
2007-11-15 19:04 Paul Brook
2007-10-26 17:21 Thiemo Seufer
2007-10-21 23:20 Thiemo Seufer
2007-10-26 15:49 ` Stefan Weil
2007-10-26 16:48 ` Johannes Schindelin
2007-10-26 17:24 ` Thiemo Seufer
2007-10-04 19:59 Andrzej Zaborowski
2007-10-04 19:47 Andrzej Zaborowski
2007-09-17 21:25 Andrzej Zaborowski
2007-09-16 19:53 Thiemo Seufer
2007-08-28 22:21 Thiemo Seufer
2007-08-26 17:31 Thiemo Seufer
2007-08-26 17:29 Thiemo Seufer
2007-08-25 1:34 Thiemo Seufer
2007-08-24 1:46 Thiemo Seufer
2007-08-24 1:36 Thiemo Seufer
2007-08-24 1:26 Thiemo Seufer
2007-08-23 20:22 Paul Brook
2007-08-20 15:42 Thiemo Seufer
2007-08-19 22:09 Thiemo Seufer
2007-07-02 15:03 Andrzej Zaborowski
2007-07-02 13:31 Andrzej Zaborowski
2007-07-02 13:20 Andrzej Zaborowski
2007-06-29 23:26 Thiemo Seufer
2007-06-28 15:14 Thiemo Seufer
2007-06-28 14:05 Thiemo Seufer
2007-06-25 11:48 Thiemo Seufer
2007-06-28 8:24 ` Andreas Färber
2007-06-28 8:32 ` Andreas Färber
2007-06-23 16:01 Thiemo Seufer
2007-06-22 8:23 Andrzej Zaborowski
2007-06-21 23:34 Thiemo Seufer
2007-05-28 2:29 Paul Brook
2007-05-18 17:46 Andrzej Zaborowski
2007-05-13 14:54 Thiemo Seufer
2007-05-03 10:13 Andrzej Zaborowski
2007-04-28 20:49 Thiemo Seufer
2007-04-18 18:11 Thiemo Seufer
2007-04-18 17:56 Thiemo Seufer
2007-03-25 20:27 Thiemo Seufer
2007-03-25 15:58 Thiemo Seufer
2007-03-22 12:36 Thiemo Seufer
2007-03-19 16:36 Thiemo Seufer
2007-03-19 15:58 Thiemo Seufer
2007-03-11 18:54 Paul Brook
2007-02-28 21:59 Thiemo Seufer
2007-02-21 17:25 Thiemo Seufer
2007-02-19 1:10 Thiemo Seufer
2007-02-17 22:54 Thiemo Seufer
2007-02-10 21:50 Thiemo Seufer
2007-01-27 17:19 Paul Brook
2007-01-27 18:22 ` Stefan Weil
2007-01-27 18:38 ` Paul Brook
2007-01-27 17:11 Paul Brook
2007-01-09 19:44 Fabrice Bellard
2006-12-23 22:51 Thiemo Seufer
2006-12-23 15:37 Paul Brook
2006-12-22 21:20 Thiemo Seufer
2006-12-22 19:25 Thiemo Seufer
2006-12-22 17:29 Thiemo Seufer
2006-11-01 1:44 Paul Brook
2006-09-10 14:39 Paul Brook
2006-09-09 11:10 Fabrice Bellard
2006-08-17 9:43 Fabrice Bellard
2006-08-07 21:34 Fabrice Bellard
2006-08-06 13:36 Fabrice Bellard
2006-07-15 17:40 Paul Brook
2006-07-14 9:36 Fabrice Bellard
2006-06-26 20:03 Fabrice Bellard
2006-06-25 16:25 Fabrice Bellard
2006-05-01 13:33 Fabrice Bellard
2006-05-01 13:28 Fabrice Bellard
2006-05-01 13:23 Fabrice Bellard
2006-05-01 12:43 Fabrice Bellard
2006-04-30 22:20 Fabrice Bellard
2006-03-28 20:20 Paul Brook
2006-02-10 17:34 Paul Brook
2006-02-08 22:46 Fabrice Bellard
2006-02-01 21:29 Fabrice Bellard
2006-01-08 10:53 Fabrice Bellard
2005-12-18 19:09 Fabrice Bellard
2005-12-18 18:02 Fabrice Bellard
2005-11-27 19:10 Fabrice Bellard
2005-11-26 20:10 Fabrice Bellard
2005-11-23 21:01 Fabrice Bellard
2005-11-11 0:00 Fabrice Bellard
2005-09-03 21:33 Fabrice Bellard
2005-09-03 15:28 Fabrice Bellard
2005-06-05 14:49 Fabrice Bellard
2005-04-06 20:32 Fabrice Bellard
2005-03-01 21:28 Fabrice Bellard
2005-01-30 22:57 Fabrice Bellard
2005-01-26 21:56 Fabrice Bellard
2005-01-15 21:50 Fabrice Bellard
2005-01-09 0:22 Fabrice Bellard
2005-01-09 0:58 ` Phil Krylov
2005-01-09 10:48 ` Daniel Egger
2005-01-06 21:06 Fabrice Bellard
2005-01-03 23:48 Fabrice Bellard
2004-12-12 22:43 Fabrice Bellard
2004-11-14 15:48 Fabrice Bellard
2003-12-02 22:18 Fabrice Bellard
2003-11-16 19:46 Fabrice Bellard
2003-11-16 15:59 Fabrice Bellard
2003-11-11 13:36 Fabrice Bellard
2003-11-04 23:35 Fabrice Bellard
2003-10-30 1:11 Fabrice Bellard
2003-10-27 23:37 Fabrice Bellard
2003-10-27 21:18 Fabrice Bellard
2003-09-30 22:11 Fabrice Bellard
2003-09-30 21:40 Fabrice Bellard
2003-09-30 21:07 Fabrice Bellard
2003-09-16 21:46 Fabrice Bellard
2003-07-27 22:19 Fabrice Bellard
2003-07-26 18:11 Fabrice Bellard
2003-07-04 14:38 Fabrice Bellard
2003-07-01 15:07 Fabrice Bellard
2003-06-30 23:36 Fabrice Bellard
2003-06-30 13:06 Fabrice Bellard
2003-06-27 12:01 Fabrice Bellard
2003-06-25 16:20 Fabrice Bellard
2003-06-25 0:07 Fabrice Bellard
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to='001b01c7474a$b46b4770$0464a8c0@athlon' \
--to=kazoo@r3.dion.ne.jp \
--cc=qemu-devel@nongnu.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).