From patchwork Mon Aug 28 08:56:00 2017 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Bhupinder Thakur X-Patchwork-Id: 9924839 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 CF7FB60311 for ; Mon, 28 Aug 2017 08:59:01 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 8F27628671 for ; Mon, 28 Aug 2017 08:59:01 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id 841022868D; Mon, 28 Aug 2017 08:59:01 +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=-4.1 required=2.0 tests=BAYES_00,DKIM_SIGNED, RCVD_IN_DNSWL_MED,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 33C8628671 for ; Mon, 28 Aug 2017 08:59:01 +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 1dmFrB-0005MW-8x; Mon, 28 Aug 2017 08:57:17 +0000 Received: from mail6.bemta6.messagelabs.com ([193.109.254.103]) by lists.xenproject.org with esmtp (Exim 4.84_2) (envelope-from ) id 1dmFrA-0005Ks-Ea for xen-devel@lists.xenproject.org; Mon, 28 Aug 2017 08:57:16 +0000 Received: from [193.109.254.147] by server-8.bemta-6.messagelabs.com id F9/1D-09901-BEAD3A95; Mon, 28 Aug 2017 08:57:15 +0000 X-Brightmail-Tracker: H4sIAAAAAAAAA+NgFlrAIsWRWlGSWpSXmKPExsXiVRuso/v61uJ Igwf3OSy+b5nM5MDocfjDFZYAxijWzLyk/IoE1oxZq66wFEwQqFjxdT9LA+MW3i5GTg4hgemM EpPfxnQxcnGwCMxjlvixcB0biCMh0M8qMXnCS3aQKgmBNIm3iz4wQdhVEhdaP7BCdGtJHD01m xWkQUhgP5PEywMrGLsYOTjYBEwkZnVIgNSICChJ3Fs1mQmkhllgPqNE06ReNpCEsECcxKJbk8 FsFgFViUe3NoAt4BXwkZj3/i3UMjmJm+c6mUFsTqD4jrV32SEWe0t0vf7AOoFRYAEjwypGjeL UorLUIl1Dc72kosz0jJLcxMwcXUMDM73c1OLixPTUnMSkYr3k/NxNjMDQYgCCHYy3NwYcYpTk YFIS5d1ZsThSiC8pP6UyI7E4I76oNCe1+BCjDAeHkgTvmZtAOcGi1PTUirTMHGCQw6QlOHiUR Hg/gKR5iwsSc4sz0yFSpxh1OSYd2P6FSYglLz8vVUqc1wekSACkKKM0D24ELOIuMcpKCfMyAh 0lxFOQWpSbWYIq/4pRnINRSZj3L8gUnsy8ErhNr4COYAI6QlFwIcgRJYkIKakGxiKZgKWcxf+ f/mng/HKOM/T15pJytsb/sTH/tG8GMF986DeLl89h57LExbNzdBeVn/XZd2Iie1rnwwWX4prm /Ix95v3p7SaWu0/WCyW+3nP8QV/nx9YPDxrr/O/92R9uWepilV6/S13LbsXOSdcP1D/VsVnwd cLBEvMQY2+fIg+9iVsNX3GUlimxFGckGmoxFxUnAgBjHgVGswIAAA== X-Env-Sender: bhupinder.thakur@linaro.org X-Msg-Ref: server-2.tower-27.messagelabs.com!1503910634!54195099!1 X-Originating-IP: [74.125.83.44] X-SpamReason: No, hits=0.0 required=7.0 tests= X-StarScan-Received: X-StarScan-Version: 9.4.45; banners=-,-,- X-VirusChecked: Checked Received: (qmail 22694 invoked from network); 28 Aug 2017 08:57:15 -0000 Received: from mail-pg0-f44.google.com (HELO mail-pg0-f44.google.com) (74.125.83.44) by server-2.tower-27.messagelabs.com with AES128-GCM-SHA256 encrypted SMTP; 28 Aug 2017 08:57:15 -0000 Received: by mail-pg0-f44.google.com with SMTP id t3so22364040pgt.0 for ; Mon, 28 Aug 2017 01:57:14 -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=cKW4VVAXHwcprLM7odui2WUoZIfS5KdXFh4XFIsCHUU=; b=FVElzWjpYsI+iOlb+ZT9hC9iqqHSNJOeKtRRukO0D6ZpHK8LcDrVxGNuWWc7jTy9gl nZKd1TGPhdoZlzq+ofSBbngRRrkDgtuGx8g2YeWj0wtoB8hmOb7fp4cXCYSMhF/o4ay3 pGaCaS7nXm150sqwY86C1NZ5pasQwhjPevdLI= 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=cKW4VVAXHwcprLM7odui2WUoZIfS5KdXFh4XFIsCHUU=; b=i6TBEtIaoMxSQSMXLRKcJXWhDqY7oh3raNaTHcv016AhkaexKHSDFh3wo/Bg/bWi8U XyI+k5IthdD6nPwTQvS9cVUr5hAkxEpv5UBZ0pX1MLBpuU9/8Y7FW+8q9pITVbqjf6NL 6m4akgDXKZQgePPM9jmvjjOyWUPIqHPKaC2AUPbZtDg3Hl4cELxLL67feBKwMqGz/qnE Etn+sKIrPsgn0OpdDp4ig94Bhhzl3FpnDmVGjvqKLXDmjol+J9TJ/fzoTckHd6nYnNJN aDuCULDFIBQfPL7MHc0HFiV5z/ia6tCZ5hb+jmi9snG7fiPketqoORhFpVe6hxLilkY5 xNzg== X-Gm-Message-State: AHYfb5j8QgiDhaVAMmZozCCuu6vGQmPsBnejeHsmitwJpR6dKHbMeyd6 IcpTfG1dzSS31IOAl0Ozzw== X-Received: by 10.99.44.150 with SMTP id s144mr6533785pgs.318.1503910633540; Mon, 28 Aug 2017 01:57:13 -0700 (PDT) Received: from blr-ubuntu-linaro.wlan.qualcomm.com (blr-bdr-fw-01_globalnat_allzones-outside.qualcomm.com. [103.229.18.19]) by smtp.gmail.com with ESMTPSA id d88sm21713569pfl.158.2017.08.28.01.57.10 (version=TLS1_2 cipher=ECDHE-RSA-AES128-SHA bits=128/128); Mon, 28 Aug 2017 01:57:13 -0700 (PDT) From: Bhupinder Thakur To: xen-devel@lists.xenproject.org Date: Mon, 28 Aug 2017 14:26:00 +0530 Message-Id: <1503910570-24427-18-git-send-email-bhupinder.thakur@linaro.org> X-Mailer: git-send-email 2.7.4 In-Reply-To: <1503910570-24427-1-git-send-email-bhupinder.thakur@linaro.org> References: <1503910570-24427-1-git-send-email-bhupinder.thakur@linaro.org> Cc: Wei Liu , Julien Grall , Stefano Stabellini , Ian Jackson Subject: [Xen-devel] [PATCH 17/27 v8] xen/arm: vpl011: Add a new handle_console_tty 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 handle_console_tty function. This function performs read/write from/to console tty. Signed-off-by: Bhupinder Thakur Reviewed-by: Stefano Stabellini Acked-by: Wei Liu --- 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 | 35 +++++++++++++++++++---------------- 1 file changed, 19 insertions(+), 16 deletions(-) diff --git a/tools/console/daemon/io.c b/tools/console/daemon/io.c index c361b42..5c6da31 100644 --- a/tools/console/daemon/io.c +++ b/tools/console/daemon/io.c @@ -1130,6 +1130,24 @@ static void maybe_add_console_tty_fd(struct console *con) } } +static void handle_console_tty(struct console *con) +{ + if (con->master_fd != -1 && con->master_pollfd_idx != -1) { + if (fds[con->master_pollfd_idx].revents & + ~(POLLIN|POLLOUT|POLLPRI)) + console_handle_broken_tty(con, domain_is_valid(con->d->domid)); + else { + if (fds[con->master_pollfd_idx].revents & + POLLIN) + handle_tty_read(con); + if (fds[con->master_pollfd_idx].revents & + POLLOUT) + handle_tty_write(con); + } + } + con->master_pollfd_idx = -1; +} + void handle_io(void) { int ret; @@ -1260,22 +1278,7 @@ void handle_io(void) handle_console_ring(con); - if (con->master_fd != -1 && con->master_pollfd_idx != -1) { - if (fds[con->master_pollfd_idx].revents & - ~(POLLIN|POLLOUT|POLLPRI)) - console_handle_broken_tty(con, - domain_is_valid(d->domid)); - else { - if (fds[con->master_pollfd_idx].revents & - POLLIN) - handle_tty_read(con); - if (fds[con->master_pollfd_idx].revents & - POLLOUT) - handle_tty_write(con); - } - } - - con->master_pollfd_idx = -1; + handle_console_tty(con); if (d->last_seen != enum_pass) shutdown_domain(d);