From patchwork Mon Jul 17 13:06:48 2017 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Bhupinder Thakur X-Patchwork-Id: 107933 Delivered-To: patch@linaro.org Received: by 10.140.101.44 with SMTP id t41csp4494886qge; Mon, 17 Jul 2017 06:09:18 -0700 (PDT) X-Received: by 10.36.74.8 with SMTP id k8mr397226itb.100.1500296958392; Mon, 17 Jul 2017 06:09:18 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1500296958; cv=none; d=google.com; s=arc-20160816; b=TFkgXxOApaOWMw5dJ6uOzi942XSWZGt8a/2eYysc+QuPElQYy5b4qXBAKXSzjFtPqW vjCqlGmyEJCBgHEWzQfOB0O2w4go7ibgvle9JzSonVVsrKRFFmOB8E8VE9P45CLFvRRl 6URpnusWmJ7EOj4MNJLxOFUa/IY3ve/coqNoImswIZn6ZVqPxPTQHXNUDtdGzM76I/r8 maiydNRKe/RpjOmYerQEMShE9Fo0cydi0wLBFKTUZT6JdC9b38Ei8EZCbzjuRzrq2wS6 fOUtuPp2+TdGsbvnEmXaRxFBhzn6u9O44q4WBCjGbcPzHqDrc5lV9+RENvINRRyAiTsq YCog== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=sender:errors-to:content-transfer-encoding:mime-version :list-subscribe:list-help:list-post:list-unsubscribe:list-id :precedence:subject:cc:references:in-reply-to:message-id:date:to :from:dkim-signature:arc-authentication-results; bh=z4thRx17Dab7ELCkMHlVa9kcD1d7nuCdFQbSwrYuggc=; b=W5oziO2/KPmxrrntlAhofH+HLCKY1Whd8Xk/L5KKflmceAyuDi30+7xoCjPkuwpf+A +/8xVH8JeTYXO7IMKLdnWgXqxROQ/+C4WJb8i6gZWmn8n9gAKVbkyKitNUa/L68zlT1m xVADUi0yERwfliK/1OKcXJ7oUV0oD+i13M+rhcUv9k3Bj0R2VlyxU8QysUwSRrC/5vwS g3sseQGK42JV1ah4JBc1KJ3VhWJhBkTEwoch5U0Qj4w1cgw0q3myk03ksPKWoQPcwF5h xzHbOXxi74x/TjjrMJ9qGiWHUV2qFDhE2ayHUCJCMu2GnN0IzxWYVdy3DDbpR80PMvRu bpuA== ARC-Authentication-Results: i=1; mx.google.com; dkim=neutral (body hash did not verify) header.i=@linaro.org header.b=dDcPEHI7; spf=neutral (google.com: 192.237.175.120 is neither permitted nor denied by best guess record for domain of xen-devel-bounces@lists.xen.org) smtp.mailfrom=xen-devel-bounces@lists.xen.org; dmarc=fail (p=NONE sp=NONE dis=NONE) header.from=linaro.org Return-Path: Received: from lists.xenproject.org (lists.xenproject.org. [192.237.175.120]) by mx.google.com with ESMTPS id c202si9044783itb.58.2017.07.17.06.09.18 (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Mon, 17 Jul 2017 06:09:18 -0700 (PDT) Received-SPF: neutral (google.com: 192.237.175.120 is neither permitted nor denied by best guess record for domain of xen-devel-bounces@lists.xen.org) client-ip=192.237.175.120; Authentication-Results: mx.google.com; dkim=neutral (body hash did not verify) header.i=@linaro.org header.b=dDcPEHI7; spf=neutral (google.com: 192.237.175.120 is neither permitted nor denied by best guess record for domain of xen-devel-bounces@lists.xen.org) smtp.mailfrom=xen-devel-bounces@lists.xen.org; dmarc=fail (p=NONE sp=NONE dis=NONE) header.from=linaro.org Received: from localhost ([127.0.0.1] helo=lists.xenproject.org) by lists.xenproject.org with esmtp (Exim 4.84_2) (envelope-from ) id 1dX5km-0004r2-Au; Mon, 17 Jul 2017 13:08:00 +0000 Received: from mail6.bemta5.messagelabs.com ([195.245.231.135]) by lists.xenproject.org with esmtp (Exim 4.84_2) (envelope-from ) id 1dX5kl-0004p8-BG for xen-devel@lists.xenproject.org; Mon, 17 Jul 2017 13:07:59 +0000 Received: from [85.158.139.211] by server-10.bemta-5.messagelabs.com id 40/1D-01732-EA6BC695; Mon, 17 Jul 2017 13:07:58 +0000 X-Brightmail-Tracker: H4sIAAAAAAAAA+NgFlrKIsWRWlGSWpSXmKPExsXiVRusrbtuW06 kwbvbzBbft0xmcmD0OPzhCksAYxRrZl5SfkUCa8b54xwFk7grjn/sZ21gPMjZxcjJISQwnVHi wxX7LkYuDhaBecwSG88+YgVxJAT6WSXuLvzEDlIlIZAm8WXRHiYIu0pi//RLTBDdWhJHT80Ga xASaGWSOP//PJDDwcEmYCIxq0MCpEZEQEni3qrJTCA1zALzGSWaJvWygSSEBaIlFu+fzgpisw ioSpz88R1sKK+Aj8TpBX1sEMvkJG6e62QGsTmB4mc2rIZa7C1x88hEpgmMAgsYGVYxahSnFpW lFukaGeglFWWmZ5TkJmbm6BoamOrlphYXJ6an5iQmFesl5+duYgQGVj0DA+MOxsbZfocYJTmY lER5L7JlRwrxJeWnVGYkFmfEF5XmpBYfYpTh4FCS4HXfmhMpJFiUmp5akZaZAwxxmLQEB4+SC G81SJq3uCAxtzgzHSJ1itGYY9KB7V+YOF5N+P+NSYglLz8vVUqcdwVIqQBIaUZpHtwgWOxdYp SVEuZlZGBgEOIpSC3KzSxBlX/FKM7BqCTMuxxkCk9mXgncvldApzABnSLsC3ZKSSJCSqqBcdq 19/OUU/u9TodZHQ9/yaa5LDjC8JI6+5azxm/+8Z0/+tFm3wd7iztr0yfsvFXdWi90OmlZpMPT TLlHyVM57/NoVl/qZK0v+tGcERLsm7Gn7eIxNWWWL9cbb048GPN7j12240wt0QOyh924TKpTV zPP7b2cMffSdu/nQUnf95yXKYzbG3D4nBJLcUaioRZzUXEiAJ9H6+y4AgAA X-Env-Sender: bhupinder.thakur@linaro.org X-Msg-Ref: server-6.tower-206.messagelabs.com!1500296877!103036825!1 X-Originating-IP: [74.125.83.43] X-SpamReason: No, hits=0.0 required=7.0 tests= X-StarScan-Received: X-StarScan-Version: 9.4.25; banners=-,-,- X-VirusChecked: Checked Received: (qmail 56810 invoked from network); 17 Jul 2017 13:07:57 -0000 Received: from mail-pg0-f43.google.com (HELO mail-pg0-f43.google.com) (74.125.83.43) by server-6.tower-206.messagelabs.com with AES128-GCM-SHA256 encrypted SMTP; 17 Jul 2017 13:07:57 -0000 Received: by mail-pg0-f43.google.com with SMTP id u5so17089925pgq.3 for ; Mon, 17 Jul 2017 06:07:57 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; h=from:to:cc:subject:date:message-id:in-reply-to:references; bh=409tjuZ3qKHf2TBRBmScW1+QhqA0AVFI0dMys/7Oouo=; b=dDcPEHI7q0F+KbIcPU/e271Q+JRs/w74HDfw2OD+G7Ikw1VrYSw+wfrMJBy/nzZeLD R/sddOd3KQLUlXGFjARGi26QvyRj25F2WRtdvoEOV6ZeBNR9Ft80CMppw4Qm0+O/gq7p o76rIM8qM8Eo6uhI9Yi5irAS/PlZaX9wf9e9I= X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:from:to:cc:subject:date:message-id:in-reply-to :references; bh=409tjuZ3qKHf2TBRBmScW1+QhqA0AVFI0dMys/7Oouo=; b=ExDlMRtcxBPsnOieyY3JMhvI8vx4bFi1vDwqkccTHL3b76CmVsSCxclxrGFKgi+cs+ BYmTbF++w10WpkkDwgT/HAcg0EOcHsbGhVWITV+zcBdlE74jyAdO70FtouYDnX4IkE30 AYl135rbnFWBFpHDpNbCDFLDlTzNj9EcUgRRywFI6XSLKDjbBTSE3UUEglt27UjQNFw0 Scnf7E6KmxyToD2QlurOGKHkRbIsh5sXVXZgarh9h8TmEFEHb0WywGZMBkVaOKINszTd H+08QmgE6DIsDBEaCB8DjlF4/RPhIjqz9R7rHEyWgDh0rsdyGgHNjnEGw//3wH8kaXoc EkYQ== X-Gm-Message-State: AIVw112HOUxzxSqriVJvk14BJXr0UgO3nUAV7lxqbWgin2squzwLfWtC mCeRIXFXhFh+nduXS4tlFA== X-Received: by 10.99.61.201 with SMTP id k192mr19006238pga.57.1500296876427; Mon, 17 Jul 2017 06:07:56 -0700 (PDT) Received: from blr-ubuntu-linaro.wlan.qualcomm.com ([103.5.19.18]) by smtp.gmail.com with ESMTPSA id z69sm15705665pgz.42.2017.07.17.06.07.53 (version=TLS1_2 cipher=ECDHE-RSA-AES128-SHA bits=128/128); Mon, 17 Jul 2017 06:07:56 -0700 (PDT) From: Bhupinder Thakur To: xen-devel@lists.xenproject.org Date: Mon, 17 Jul 2017 18:36:48 +0530 Message-Id: <1500296815-10243-19-git-send-email-bhupinder.thakur@linaro.org> X-Mailer: git-send-email 2.7.4 In-Reply-To: <1500296815-10243-1-git-send-email-bhupinder.thakur@linaro.org> References: <1500296815-10243-1-git-send-email-bhupinder.thakur@linaro.org> Cc: Wei Liu , Julien Grall , Stefano Stabellini , Ian Jackson Subject: [Xen-devel] [PATCH 18/25 v6] xen/arm: vpl011: Add a new console_cleanup function in xenconsole X-BeenThere: xen-devel@lists.xen.org X-Mailman-Version: 2.1.18 Precedence: list List-Id: Xen developer discussion List-Unsubscribe: , List-Post: List-Help: List-Subscribe: , MIME-Version: 1.0 Errors-To: xen-devel-bounces@lists.xen.org Sender: "Xen-devel" This patch introduces a new console_cleanup function. This function frees up the console resources. Signed-off-by: Bhupinder Thakur Reviewed-by: Stefano Stabellini --- CC: Ian Jackson CC: Wei Liu CC: Stefano Stabellini CC: Julien Grall Changes since v5: - Split this change in a separate patch. tools/console/daemon/io.c | 29 ++++++++++++++++++++--------- 1 file changed, 20 insertions(+), 9 deletions(-) diff --git a/tools/console/daemon/io.c b/tools/console/daemon/io.c index 4097673..d004687 100644 --- a/tools/console/daemon/io.c +++ b/tools/console/daemon/io.c @@ -769,22 +769,33 @@ static void remove_domain(struct domain *dom) } } -static void cleanup_domain(struct domain *d) +static void console_cleanup(struct console *con) { - struct console *con = &d->console; - - console_close_tty(con); - if (con->log_fd != -1) { close(con->log_fd); con->log_fd = -1; } - free(con->buffer.data); - con->buffer.data = NULL; + if (con->buffer.data) + { + free(con->buffer.data); + con->buffer.data = NULL; + } + + if (con->xspath) + { + free(con->xspath); + con->xspath = NULL; + } +} + +static void cleanup_domain(struct domain *d) +{ + struct console *con = &d->console; + + console_close_tty(con); - free(con->xspath); - con->xspath = NULL; + console_cleanup(con); remove_domain(d); }