From patchwork Mon Mar 7 20:10:40 2011 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Michael Roth X-Patchwork-Id: 85800 Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@bilbo.ozlabs.org Received: from lists.gnu.org (lists.gnu.org [199.232.76.165]) (using TLSv1 with cipher DHE-RSA-AES256-SHA (256/256 bits)) (Client did not present a certificate) by ozlabs.org (Postfix) with ESMTPS id 0A6F1B6EEB for ; Tue, 8 Mar 2011 07:13:36 +1100 (EST) Received: from localhost ([127.0.0.1]:37508 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.43) id 1Pwgny-0002Az-Ma for incoming@patchwork.ozlabs.org; Mon, 07 Mar 2011 15:13:22 -0500 Received: from [140.186.70.92] (port=41513 helo=eggs.gnu.org) by lists.gnu.org with esmtp (Exim 4.43) id 1Pwgm2-0001hh-Cs for qemu-devel@nongnu.org; Mon, 07 Mar 2011 15:11:26 -0500 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1Pwgm1-0006c4-0Q for qemu-devel@nongnu.org; Mon, 07 Mar 2011 15:11:21 -0500 Received: from e3.ny.us.ibm.com ([32.97.182.143]:54872) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1Pwgm0-0006bw-PE for qemu-devel@nongnu.org; Mon, 07 Mar 2011 15:11:20 -0500 Received: from d01dlp02.pok.ibm.com (d01dlp02.pok.ibm.com [9.56.224.85]) by e3.ny.us.ibm.com (8.14.4/8.13.1) with ESMTP id p27Jp8sC025226 for ; Mon, 7 Mar 2011 14:51:10 -0500 Received: from d01relay07.pok.ibm.com (d01relay07.pok.ibm.com [9.56.227.147]) by d01dlp02.pok.ibm.com (Postfix) with ESMTP id 622596E8045 for ; Mon, 7 Mar 2011 15:11:20 -0500 (EST) Received: from d01av01.pok.ibm.com (d01av01.pok.ibm.com [9.56.224.215]) by d01relay07.pok.ibm.com (8.13.8/8.13.8/NCO v10.0) with ESMTP id p27KBIVZ2007120 for ; Mon, 7 Mar 2011 15:11:18 -0500 Received: from d01av01.pok.ibm.com (loopback [127.0.0.1]) by d01av01.pok.ibm.com (8.14.4/8.13.1/NCO v10.0 AVout) with ESMTP id p27KBH8e012983 for ; Mon, 7 Mar 2011 15:11:18 -0500 Received: from localhost.localdomain (sig-9-76-30-5.mts.ibm.com [9.76.30.5]) by d01av01.pok.ibm.com (8.14.4/8.13.1/NCO v10.0 AVin) with ESMTP id p27KAi8O010005; Mon, 7 Mar 2011 15:11:16 -0500 From: Michael Roth To: qemu-devel@nongnu.org Date: Mon, 7 Mar 2011 14:10:40 -0600 Message-Id: <1299528642-23631-15-git-send-email-mdroth@linux.vnet.ibm.com> X-Mailer: git-send-email 1.7.0.4 In-Reply-To: <1299528642-23631-1-git-send-email-mdroth@linux.vnet.ibm.com> References: <1299528642-23631-1-git-send-email-mdroth@linux.vnet.ibm.com> X-Content-Scanned: Fidelis XPS MAILER X-detected-operating-system: by eggs.gnu.org: GNU/Linux 2.6, seldom 2.4 (older, 4) X-Received-From: 32.97.182.143 Cc: agl@linux.vnet.ibm.com, stefanha@linux.vnet.ibm.com, Jes.Sorensen@redhat.com, mdroth@linux.vnet.ibm.com, markus_mueller@de.ibm.com, aliguori@linux.vnet.ibm.com, abeekhof@redhat.com Subject: [Qemu-devel] [RFC][PATCH v7 14/16] virtagent: add virtagent chardev X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: qemu-devel.nongnu.org List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Sender: qemu-devel-bounces+incoming=patchwork.ozlabs.org@nongnu.org Errors-To: qemu-devel-bounces+incoming=patchwork.ozlabs.org@nongnu.org Signed-off-by: Michael Roth --- qemu-char.c | 44 ++++++++++++++++++++++++++++++++++++++++++++ 1 files changed, 44 insertions(+), 0 deletions(-) diff --git a/qemu-char.c b/qemu-char.c index bd4e944..ffdcadb 100644 --- a/qemu-char.c +++ b/qemu-char.c @@ -2458,6 +2458,49 @@ fail: return NULL; } +#include "virtagent-common.h" + +static CharDriverState *qemu_chr_open_virtagent(QemuOpts *opts) +{ + CharDriverState *chr; + const char *path; + VAContext ctx; + int ret; + + /* revert to/enforce default socket chardev options for virtagent */ + path = qemu_opt_get(opts, "path"); + if (path == NULL) { + path = VA_HOST_PATH_DEFAULT; + } + qemu_opt_set(opts, "path", path); + qemu_opt_set(opts, "server", "on"); + qemu_opt_set(opts, "wait", "off"); + qemu_opt_set(opts, "telnet", "off"); + + chr = qemu_chr_open_socket(opts); + if (chr == NULL) { + goto err; + } + + /* initialize virtagent using the socket we just set up */ + ctx.channel_method = "unix-connect"; + ctx.channel_path = path; + ctx.is_host = true; + ret = va_init(ctx); + ret = 0; + if (ret != 0) { + fprintf(stderr, "error initializing virtagent"); + goto err; + } + + return chr; +err: + if (chr) { + qemu_free(chr); + } + return NULL; +} + static const struct { const char *name; CharDriverState *(*open)(QemuOpts *opts); @@ -2467,6 +2510,7 @@ static const struct { { .name = "udp", .open = qemu_chr_open_udp }, { .name = "msmouse", .open = qemu_chr_open_msmouse }, { .name = "vc", .open = text_console_init }, + { .name = "virtagent", .open = qemu_chr_open_virtagent }, #ifdef _WIN32 { .name = "file", .open = qemu_chr_open_win_file_out }, { .name = "pipe", .open = qemu_chr_open_win_pipe },