From patchwork Mon Nov 18 12:25:15 2013 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: =?utf-8?q?Marc-Andr=C3=A9_Lureau?= X-Patchwork-Id: 292085 Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@bilbo.ozlabs.org Received: from lists.gnu.org (lists.gnu.org [IPv6:2001:4830:134:3::11]) (using TLSv1 with cipher AES256-SHA (256/256 bits)) (Client did not present a certificate) by ozlabs.org (Postfix) with ESMTPS id 99EEC2C00B9 for ; Tue, 19 Nov 2013 00:17:04 +1100 (EST) Received: from localhost ([::1]:42692 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1ViNxn-0000qz-AQ for incoming@patchwork.ozlabs.org; Mon, 18 Nov 2013 07:29:59 -0500 Received: from eggs.gnu.org ([2001:4830:134:3::10]:50631) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1ViNuX-0004I9-Eb for qemu-devel@nongnu.org; Mon, 18 Nov 2013 07:26:45 -0500 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1ViNuK-0006Sy-Hf for qemu-devel@nongnu.org; Mon, 18 Nov 2013 07:26:37 -0500 Received: from mail-we0-x22d.google.com ([2a00:1450:400c:c03::22d]:36370) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1ViNuK-0006Su-8f for qemu-devel@nongnu.org; Mon, 18 Nov 2013 07:26:24 -0500 Received: by mail-we0-f173.google.com with SMTP id u56so6074360wes.18 for ; Mon, 18 Nov 2013 04:26:23 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20120113; h=from:to:cc:subject:date:message-id:in-reply-to:references :mime-version:content-type:content-transfer-encoding; bh=P/erMkhbIVlTbVHjylo8yHBqaQk1vZoRFrlUbbkCo0c=; b=T26AMQ5LDFkDaDlqcFNxbKqMadrfVtA8OxeBkMJ70U8e2QkqNmab6IyFw29MqMK52W qHrC9oDPadYcx2ZuLcGCxlZdtZs2tVKxDFG0g3erW657DKRdhZxX6KWvDt22Om0Wgdwf H+CpNA/RHrVefBfrhMrvQKnaSSs3zTQP+YRjQvV+yEJ7a0Zl8gQuWpPdkwjEhs6uTTFn 2kETq/eX2WBDOaNSicvyZUvIKJd8Dfd/hXctYamdV+pJWmcSeVl70qfV1lo+SZROyAF0 Vlck8E7bgr05bUuYDi0DY4meynqZocOJR+tMXm5hsjKamjbs08kmmTR7V+StaW+QbkrM iAzQ== X-Received: by 10.180.19.201 with SMTP id h9mr16641055wie.36.1384777583350; Mon, 18 Nov 2013 04:26:23 -0800 (PST) Received: from localhost (nat-pool-cdg-t.redhat.com. [209.132.186.20]) by mx.google.com with ESMTPSA id r4sm4486263wib.6.2013.11.18.04.26.19 for (version=TLSv1.2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Mon, 18 Nov 2013 04:26:22 -0800 (PST) From: =?UTF-8?q?Marc-Andr=C3=A9=20Lureau?= To: qemu-devel@nongnu.org Date: Mon, 18 Nov 2013 13:25:15 +0100 Message-Id: <1384777531-14635-6-git-send-email-marcandre.lureau@gmail.com> X-Mailer: git-send-email 1.8.3.1 In-Reply-To: <1384777531-14635-1-git-send-email-marcandre.lureau@gmail.com> References: <1384777531-14635-1-git-send-email-marcandre.lureau@gmail.com> MIME-Version: 1.0 X-detected-operating-system: by eggs.gnu.org: Error: Malformed IPv6 address (bad octet value). X-Received-From: 2a00:1450:400c:c03::22d Cc: kwolf@redhat.com, =?UTF-8?q?Marc-Andr=C3=A9=20Lureau?= , jcody@redhat.com, kraxel@redhat.com, spice-devel@freedesktop.org Subject: [Qemu-devel] [PATCH 05/21] char: add qemu_chr_fe_event() 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 From: Marc-André Lureau Signed-off-by: Marc-André Lureau --- include/sysemu/char.h | 10 ++++++++++ qemu-char.c | 7 +++++++ spice-qemu-char.c | 10 ++++++++++ 3 files changed, 27 insertions(+) diff --git a/include/sysemu/char.h b/include/sysemu/char.h index ad101d9..d23c8f1 100644 --- a/include/sysemu/char.h +++ b/include/sysemu/char.h @@ -69,6 +69,7 @@ struct CharDriverState { void (*chr_accept_input)(struct CharDriverState *chr); void (*chr_set_echo)(struct CharDriverState *chr, bool echo); void (*chr_set_fe_open)(struct CharDriverState *chr, int fe_open); + void (*chr_fe_event)(struct CharDriverState *chr, int event); void *opaque; char *label; char *filename; @@ -138,6 +139,15 @@ void qemu_chr_fe_set_echo(struct CharDriverState *chr, bool echo); void qemu_chr_fe_set_open(struct CharDriverState *chr, int fe_open); /** + * @qemu_chr_fe_event: + * + * Send an event from the back end to the front end. + * + * @event the event to send + */ +void qemu_chr_fe_event(CharDriverState *s, int event); + +/** * @qemu_chr_fe_printf: * * Write to a character backend using a printf style interface. diff --git a/qemu-char.c b/qemu-char.c index e00f84c..418dc69 100644 --- a/qemu-char.c +++ b/qemu-char.c @@ -3353,6 +3353,13 @@ void qemu_chr_fe_set_open(struct CharDriverState *chr, int fe_open) } } +void qemu_chr_fe_event(struct CharDriverState *chr, int event) +{ + if (chr->chr_fe_event) { + chr->chr_fe_event(chr, event); + } +} + int qemu_chr_fe_add_watch(CharDriverState *s, GIOCondition cond, GIOFunc func, void *user_data) { diff --git a/spice-qemu-char.c b/spice-qemu-char.c index e074d9e..16439c5 100644 --- a/spice-qemu-char.c +++ b/spice-qemu-char.c @@ -222,6 +222,15 @@ static void spice_chr_set_fe_open(struct CharDriverState *chr, int fe_open) } } +static void spice_chr_fe_event(struct CharDriverState *chr, int event) +{ +#if SPICE_SERVER_VERSION >= 0x000c02 + SpiceCharDriver *s = chr->opaque; + + spice_server_port_event(&s->sin, event); +#endif +} + static void print_allowed_subtypes(void) { const char** psubtype; @@ -255,6 +264,7 @@ static CharDriverState *chr_open(const char *subtype) chr->chr_close = spice_chr_close; chr->chr_set_fe_open = spice_chr_set_fe_open; chr->explicit_be_open = true; + chr->chr_fe_event = spice_chr_fe_event; QLIST_INSERT_HEAD(&spice_chars, s, next);