From mboxrd@z Thu Jan 1 00:00:00 1970 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 From: Michael Roth Date: Mon, 7 Mar 2011 14:10:40 -0600 Message-Id: <1299528642-23631-15-git-send-email-mdroth@linux.vnet.ibm.com> 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> Subject: [Qemu-devel] [RFC][PATCH v7 14/16] virtagent: add virtagent chardev List-Id: qemu-devel.nongnu.org List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , To: qemu-devel@nongnu.org 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 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 }, -- 1.7.0.4