From patchwork Mon Aug 7 08:53:09 2017 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Bhupinder Thakur X-Patchwork-Id: 9884757 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 509BD60364 for ; Mon, 7 Aug 2017 08:56:10 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 4472D285D1 for ; Mon, 7 Aug 2017 08:56:10 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id 3982F285DC; Mon, 7 Aug 2017 08:56:10 +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.6 required=2.0 tests=BAYES_00,DKIM_SIGNED, RCVD_IN_DNSWL_MED, 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 DFA64285D1 for ; Mon, 7 Aug 2017 08:56:09 +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 1dednq-0004yd-HJ; Mon, 07 Aug 2017 08:54:22 +0000 Received: from mail6.bemta6.messagelabs.com ([193.109.254.103]) by lists.xenproject.org with esmtp (Exim 4.84_2) (envelope-from ) id 1dednp-0004wT-Ld for xen-devel@lists.xenproject.org; Mon, 07 Aug 2017 08:54:21 +0000 Received: from [85.158.143.35] by server-7.bemta-6.messagelabs.com id F0/29-03557-DBA28895; Mon, 07 Aug 2017 08:54:21 +0000 X-Brightmail-Tracker: H4sIAAAAAAAAA+NgFlrOIsWRWlGSWpSXmKPExsXiVRusp7tHqyP S4OMzEYvvWyYzOTB6HP5whSWAMYo1My8pvyKBNWPWqissBRMEKlZ83c/SwLiFt4uRi0NIYAaj xK9JfUwgDovAPGaJVVMnM4M4EgL9rBKnpixj7GLkBHLSJF6tfQZlV0nc2PyaBcQWEtCSOHpqN ivEqDYmiUUL2oASHBxsAiYSszokQGpEBJQk7q2aDLaBWWA+o0TTpF42kISwQJzEzkWLWEFsFg FViVtfr4HFeQV8JC4fOMAMsUxO4ua5TjCbEyh+/tIbqMXeEreP9TFOYBRYwMiwilGjOLWoLLV I19BML6koMz2jJDcxM0fX0MBMLze1uDgxPTUnMalYLzk/dxMjMLgYgGAH4/2NAYcYJTmYlER5 41e0RQrxJeWnVGYkFmfEF5XmpBYfYpTh4FCS4H2k0REpJFiUmp5akZaZAwxzmLQEB4+SCO8Ld aA0b3FBYm5xZjpE6hSjMcekA9u/MHG8mvD/G5MQS15+XqqUOG+OJlCpAEhpRmke3CBY/F1ilJ US5mUEOk2IpyC1KDezBFX+FaM4B6OSMK8WyD08mXklcPteAZ3CBHTKm8RWkFNKEhFSUg2Mktz uex1b1DJy6uYZfua3XRIf67LtU71W2u2e+JuvRFjvi7AG9a+UL2E94HGEvWiKpuXuZcfDP8/P D9R7s++u9Nk++87XjIapjDasB5mP2ezaafI9LafJL36P7DOFVbuKuIylGNurfXyE5XvuvWZPv eMfO0n+rxn71GMpeimv3fun7mM/LqzEUpyRaKjFXFScCACDtf41ugIAAA== X-Env-Sender: bhupinder.thakur@linaro.org X-Msg-Ref: server-11.tower-21.messagelabs.com!1502096059!73625359!1 X-Originating-IP: [74.125.83.46] 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 31648 invoked from network); 7 Aug 2017 08:54:20 -0000 Received: from mail-pg0-f46.google.com (HELO mail-pg0-f46.google.com) (74.125.83.46) by server-11.tower-21.messagelabs.com with AES128-GCM-SHA256 encrypted SMTP; 7 Aug 2017 08:54:20 -0000 Received: by mail-pg0-f46.google.com with SMTP id v77so31639938pgb.3 for ; Mon, 07 Aug 2017 01:54:20 -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=Ov0yX3aNbcYyz3rEkxC7Jj24UXoXKQTV1heD8+VZdmoc8aaHE20p4h/dwzspHr9W3S IRffSSg0oBmHrqX4BlB2Zvrs/E1JAESa0JPcwUaLgdQd/lgkuWKQl/ms+ZSwHrwdLIRd /sfaw6kWeyLJ1IqBzQefxDFljiNSHb0nGhgkY= 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=q/QjqV/z2GnFxEnhwLt8z9+t4Ht6EtcTg0ojUYp597vO/I02CqA6Z0mG60P+aajFQC sFa6Rze0ARUXMPte61h7Av220p74KWCA4i+0YXdi9dK05cozTyrb7kayWvI9M+FjbnZj nwWUugPQt0wvNaPvUZmlZb4XKLXGHBuHXxeVsi/IgrG77a4lZGVZA5EMcXIBSirYthsD Jhqih/NAgzvDLFPHd16iWMxz22j4U6bBcBfcSZww0YUAjKGtB066GbVxsVllivbyAdxp ZSQRpfk/0S6Kxj3IaAKbm/rPbFhEdPE/GvXUYjsdTaLz4mbNz4mICZv7Xa8GDnAX1yyL rStg== X-Gm-Message-State: AIVw113pkc1BpPSy3Grf+MzEs21r4Q9UB0fNrKOL9eXKzQQ3lJ2tVeqw tTxtS95OrHPaZ7mbamTjNQ== X-Received: by 10.84.234.15 with SMTP id m15mr13461607plk.247.1502096058582; Mon, 07 Aug 2017 01:54:18 -0700 (PDT) Received: from blr-ubuntu-linaro.wlan.qualcomm.com ([103.5.19.18]) by smtp.gmail.com with ESMTPSA id p77sm12604047pfi.153.2017.08.07.01.54.15 (version=TLS1_2 cipher=ECDHE-RSA-AES128-SHA bits=128/128); Mon, 07 Aug 2017 01:54:18 -0700 (PDT) From: Bhupinder Thakur To: xen-devel@lists.xenproject.org Date: Mon, 7 Aug 2017 14:23:09 +0530 Message-Id: <1502095997-31219-18-git-send-email-bhupinder.thakur@linaro.org> X-Mailer: git-send-email 2.7.4 In-Reply-To: <1502095997-31219-1-git-send-email-bhupinder.thakur@linaro.org> References: <1502095997-31219-1-git-send-email-bhupinder.thakur@linaro.org> Cc: Wei Liu , Julien Grall , Stefano Stabellini , Ian Jackson Subject: [Xen-devel] [PATCH 17/25 v7] 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);