From patchwork Fri Sep 22 08:23:11 2017 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Bhupinder Thakur X-Patchwork-Id: 113983 Delivered-To: patch@linaro.org Received: by 10.140.106.117 with SMTP id d108csp3011179qgf; Fri, 22 Sep 2017 01:26:07 -0700 (PDT) X-Received: by 10.36.141.67 with SMTP id w64mr5023868itd.8.1506068767706; Fri, 22 Sep 2017 01:26:07 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1506068767; cv=none; d=google.com; s=arc-20160816; b=Hv72jvL5Z31u7xcEuPLGdnVaRMICAO4jS1vcGWPOpj6+hlnXnjuWZ2LcLrCmOofJzG vogYjtbbHArRm3HwRRADgRGYoZvlx8LBFQPDAhUPic47KSlIqwDkNpaVH6tUpF8m4q52 Q+aL5qTEN5AW3Ql+dLg0t+MGpukqivlR9iLUUb99OpnafP+ZoswvgsL9i83fpvWQiIaj Cd3VtpDUJiDX3WuCcGj0JuFKmOT98S0gLxn4gSnIpwP7mL552PXGFRlY4FCwEiaw0zGP ZuDU1M+VhqR9qnOK9S/7B0ksRtZZUse6SkoW1rt0qIDCPJLydV24l8jmr2N+xz7fyn2T G23Q== 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=Qz+z5WFTEFvHO47tmj+Hta7+L4N+D0L6I2TNmCpHA/+jA7t5pYu+5FsjwV7LP12i7Q f9TxZNoUT0WCC4KsApItOWCUC1eI1u8PxnMGcmm1hEue6j2RLNgc5dx9CgPe2AuVjK2F hr3yqrXfY89pxAzX8XYaOeybQkAkHXJgE9sQdx+zSEtlsSciD0iWl+YoG61D/qeJArkE TZy8uzQBvqarUQtNYbxxXFZcG6cxvhvhUmaVOrSAlLuwm4wdja2R8gsj24tu8HkMTIwp PW7nA3mSjEJXmgv2/vEUsjYUVued1/xV9VnWkJgUBf5s+Gq/QKo0koY8F26UXqWevh8k qCUg== ARC-Authentication-Results: i=1; mx.google.com; dkim=neutral (body hash did not verify) header.i=@linaro.org header.s=google header.b=B9YJyYU7; 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 j6si3451560ita.115.2017.09.22.01.26.07 (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Fri, 22 Sep 2017 01:26:07 -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=B9YJyYU7; 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 1dvJFv-000407-1T; Fri, 22 Sep 2017 08:24:15 +0000 Received: from mail6.bemta6.messagelabs.com ([193.109.254.103]) by lists.xenproject.org with esmtp (Exim 4.84_2) (envelope-from ) id 1dvJFt-0003yV-Jm for xen-devel@lists.xenproject.org; Fri, 22 Sep 2017 08:24:13 +0000 Received: from [85.158.143.35] by server-4.bemta-6.messagelabs.com id CD/EF-03283-CA8C4C95; Fri, 22 Sep 2017 08:24:12 +0000 X-Brightmail-Tracker: H4sIAAAAAAAAA+NgFtrAIsWRWlGSWpSXmKPExsXiVRusrbvmxJF Ig6PbxC2+b5nM5MDocfjDFZYAxijWzLyk/IoE1oy9l+8yF3zjqbj4fD1bA+NDri5GLg4hgemM EiubD7GCOCwC85glZix9A+ZICPSzSqz90s3cxcgJ5ORJHD61mBXCTpPYcX0dUJwDyC6XuPi9C iQsJKAlcfTUbFYIeweTxMaJISAlbAImErM6JEDCIgJKEvdWTWYCGc8sMJ9RomlSLxtIQlggVm Ll324mEJtFQFXi5McL7CA2r4CPxI71HVAnyEncPNcJZnMCxdf+38ACsctbYuuNqywTGAUXMDK sYlQvTi0qSy3SNdFLKspMzyjJTczM0TU0MNPLTS0uTkxPzUlMKtZLzs/dxAgMNwYg2MHYfdn/ EKMkB5OSKO/jI0cihfiS8lMqMxKLM+KLSnNSiw8xynBwKEnw2h8HygkWpaanVqRl5gADHyYtw cGjJMIbDpLmLS5IzC3OTIdInWI05ti359YfJo6Om3f/MAmx5OXnpUqJ8waAlAqAlGaU5sENgk XkJUZZKWFeRqDThHgKUotyM0tQ5V8xinMwKgnzxoBM4cnMK4Hb9wroFCagU8pXg51SkoiQkmp g1D1ZI/xQTm/6RKd3Xr3ZcmsYWpquFJ3IqFvgzHmDd08gz4fvr6bIKHfwlcjt9V00tXnLCnUR BqWleW4HKqdkTnxsds7mpeP8wPfMSsY/vkse0th0LiXi54nH3rEXWz6nJJwQ+vu+XfdR+jPxr yqJXGahSVmMZXHsdgeWbxMx2aRuaGGU7ZCoxFKckWioxVxUnAgAjiQkvsMCAAA= X-Env-Sender: bhupinder.thakur@linaro.org X-Msg-Ref: server-10.tower-21.messagelabs.com!1506068651!77458920!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.45; banners=-,-,- X-VirusChecked: Checked Received: (qmail 35191 invoked from network); 22 Sep 2017 08:24:12 -0000 Received: from mail-pg0-f43.google.com (HELO mail-pg0-f43.google.com) (74.125.83.43) by server-10.tower-21.messagelabs.com with AES128-GCM-SHA256 encrypted SMTP; 22 Sep 2017 08:24:12 -0000 Received: by mail-pg0-f43.google.com with SMTP id i130so250418pgc.3 for ; Fri, 22 Sep 2017 01:24:12 -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=B9YJyYU7/IEx6Dhj1gZ4oUPI0mJVTCUUoK6fEMWIw7nict0ItXb4SWMg7MMwtpg0ek qPteAchjTPVXhiqtmTP5I3TG6D0k6oosj2p5j+QN/8Vpa5kuYsgphfM51KGwVzxBzUlF mFihXqjrE920yBAHuzj3iQchO6iYgCA9lr0V8= 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=Vftw3DsJwJ3KhFsPTgy/ScD3YPoCaSvNM38hnBZ8CxTagZDOvyOMmhKKHd5JiINfSM Kvt75pxKtzdegkWGp0qxlQfHTDv3IBi/ZI1fJoYhSI65fyJxhQHchsEurWZLzdTf27aj cFktetkpeBvPk8XnTngYcJZqYe/Q+PMlWMyF1UkCWvGay5MkFLTRUEqD2df81aXP5FfE QTk1/9yyRCHgDDjDyRoeMwc0FZEwIMP3NW6Henziu5XyaAVJgXYwuCsM7Ofuyt4hsJr/ dnN4A6+YzGPNKlkB7lWlhg6jEqsueLiFD9lkwqkVmH6QTxe1S2eEgvqohUZtkjdbLFmX 4fTg== X-Gm-Message-State: AHPjjUhiMEeQhdmpNO3szOQcntfJgQmiXS1x7pGkekr4V2HKu/9EKLmO 1CgBLiIEkrdhKdlCqjoHPXtgUE37BCY= X-Google-Smtp-Source: AOwi7QCverAJI9lqJJNT2smTQ5PvnTCuWmYf7WPcd//doDvN+rr5z3y9NJ4n7YDA81LV5CZiOC4KgA== X-Received: by 10.101.72.5 with SMTP id h5mr8755840pgs.305.1506068650611; Fri, 22 Sep 2017 01:24:10 -0700 (PDT) Received: from blr-ubuntu-linaro.qualcomm.com (blr-bdr-fw-01_globalnat_allzones-outside.qualcomm.com. [103.229.18.19]) by smtp.gmail.com with ESMTPSA id f74sm5569284pfa.36.2017.09.22.01.24.08 (version=TLS1_2 cipher=ECDHE-RSA-AES128-SHA bits=128/128); Fri, 22 Sep 2017 01:24:10 -0700 (PDT) From: Bhupinder Thakur To: xen-devel@lists.xenproject.org Date: Fri, 22 Sep 2017 13:53:11 +0530 Message-Id: <1506068606-17066-13-git-send-email-bhupinder.thakur@linaro.org> X-Mailer: git-send-email 2.7.4 In-Reply-To: <1506068606-17066-1-git-send-email-bhupinder.thakur@linaro.org> References: <1506068606-17066-1-git-send-email-bhupinder.thakur@linaro.org> Cc: Wei Liu , Julien Grall , Stefano Stabellini , Ian Jackson Subject: [Xen-devel] [PATCH 12/27 v10] 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);