From patchwork Wed Jun 22 15:26:33 2016 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Wei Xu X-Patchwork-Id: 9193169 Return-Path: Received: from mail.wl.linuxfoundation.org (pdx-wl-mail.web.codeaurora.org [172.30.200.125]) by pdx-korg-patchwork.web.codeaurora.org (Postfix) with ESMTP id 25DC96075C for ; Wed, 22 Jun 2016 15:30:02 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 1726928408 for ; Wed, 22 Jun 2016 15:30:02 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id 0BBD828409; Wed, 22 Jun 2016 15:30:02 +0000 (UTC) X-Spam-Checker-Version: SpamAssassin 3.3.1 (2010-03-16) on pdx-wl-mail.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-6.9 required=2.0 tests=BAYES_00,RCVD_IN_DNSWL_HI autolearn=ham version=3.3.1 Received: from lists.gnu.org (lists.gnu.org [208.118.235.17]) (using TLSv1 with cipher AES256-SHA (256/256 bits)) (No client certificate requested) by mail.wl.linuxfoundation.org (Postfix) with ESMTPS id B4ED2283FD for ; Wed, 22 Jun 2016 15:29:59 +0000 (UTC) Received: from localhost ([::1]:59107 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1bFk6F-0006Fd-DB for patchwork-qemu-devel@patchwork.kernel.org; Wed, 22 Jun 2016 11:29:55 -0400 Received: from eggs.gnu.org ([2001:4830:134:3::10]:40872) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1bFk36-0003Z0-Nd for qemu-devel@nongnu.org; Wed, 22 Jun 2016 11:26:41 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1bFk32-0004jf-N1 for qemu-devel@nongnu.org; Wed, 22 Jun 2016 11:26:40 -0400 Received: from mx1.redhat.com ([209.132.183.28]:35694) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1bFk32-0004jZ-Gv for qemu-devel@nongnu.org; Wed, 22 Jun 2016 11:26:36 -0400 Received: from int-mx11.intmail.prod.int.phx2.redhat.com (int-mx11.intmail.prod.int.phx2.redhat.com [10.5.11.24]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mx1.redhat.com (Postfix) with ESMTPS id 2BA023F724 for ; Wed, 22 Jun 2016 15:26:36 +0000 (UTC) Received: from wei-thinkpad.nay.redhat.com (vpn1-6-208.pek2.redhat.com [10.72.6.208]) by int-mx11.intmail.prod.int.phx2.redhat.com (8.14.4/8.14.4) with ESMTP id u5MFQYCF024144 (version=TLSv1/SSLv3 cipher=DHE-RSA-AES256-SHA bits=256 verify=NO) for ; Wed, 22 Jun 2016 11:26:35 -0400 References: <1464712247-11655-3-git-send-email-wexu@redhat.com> To: qemu-devel@nongnu.org From: Wei Xu X-Forwarded-Message-Id: <1464712247-11655-3-git-send-email-wexu@redhat.com> Message-ID: <576AAE29.8050802@redhat.com> Date: Wed, 22 Jun 2016 23:26:33 +0800 User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:38.0) Gecko/20100101 Thunderbird/38.3.0 MIME-Version: 1.0 In-Reply-To: <1464712247-11655-3-git-send-email-wexu@redhat.com> X-Scanned-By: MIMEDefang 2.68 on 10.5.11.24 X-Greylist: Sender IP whitelisted, not delayed by milter-greylist-4.5.16 (mx1.redhat.com [10.5.110.30]); Wed, 22 Jun 2016 15:26:36 +0000 (UTC) X-detected-operating-system: by eggs.gnu.org: GNU/Linux 2.2.x-3.x [generic] X-Received-From: 209.132.183.28 Subject: [Qemu-devel] [RFC Patch 2/3] chardev: save the passed in 'fd' parameter during parsing X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.21 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: qemu-devel-bounces+patchwork-qemu-devel=patchwork.kernel.org@nongnu.org Sender: "Qemu-devel" X-Virus-Scanned: ClamAV using ClamSMTP There has been comments on this patch, but i forgot adding this patch to the list, just forward it again. Save the 'fd' paramter as unix socket 'sockfd' member. Signed-off-by: Wei Xu --- qemu-char.c | 7 +++++++ 1 file changed, 7 insertions(+) const char *port = qemu_opt_get(opts, "port"); @@ -3708,6 +3709,12 @@ static void qemu_chr_parse_socket(QemuOpts *opts, ChardevBackend *backend, addr->type = SOCKET_ADDRESS_KIND_UNIX; q_unix = addr->u.q_unix.data = g_new0(UnixSocketAddress, 1); q_unix->path = g_strdup(path); + + if (fd) { + q_unix->sockfd = fd; + } else { + q_unix->sockfd = 0; + } } else { addr->type = SOCKET_ADDRESS_KIND_INET; addr->u.inet.data = g_new(InetSocketAddress, 1); diff --git a/qemu-char.c b/qemu-char.c index ea9c02e..8d20494 100644 --- a/qemu-char.c +++ b/qemu-char.c @@ -3664,6 +3664,7 @@ static void qemu_chr_parse_socket(QemuOpts *opts, ChardevBackend *backend, bool is_telnet = qemu_opt_get_bool(opts, "telnet", false); bool do_nodelay = !qemu_opt_get_bool(opts, "delay", true); int64_t reconnect = qemu_opt_get_number(opts, "reconnect", 0); + const int32_t fd = (int32_t)qemu_opt_get_number(opts, "sockfd", 0); const char *path = qemu_opt_get(opts, "path"); const char *host = qemu_opt_get(opts, "host");