From patchwork Mon Aug 7 08:53:04 2017 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Bhupinder Thakur X-Patchwork-Id: 109531 Delivered-To: patch@linaro.org Received: by 10.182.109.195 with SMTP id hu3csp2482017obb; Mon, 7 Aug 2017 01:55:56 -0700 (PDT) X-Received: by 10.107.172.1 with SMTP id v1mr5806985ioe.126.1502096156086; Mon, 07 Aug 2017 01:55:56 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1502096156; cv=none; d=google.com; s=arc-20160816; b=vPzM0JN+q5FL5MKAdifE4lWN00msuK6bnKDt93mPuLdW5o2oy4zveFFrtNaeFfa9aC yLsPF/r3KNm66lXAAiGjpA0GDZaMsxsOKFKpD+pEyYRjcAVN0QhfHR2hPdf5qnZHx33d LTrNSZpgPNEiUPk/+t3w1ge/7Ez3m0vRV0+4GzaJECthmSZlH2x8T2y764rtHS+0QVt4 WVwYts+uOBoEqnbRwL2O/10DcGy0F3VpkqOX0+xY4xmw0hhD4OUE4mMzC96pJ01MFwAF 1tD3lWymQ2h0QPnCHCsbygkC4n4oDzEvdL5TMAaw3QObKMwdWW+nBf6BAuPuTP/sNSPg bhUg== 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=gGKmjvGPte/o6PocXYbnXDYmdZ1xSxQ824R0lhHKWKJHcZ6g+DfM8bTgenk+VjRMZW EDP1rqxcCeh+MeiOQbt1bURYoDhOR9fgNlvCnrffQXivORn7Au6mVjuWM4LDf/dUb10O 31uJBEzCDQpY/W+sCS/tSZUWUq02VljcnhcL8telkvl2W5plAcHaTybTAVsboADA5oip eefAro+ZTOK4QCO4aBdV/BTaesW4oQFG1+NhW90KyIeKtqE9HM0O/hXvSi4CRqnUkA0m MHP8KJR1z9EytUiF4CQXEKUpZmiDesgXIvdo8PzySnGpi5NGivSRHZBRKxugJsWRmzek Vvjw== ARC-Authentication-Results: i=1; mx.google.com; dkim=neutral (body hash did not verify) header.i=@linaro.org header.b=gGhW/U6E; 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 l21si7818389ioi.369.2017.08.07.01.55.55 (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Mon, 07 Aug 2017 01:55:56 -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=gGhW/U6E; 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 1dednb-0004e5-U8; Mon, 07 Aug 2017 08:54:07 +0000 Received: from mail6.bemta6.messagelabs.com ([193.109.254.103]) by lists.xenproject.org with esmtp (Exim 4.84_2) (envelope-from ) id 1dedna-0004cg-QC for xen-devel@lists.xenproject.org; Mon, 07 Aug 2017 08:54:06 +0000 Received: from [193.109.254.147] by server-2.bemta-6.messagelabs.com id D9/FD-27137-EAA28895; Mon, 07 Aug 2017 08:54:06 +0000 X-Brightmail-Tracker: H4sIAAAAAAAAA+NgFlrKIsWRWlGSWpSXmKPExsXiVRtspLtWqyP S4NI9IYvvWyYzOTB6HP5whSWAMYo1My8pvyKBNWPv5bvMBd94Ki4+X8/WwPiQq4uRi0NIYDqj xOb+BSwgDovAPGaJY+/us4M4EgL9rBIf591i7GLkBHLSJI5duMAEYVdI/L59HywuJKAlcfTUb FaIUW1MEk+/dgF1c3CwCZhIzOqQAKkREVCSuLdqMhNIDbPAfEaJpkm9bCAJYYEYiR8nLrKB1L MIqEq0flUECfMK+EisnHOIGWKXnMTNc51gNidQ/PylNywQe70lbh/rY5zAKLCAkWEVo3pxalF ZapGuqV5SUWZ6RkluYmaOrqGBmV5uanFxYnpqTmJSsV5yfu4mRmBgMQDBDsbpl/0PMUpyMCmJ 8savaIsU4kvKT6nMSCzOiC8qzUktPsQow8GhJMH7WbMjUkiwKDU9tSItMwcY4jBpCQ4eJRHeF +pAad7igsTc4sx0iNQpRmOOSQe2f2HieDXh/zcmIZa8/LxUKXHecyCTBEBKM0rz4AbBYu8So6 yUMC8j0GlCPAWpRbmZJajyrxjFORiVhHnPg0zhycwrgdv3CugUJqBT3iS2gpxSkoiQkmpg3KF VUPmylaH/dptTz/bcJUuc5p9b+y3fuMboVOEFJn7d9/tFJm6ubfd8VneQaVtK2vvCecnhB+el bZi9cR3HBoYQRu5TmlfLmCclzuFZPN/dReaMDovl0WwpH2+JfDtxlmPn59Rvz12VNdtl872mo /Yz3a+1nuU+u/SNs6sTg9iC7dO+pOf5KLEUZyQaajEXFScCAFSd93K4AgAA X-Env-Sender: bhupinder.thakur@linaro.org X-Msg-Ref: server-15.tower-27.messagelabs.com!1502096044!57774556!1 X-Originating-IP: [74.125.83.50] 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 23824 invoked from network); 7 Aug 2017 08:54:05 -0000 Received: from mail-pg0-f50.google.com (HELO mail-pg0-f50.google.com) (74.125.83.50) by server-15.tower-27.messagelabs.com with AES128-GCM-SHA256 encrypted SMTP; 7 Aug 2017 08:54:05 -0000 Received: by mail-pg0-f50.google.com with SMTP id u5so31663226pgn.0 for ; Mon, 07 Aug 2017 01:54:05 -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=gGhW/U6EeLvZ0ym58RYyB1lPeSbhPo28noGy0QUsKiQJs80Wrzw+haKrNNTbNdjJhE nNA0zKc+Iu3OcqiSFC/rz6E7kq+9f1kR3xjrJBMZX+YRMVLwaSfu0NvqFpcPfZ96jf1q siZp70Tcuj4/k+i37LSBCiivWbsxKuCp9anQc= 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=J90mvSxjzd/CgXy3biPY+ZOkGT35cfHVXeREb9MeRkEyhbAUhPZXn6ATsMBERCmWX2 ato9420LJ9Z2Lqqu4JSCCzYa7OBogl+j1uq5We/vOvlrvauYsYiMJaCVnwwwV/kmoa29 9Ak4Q42Na+AuS97H6jfVo/iu+0kEI3Ljpb6J4WGqT0AWtpI/z8GMLW1D/ktta6Qi4uhF JWQ91XYbs7qiYYjpPkZGQ6c+mJ+Ee6jeKK7BI0Dpw8GYRYgiQsDqHa17udN1Po3DAtLV C9lWwBCmbwyG9X+jurWMrF3/S4cWHq9/zCHtTLm7DbV9cbSXkuNOTg2RsspI1g9fXDk9 2mGw== X-Gm-Message-State: AIVw112QZ7RUVaLlZp7cNvZSQJYG2rqm4M3kXPGYd5Tgh1f0fyUqEGcG D9e8ufNGaxpzgtoOFL1Qvw== X-Received: by 10.84.241.70 with SMTP id u6mr12969748plm.96.1502096043621; Mon, 07 Aug 2017 01:54:03 -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.01 (version=TLS1_2 cipher=ECDHE-RSA-AES128-SHA bits=128/128); Mon, 07 Aug 2017 01:54:03 -0700 (PDT) From: Bhupinder Thakur To: xen-devel@lists.xenproject.org Date: Mon, 7 Aug 2017 14:23:04 +0530 Message-Id: <1502095997-31219-13-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 12/25 v7] 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);