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: 639235 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)) (No client certificate requested) by ozlabs.org (Postfix) with ESMTPS id 3rZT7r1rhTz9sBX for ; Thu, 23 Jun 2016 01:30:48 +1000 (AEST) Received: from localhost ([::1]:59116 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1bFk74-0007O8-02 for incoming@patchwork.ozlabs.org; Wed, 22 Jun 2016 11:30:46 -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+incoming=patchwork.ozlabs.org@nongnu.org Sender: "Qemu-devel" 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");