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: 9844917 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 A5BC46037F for ; Mon, 17 Jul 2017 13:09:39 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 9864B26E4A for ; Mon, 17 Jul 2017 13:09:39 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id 8D24F28505; Mon, 17 Jul 2017 13:09:39 +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=-2.1 required=2.0 tests=BAYES_00,DKIM_SIGNED, RCVD_IN_DNSWL_MED, RCVD_IN_SORBS_SPAM, RCVD_IN_SORBS_WEB, T_DKIM_INVALID autolearn=ham version=3.3.1 Received: from lists.xenproject.org (lists.xenproject.org [192.237.175.120]) (using TLSv1.2 with cipher AES128-GCM-SHA256 (128/128 bits)) (No client certificate requested) by mail.wl.linuxfoundation.org (Postfix) with ESMTPS id E946D28464 for ; Mon, 17 Jul 2017 13:09:36 +0000 (UTC) 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" X-Virus-Scanned: ClamAV using ClamSMTP 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); }