From patchwork Mon Oct 15 09:51:39 2012 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Gerd Hoffmann X-Patchwork-Id: 191505 Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@bilbo.ozlabs.org Received: from lists.gnu.org (lists.gnu.org [208.118.235.17]) (using TLSv1 with cipher AES256-SHA (256/256 bits)) (Client did not present a certificate) by ozlabs.org (Postfix) with ESMTPS id 47B882C00A3 for ; Mon, 15 Oct 2012 20:52:28 +1100 (EST) Received: from localhost ([::1]:59590 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1TNhLW-0006ah-Cp for incoming@patchwork.ozlabs.org; Mon, 15 Oct 2012 05:52:26 -0400 Received: from eggs.gnu.org ([208.118.235.92]:51026) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1TNhL1-00061U-Pi for qemu-devel@nongnu.org; Mon, 15 Oct 2012 05:52:02 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1TNhKs-0004CC-Mk for qemu-devel@nongnu.org; Mon, 15 Oct 2012 05:51:55 -0400 Received: from mx1.redhat.com ([209.132.183.28]:11034) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1TNhKs-0004Bn-ER for qemu-devel@nongnu.org; Mon, 15 Oct 2012 05:51:46 -0400 Received: from int-mx02.intmail.prod.int.phx2.redhat.com (int-mx02.intmail.prod.int.phx2.redhat.com [10.5.11.12]) by mx1.redhat.com (8.14.4/8.14.4) with ESMTP id q9F9pjaT005389 (version=TLSv1/SSLv3 cipher=DHE-RSA-AES256-SHA bits=256 verify=OK) for ; Mon, 15 Oct 2012 05:51:45 -0400 Received: from rincewind.home.kraxel.org (ovpn-116-31.ams2.redhat.com [10.36.116.31]) by int-mx02.intmail.prod.int.phx2.redhat.com (8.13.8/8.13.8) with ESMTP id q9F9piEN001864; Mon, 15 Oct 2012 05:51:44 -0400 Received: by rincewind.home.kraxel.org (Postfix, from userid 500) id EF8E14177F; Mon, 15 Oct 2012 11:51:43 +0200 (CEST) From: Gerd Hoffmann To: qemu-devel@nongnu.org Date: Mon, 15 Oct 2012 11:51:39 +0200 Message-Id: <1350294703-22011-5-git-send-email-kraxel@redhat.com> In-Reply-To: <1350294703-22011-1-git-send-email-kraxel@redhat.com> References: <1350294703-22011-1-git-send-email-kraxel@redhat.com> X-Scanned-By: MIMEDefang 2.67 on 10.5.11.12 X-detected-operating-system: by eggs.gnu.org: Genre and OS details not recognized. X-Received-From: 209.132.183.28 Cc: Gerd Hoffmann Subject: [Qemu-devel] [PATCH 4/8] console: s/TextConsole/QemuConsole/ X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.14 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: qemu-devel-bounces+incoming=patchwork.ozlabs.org@nongnu.org Sender: qemu-devel-bounces+incoming=patchwork.ozlabs.org@nongnu.org Signed-off-by: Gerd Hoffmann --- console.c | 72 ++++++++++++++++++++++++++++---------------------------- qemu-common.h | 3 +- 2 files changed, 37 insertions(+), 38 deletions(-) diff --git a/console.c b/console.c index 260a029..b53dc1b 100644 --- a/console.c +++ b/console.c @@ -114,20 +114,20 @@ typedef enum { TEXT_CONSOLE_FIXED_SIZE } console_type_t; -/* ??? This is mis-named. - It is used for both text and graphical consoles. */ -struct TextConsole { +struct QemuConsole { int index; console_type_t console_type; DisplayState *ds; + /* Graphic console state. */ vga_hw_update_ptr hw_update; vga_hw_invalidate_ptr hw_invalidate; vga_hw_screen_dump_ptr hw_screen_dump; vga_hw_text_update_ptr hw_text_update; void *hw; - int g_width, g_height; + + /* Text console state */ int width; int height; int total_height; @@ -161,8 +161,8 @@ struct TextConsole { }; static DisplayState *display_state; -static TextConsole *active_console; -static TextConsole *consoles[MAX_CONSOLES]; +static QemuConsole *active_console; +static QemuConsole *consoles[MAX_CONSOLES]; static int nb_consoles = 0; void vga_hw_update(void) @@ -179,7 +179,7 @@ void vga_hw_invalidate(void) void qmp_screendump(const char *filename, Error **errp) { - TextConsole *previous_active_console; + QemuConsole *previous_active_console; bool cswitch; previous_active_console = active_console; @@ -521,7 +521,7 @@ static void vga_putcharxy(DisplayState *ds, int x, int y, int ch, } } -static void text_console_resize(TextConsole *s) +static void text_console_resize(QemuConsole *s) { TextCell *cells, *c, *c1; int w1, x, y, last_width; @@ -553,7 +553,7 @@ static void text_console_resize(TextConsole *s) s->cells = cells; } -static inline void text_update_xy(TextConsole *s, int x, int y) +static inline void text_update_xy(QemuConsole *s, int x, int y) { s->text_x[0] = MIN(s->text_x[0], x); s->text_x[1] = MAX(s->text_x[1], x); @@ -561,7 +561,7 @@ static inline void text_update_xy(TextConsole *s, int x, int y) s->text_y[1] = MAX(s->text_y[1], y); } -static void invalidate_xy(TextConsole *s, int x, int y) +static void invalidate_xy(QemuConsole *s, int x, int y) { if (s->update_x0 > x * FONT_WIDTH) s->update_x0 = x * FONT_WIDTH; @@ -573,7 +573,7 @@ static void invalidate_xy(TextConsole *s, int x, int y) s->update_y1 = (y + 1) * FONT_HEIGHT; } -static void update_xy(TextConsole *s, int x, int y) +static void update_xy(QemuConsole *s, int x, int y) { TextCell *c; int y1, y2; @@ -597,7 +597,7 @@ static void update_xy(TextConsole *s, int x, int y) } } -static void console_show_cursor(TextConsole *s, int show) +static void console_show_cursor(QemuConsole *s, int show) { TextCell *c; int y, y1; @@ -631,7 +631,7 @@ static void console_show_cursor(TextConsole *s, int show) } } -static void console_refresh(TextConsole *s) +static void console_refresh(QemuConsole *s) { TextCell *c; int x, y, y1; @@ -666,7 +666,7 @@ static void console_refresh(TextConsole *s) static void console_scroll(int ydelta) { - TextConsole *s; + QemuConsole *s; int i, y1; s = active_console; @@ -698,7 +698,7 @@ static void console_scroll(int ydelta) console_refresh(s); } -static void console_put_lf(TextConsole *s) +static void console_put_lf(QemuConsole *s) { TextCell *c; int x, y1; @@ -749,7 +749,7 @@ static void console_put_lf(TextConsole *s) * NOTE: I know this code is not very efficient (checking every color for it * self) but it is more readable and better maintainable. */ -static void console_handle_escape(TextConsole *s) +static void console_handle_escape(QemuConsole *s) { int i; @@ -842,7 +842,7 @@ static void console_handle_escape(TextConsole *s) } } -static void console_clear_xy(TextConsole *s, int x, int y) +static void console_clear_xy(QemuConsole *s, int x, int y) { int y1 = (s->y_base + y) % s->total_height; TextCell *c = &s->cells[y1 * s->width + x]; @@ -852,7 +852,7 @@ static void console_clear_xy(TextConsole *s, int x, int y) } /* set cursor, checking bounds */ -static void set_cursor(TextConsole *s, int x, int y) +static void set_cursor(QemuConsole *s, int x, int y) { if (x < 0) { x = 0; @@ -871,7 +871,7 @@ static void set_cursor(TextConsole *s, int x, int y) s->y = y; } -static void console_putchar(TextConsole *s, int ch) +static void console_putchar(QemuConsole *s, int ch) { TextCell *c; int y1, i; @@ -1078,7 +1078,7 @@ static void console_putchar(TextConsole *s, int ch) void console_select(unsigned int index) { - TextConsole *s; + QemuConsole *s; if (index >= MAX_CONSOLES) return; @@ -1111,7 +1111,7 @@ void console_select(unsigned int index) static int console_puts(CharDriverState *chr, const uint8_t *buf, int len) { - TextConsole *s = chr->opaque; + QemuConsole *s = chr->opaque; int i; s->update_x0 = s->width * FONT_WIDTH; @@ -1133,7 +1133,7 @@ static int console_puts(CharDriverState *chr, const uint8_t *buf, int len) static void kbd_send_chars(void *opaque) { - TextConsole *s = opaque; + QemuConsole *s = opaque; int len; uint8_t buf[16]; @@ -1156,7 +1156,7 @@ static void kbd_send_chars(void *opaque) /* called when an ascii key is pressed */ void kbd_put_keysym(int keysym) { - TextConsole *s; + QemuConsole *s; uint8_t buf[16], *q; int c; @@ -1211,7 +1211,7 @@ void kbd_put_keysym(int keysym) static void text_console_invalidate(void *opaque) { - TextConsole *s = (TextConsole *) opaque; + QemuConsole *s = (QemuConsole *) opaque; if (!ds_get_bits_per_pixel(s->ds) && s->console_type == TEXT_CONSOLE) { s->g_width = ds_get_width(s->ds); s->g_height = ds_get_height(s->ds); @@ -1222,7 +1222,7 @@ static void text_console_invalidate(void *opaque) static void text_console_update(void *opaque, console_ch_t *chardata) { - TextConsole *s = (TextConsole *) opaque; + QemuConsole *s = (QemuConsole *) opaque; int i, j, src; if (s->text_x[0] <= s->text_x[1]) { @@ -1247,10 +1247,10 @@ static void text_console_update(void *opaque, console_ch_t *chardata) } } -static TextConsole *get_graphic_console(DisplayState *ds) +static QemuConsole *get_graphic_console(DisplayState *ds) { int i; - TextConsole *s; + QemuConsole *s; for (i = 0; i < nb_consoles; i++) { s = consoles[i]; if (s->console_type == GRAPHIC_CONSOLE && s->ds == ds) @@ -1259,14 +1259,14 @@ static TextConsole *get_graphic_console(DisplayState *ds) return NULL; } -static TextConsole *new_console(DisplayState *ds, console_type_t console_type) +static QemuConsole *new_console(DisplayState *ds, console_type_t console_type) { - TextConsole *s; + QemuConsole *s; int i; if (nb_consoles >= MAX_CONSOLES) return NULL; - s = g_malloc0(sizeof(TextConsole)); + s = g_malloc0(sizeof(QemuConsole)); if (!active_console || ((active_console->console_type != GRAPHIC_CONSOLE) && (console_type == GRAPHIC_CONSOLE))) { active_console = s; @@ -1417,7 +1417,7 @@ DisplayState *graphic_console_init(vga_hw_update_ptr update, vga_hw_text_update_ptr text_update, void *opaque) { - TextConsole *s; + QemuConsole *s; DisplayState *ds; ds = (DisplayState *) g_malloc0(sizeof(DisplayState)); @@ -1463,14 +1463,14 @@ void console_color_init(DisplayState *ds) static void text_console_set_echo(CharDriverState *chr, bool echo) { - TextConsole *s = chr->opaque; + QemuConsole *s = chr->opaque; s->echo = echo; } static void text_console_update_cursor(void *opaque) { - TextConsole *s = opaque; + QemuConsole *s = opaque; s->cursor_visible_phase = !s->cursor_visible_phase; vga_hw_invalidate(); @@ -1480,7 +1480,7 @@ static void text_console_update_cursor(void *opaque) static void text_console_do_init(CharDriverState *chr, DisplayState *ds) { - TextConsole *s; + QemuConsole *s; static int color_inited; s = chr->opaque; @@ -1543,7 +1543,7 @@ static void text_console_do_init(CharDriverState *chr, DisplayState *ds) CharDriverState *text_console_init(QemuOpts *opts) { CharDriverState *chr; - TextConsole *s; + QemuConsole *s; unsigned width; unsigned height; @@ -1589,7 +1589,7 @@ void text_consoles_set_display(DisplayState *ds) void qemu_console_resize(DisplayState *ds, int width, int height) { - TextConsole *s = get_graphic_console(ds); + QemuConsole *s = get_graphic_console(ds); if (!s) return; s->g_width = width; diff --git a/qemu-common.h b/qemu-common.h index b54612b..fdd0dbc 100644 --- a/qemu-common.h +++ b/qemu-common.h @@ -264,8 +264,7 @@ typedef struct DisplayChangeListener DisplayChangeListener; typedef struct DisplaySurface DisplaySurface; typedef struct DisplayAllocator DisplayAllocator; typedef struct PixelFormat PixelFormat; -typedef struct TextConsole TextConsole; -typedef TextConsole QEMUConsole; +typedef struct QemuConsole QemuConsole; typedef struct CharDriverState CharDriverState; typedef struct MACAddr MACAddr; typedef struct NetClientState NetClientState;