From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from mailman by lists.gnu.org with tmda-scanned (Exim 4.43) id 1MGIkN-0002v8-6m for qemu-devel@nongnu.org; Mon, 15 Jun 2009 16:25:39 -0400 Received: from exim by lists.gnu.org with spam-scanned (Exim 4.43) id 1MGIkI-0002np-M9 for qemu-devel@nongnu.org; Mon, 15 Jun 2009 16:25:38 -0400 Received: from [199.232.76.173] (port=44219 helo=monty-python.gnu.org) by lists.gnu.org with esmtp (Exim 4.43) id 1MGIkI-0002nc-CP for qemu-devel@nongnu.org; Mon, 15 Jun 2009 16:25:34 -0400 Received: from fmmailgate02.web.de ([217.72.192.227]:60816) by monty-python.gnu.org with esmtp (Exim 4.60) (envelope-from ) id 1MGIkH-0000za-Qc for qemu-devel@nongnu.org; Mon, 15 Jun 2009 16:25:34 -0400 Message-ID: <4A36AE3A.5080005@web.de> Date: Mon, 15 Jun 2009 22:25:30 +0200 From: Jan Kiszka MIME-Version: 1.0 Content-Type: multipart/signed; micalg=pgp-sha1; protocol="application/pgp-signature"; boundary="------------enig7A9F638B237914683F0AE470" Sender: jan.kiszka@web.de Subject: [Qemu-devel] [PATCH 1/2] mux-term: Localize timestamps List-Id: qemu-devel.nongnu.org List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , To: Anthony Liguori Cc: qemu-devel This is an OpenPGP/MIME signed message (RFC 2440 and 3156) --------------enig7A9F638B237914683F0AE470 Content-Type: text/plain; charset=ISO-8859-15 Content-Transfer-Encoding: quoted-printable As we can have multiple multiplexed terminals, timestamp control and tracking should better take place per MuxDriver. Signed-off-by: Jan Kiszka --- qemu-char.c | 20 ++++++++++---------- 1 files changed, 10 insertions(+), 10 deletions(-) diff --git a/qemu-char.c b/qemu-char.c index a8afe94..d82a64f 100644 --- a/qemu-char.c +++ b/qemu-char.c @@ -219,8 +219,6 @@ static CharDriverState *qemu_chr_open_null(void) } =20 /* MUX driver for serial I/O splitting */ -static int term_timestamps; -static int64_t term_timestamps_start; #define MAX_MUX 4 #define MUX_BUFFER_SIZE 32 /* Must be a power of 2. */ #define MUX_BUFFER_MASK (MUX_BUFFER_SIZE - 1) @@ -239,6 +237,8 @@ typedef struct { unsigned char buffer[MAX_MUX][MUX_BUFFER_SIZE]; int prod[MAX_MUX]; int cons[MAX_MUX]; + int timestamps; + int64_t timestamps_start; } MuxDriver; =20 =20 @@ -246,7 +246,7 @@ static int mux_chr_write(CharDriverState *chr, const = uint8_t *buf, int len) { MuxDriver *d =3D chr->opaque; int ret; - if (!term_timestamps) { + if (!d->timestamps) { ret =3D d->drv->chr_write(d->drv, buf, len); } else { int i; @@ -260,9 +260,9 @@ static int mux_chr_write(CharDriverState *chr, const = uint8_t *buf, int len) int secs; =20 ti =3D qemu_get_clock(rt_clock); - if (term_timestamps_start =3D=3D -1) - term_timestamps_start =3D ti; - ti -=3D term_timestamps_start; + if (d->timestamps_start =3D=3D -1) + d->timestamps_start =3D ti; + ti -=3D d->timestamps_start; secs =3D ti / 1000; snprintf(buf1, sizeof(buf1), "[%02d:%02d:%02d.%03d] ", @@ -357,10 +357,10 @@ static int mux_proc_byte(CharDriverState *chr, MuxD= river *d, int ch) chr->focus =3D 0; mux_chr_send_event(d, chr->focus, CHR_EVENT_MUX_IN); break; - case 't': - term_timestamps =3D !term_timestamps; - term_timestamps_start =3D -1; - break; + case 't': + d->timestamps =3D !d->timestamps; + d->timestamps_start =3D -1; + break; } } else if (ch =3D=3D term_escape_char) { d->term_got_escape =3D 1; --------------enig7A9F638B237914683F0AE470 Content-Type: application/pgp-signature; name="signature.asc" Content-Description: OpenPGP digital signature Content-Disposition: attachment; filename="signature.asc" -----BEGIN PGP SIGNATURE----- Version: GnuPG v2.0.9 (GNU/Linux) Comment: Using GnuPG with SUSE - http://enigmail.mozdev.org iEYEARECAAYFAko2rjoACgkQniDOoMHTA+ldbQCfV3Z0cvpDuMTG88AcC6i/TIq0 RqoAn13XSOwbRG+0rT+3LEmGIUx66jX3 =kWOL -----END PGP SIGNATURE----- --------------enig7A9F638B237914683F0AE470--