From patchwork Wed Sep 27 06:13:21 2017 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Bhupinder Thakur X-Patchwork-Id: 114342 Delivered-To: patch@linaro.org Received: by 10.140.106.117 with SMTP id d108csp4665509qgf; Tue, 26 Sep 2017 23:17:10 -0700 (PDT) X-Received: by 10.36.131.4 with SMTP id d4mr828555ite.43.1506493030026; Tue, 26 Sep 2017 23:17:10 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1506493030; cv=none; d=google.com; s=arc-20160816; b=KW/Mk5OFolXjViDtrLEn+qIWLB5dxyAhIiDAr5mPwZzTbWVXZ7u2MMsyEtniQdbRAe uLzXmxwK78fzC1GO+ZCnFm9anxnRnkZjCLR1E7vOhKA8w3EU4wViqTReiGs689JtcaHg rmFYeouPnYJCLHXPrEEcFddpKqHEGW9ci18aTkhoqrCK10gWaNILgaWSP6P45sEkQVpm 9CV3OhM1DCqLLFZyOeY2/pQ8PnrnJoIk5yLtvfIwUjgzwtYNP1eGGCM2FN4LPVMx9TRy voRLi2KykVO/EPimvKAjlRoEtAN+xSi6IDSaM4J3YRwLFz0L8ckNdaVRja5xAieG0rws e9hA== 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=RBIonTcOwRkHLeFjaA/5ZTqVDWSkdEy4IXZH98gtXnM=; b=mTVGYA7qUtday5AqA16smLDyXpxHVqAQK1ZWZmgSlg8hMpSp9Q218gHzBGACv+Mzm8 ypRARjcwVqBzSwCXwSxsAqL76nUS8TCIsUBmwZ1Yq/ejy5Md5Rqdh2mnG0uDra8amiGn zJXzjqAg09C/jWLU8uE4oq3pjXwzHyB59iWeqcTE9GNFoyuCZVH0zC0bdS0kuUBAsW7t nxA4vwuuVuCboUNUTe/H9rm1nV1BmIDGIAKpIaWbjkArk943Kn/UMQb5FjZfphLocakV 0/zo9i2Km9Kh5oeelVw5IBFZmV8GagphedEPUQkBhjuHS1DWNkDNcMPVLxa3qnnYoj8H NUGw== ARC-Authentication-Results: i=1; mx.google.com; dkim=neutral (body hash did not verify) header.i=@linaro.org header.s=google header.b=OWP8kGBd; 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 192si3476936itw.92.2017.09.26.23.17.09 (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Tue, 26 Sep 2017 23:17:10 -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.s=google header.b=OWP8kGBd; 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 1dx5bb-0002eQ-G8; Wed, 27 Sep 2017 06:13:59 +0000 Received: from mail6.bemta6.messagelabs.com ([193.109.254.103]) by lists.xenproject.org with esmtp (Exim 4.84_2) (envelope-from ) id 1dx5bZ-0002b2-Jf for xen-devel@lists.xenproject.org; Wed, 27 Sep 2017 06:13:57 +0000 Received: from [193.109.254.147] by server-5.bemta-6.messagelabs.com id F0/2A-03454-4A14BC95; Wed, 27 Sep 2017 06:13:56 +0000 X-Brightmail-Tracker: H4sIAAAAAAAAA+NgFtrGIsWRWlGSWpSXmKPExsXiVRtsprvE8XS kwY+9Ihbft0xmcmD0OPzhCksAYxRrZl5SfkUCa8bey3eZC77xVFx8vp6tgfEhVxcjJ4eQwAxG iY4DOl2MXBwsAvOYJfZ8OcgO4kgI9LNK3F6xlaWLkQPIyZN4sUkBpEFCIE3i6qYpTBB2mUTDm mcsEIO0JI6ems0K0isksIJJ4trqSUwgvWwCJhKzOiRAakQElCTurZrMBFLDLDCfUaJpUi8bSE JYIFbiXMd1RpB6FgFViYf/UkDCvAI+Et+v7GeH2CUncfNcJzOIzQkUP91/mw1ir7fEpZX9rBM YBRcwMqxi1ChOLSpLLdI1MtdLKspMzyjJTczM0TU0MNPLTS0uTkxPzUlMKtZLzs/dxAgMNwYg 2MG4eG3gIUZJDiYlUd6a/6cihfiS8lMqMxKLM+KLSnNSiw8xynBwKEnwznM4HSkkWJSanlqRl pkDDHyYtAQHj5IIbxRImre4IDG3ODMdInWK0ZLjS++NP0wc+/bcApIdN+/+YRJiycvPS5US56 0CaRAAacgozYMbB4vOS4yyUsK8jEAHCvEUpBblZpagyr9iFOdgVBLmXQgyhSczrwRu6yugg5i ADuqdegLkoJJEhJRUA2Oo8Mx1Nyyb1RuZU3nEOIovPm39m3fsVpbgsmuzJix8nXHpC2tDiS6z qSLj8ugXabzz+HXi/LpeGW36aXaP50ChBPPWBJOeBckZjgrqlu5bdnf+vJ/Fd/Okx9+yDW82C vcu96vf+83MJu5Fm+KaV5beQpOKplkltV6d5zZJq0M0U2oFS7l/jhJLcUaioRZzUXEiAB0PBI jJAgAA X-Env-Sender: bhupinder.thakur@linaro.org X-Msg-Ref: server-4.tower-27.messagelabs.com!1506492835!117902735!1 X-Originating-IP: [74.125.83.54] 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 8302 invoked from network); 27 Sep 2017 06:13:56 -0000 Received: from mail-pg0-f54.google.com (HELO mail-pg0-f54.google.com) (74.125.83.54) by server-4.tower-27.messagelabs.com with AES128-GCM-SHA256 encrypted SMTP; 27 Sep 2017 06:13:56 -0000 Received: by mail-pg0-f54.google.com with SMTP id i130so7220540pgc.3 for ; Tue, 26 Sep 2017 23:13:56 -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=yB+nxIvgk8UjZRr/CwimK1H7zFddzpCzBRq7KGA1phI=; b=OWP8kGBdShsB2FfJjqbETfUTALPZ9rQXNFBN0kbc1zsE/9gQwuY8LzzNAkD5dsnOHP MHfNEbdSWqxt/bXGeT/Twd5D6vhMJ2IdLXbYxbulSkKwr4yOuP8g95bWChxOTkX7xEcM IZRlzLuLf8GRijB6h2b5vgpdjjxITbgjdxUsY= 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=yB+nxIvgk8UjZRr/CwimK1H7zFddzpCzBRq7KGA1phI=; b=QNtZlKZhgX3QujoJhEZiyMeOgzzErpxU05fdP4pwtKTQeqd6I03+QCZhh0faHn5xFg fD+juxBdzUEoA9w0mMzorU+hVjG31fO9i/6/9XSLFGyg4VnXQzqu3/TgoEoXTPSi1mvH X9BG8Vu+zDqpXii56WVMLu5DSNrQ/lTuCiTvWQkTjTKlt4kj2v9+dv5/TgPhfdJGtvOI aWRZEp6RceojeR+uoxPLFrwoApEBLyOWkv8nT4BdC0Kk5Q/l1AT7nUe3+zJylWmW9tPz 841m4SeBNpHDhr6eiCyKRl4JgYm8sGo07p6HBlAcNZJBET72cPh4sb9CL/3TFBaueqAa tspg== X-Gm-Message-State: AHPjjUhS9BLshksn4+5oJJh8mGy1qUAweCK8gWpWsEkV7qVYwzKGjV/6 3VjMOB5xI7ifekj/SO4JsMfZfkZ+Irs= X-Google-Smtp-Source: AOwi7QAV23G+LeEu8Fxh/Hgcr93T9ko3GJ/MpgOEYm4qpRE2gI+K5VIvjf1K8aYB35L2m5kea2pikA== X-Received: by 10.84.254.4 with SMTP id b4mr307280plm.285.1506492834504; Tue, 26 Sep 2017 23:13:54 -0700 (PDT) Received: from blr-ubuntu-linaro.wlan.qualcomm.com (h3.248.139.40.ip.windstream.net. [40.139.248.3]) by smtp.gmail.com with ESMTPSA id s187sm18013485pgb.82.2017.09.26.23.13.53 (version=TLS1_2 cipher=ECDHE-RSA-AES128-SHA bits=128/128); Tue, 26 Sep 2017 23:13:54 -0700 (PDT) From: Bhupinder Thakur To: xen-devel@lists.xenproject.org Date: Wed, 27 Sep 2017 11:43:21 +0530 Message-Id: <1506492816-25954-13-git-send-email-bhupinder.thakur@linaro.org> X-Mailer: git-send-email 2.7.4 In-Reply-To: <1506492816-25954-1-git-send-email-bhupinder.thakur@linaro.org> References: <1506492816-25954-1-git-send-email-bhupinder.thakur@linaro.org> Cc: Wei Liu , Julien Grall , Stefano Stabellini , Ian Jackson Subject: [Xen-devel] [PATCH 12/27 v11] xen/arm: vpl011: Add a new buffer_available 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 buffer_available function to check if more data is allowed to be buffered. 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 | 14 +++++++++++--- 1 file changed, 11 insertions(+), 3 deletions(-) diff --git a/tools/console/daemon/io.c b/tools/console/daemon/io.c index 1da08d7..0009bbe 100644 --- a/tools/console/daemon/io.c +++ b/tools/console/daemon/io.c @@ -163,6 +163,16 @@ static int write_with_timestamp(int fd, const char *data, size_t sz, return 0; } +static inline bool buffer_available(struct console *con) +{ + if (discard_overflowed_data || + !con->buffer.max_capacity || + con->buffer.size < con->buffer.max_capacity) + return true; + else + return false; +} + static void buffer_append(struct console *con) { struct buffer *buffer = &con->buffer; @@ -1120,9 +1130,7 @@ void handle_io(void) con->next_period < next_timeout) next_timeout = con->next_period; } else if (con->xce_handle != NULL) { - if (discard_overflowed_data || - !con->buffer.max_capacity || - con->buffer.size < con->buffer.max_capacity) { + if (buffer_available(con)) { int evtchn_fd = xenevtchn_fd(con->xce_handle); con->xce_pollfd_idx = set_fds(evtchn_fd, POLLIN|POLLPRI);