Received: by 2002:a05:6a10:5bc5:0:0:0:0 with SMTP id os5csp3256089pxb; Wed, 13 Oct 2021 02:12:17 -0700 (PDT) X-Google-Smtp-Source: ABdhPJxuloq5t/wQa6jxYYbKNeJvl5VdkfWud5mNNbl+tWkb9/y3mmlfnCDzjbd9UYcGZn7gE3I4 X-Received: by 2002:a17:906:3148:: with SMTP id e8mr39457227eje.240.1634116337107; Wed, 13 Oct 2021 02:12:17 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1634116337; cv=none; d=google.com; s=arc-20160816; b=hRtUWcC3paMyY4eNguqsndYs+OoPYoLRBng9EN65ewPdrED6tzT09bMMvBVEGcN1Zb HDENDQNxdgrYHJDk7cSWY4jZrrNvKVnoSOPAxFCU8gNOUtXvLQrKJjz7nrx7ABHr/3gW Suzvc3E9VieJd6Ehv7vug+gO5jrA6AvOo1Dr/u+5ZQDAgz6DkPYkqAZfteyx0TEMBJ7A 3aCe3sAlVROQV3N5qGbr+hnnH4rHZQ55HCwpTYFRLCPal4WEjd0KfRbgWS/5Q3rmFL/Y 0UP9P2SpVR/02FcDbi3kLfXltZuwaFT6DNB9gxL5wZX71tH5gOpXWi5206VimE13Erzw lkOQ== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:mime-version :references:in-reply-to:message-id:date:subject:cc:to:from; bh=U1aSnVRGNn/Ax+ois/qTsWcNkjujHBLH89wl32VFGfY=; b=lPxIlxlBQXvsWrMNnHhm0loZueCi36oSko5kroN1l11hvU7ZFxPkk9jBdaNS98Lb9L 9PtwCsp2XLxNgsZuFQfPBrPSuEPclcEDQ9u/vtM3FjoR29fI1Vft7TuxLzOQOAY+N0UX FHzzSD9U/Disx3iiH/G4SQRVEGcOk+3L+jqst66M0mTlG9s2JQd3w5l+mL8Gjo+8blfI dE22Hd2eBhAu0snvHsEgZGWwLOuteaaOgas0VezRffYqFdqAvoI+kW14TZYnevYO3EO1 sDvASoUrUCQK6r2UtaaGrZQWmJcFbenrgq3HqROtUkkDV6WEWRcDtkc2OgP+CeeVfZ/8 r1Uw== ARC-Authentication-Results: i=1; mx.google.com; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=fail (p=NONE sp=NONE dis=NONE) header.from=intel.com Return-Path: Received: from vger.kernel.org (vger.kernel.org. [23.128.96.18]) by mx.google.com with ESMTP id hb12si18172757ejb.188.2021.10.13.02.11.52; Wed, 13 Oct 2021 02:12:17 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) client-ip=23.128.96.18; Authentication-Results: mx.google.com; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=fail (p=NONE sp=NONE dis=NONE) header.from=intel.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S239046AbhJMJJ2 (ORCPT + 99 others); Wed, 13 Oct 2021 05:09:28 -0400 Received: from mga07.intel.com ([134.134.136.100]:48244 "EHLO mga07.intel.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S239006AbhJMJJ0 (ORCPT ); Wed, 13 Oct 2021 05:09:26 -0400 X-IronPort-AV: E=McAfee;i="6200,9189,10135"; a="290877029" X-IronPort-AV: E=Sophos;i="5.85,370,1624345200"; d="scan'208";a="290877029" Received: from orsmga002.jf.intel.com ([10.7.209.21]) by orsmga105.jf.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 13 Oct 2021 02:07:22 -0700 X-ExtLoop1: 1 X-IronPort-AV: E=Sophos;i="5.85,370,1624345200"; d="scan'208";a="460706035" Received: from nntpat99-84.inn.intel.com ([10.125.99.84]) by orsmga002.jf.intel.com with ESMTP; 13 Oct 2021 02:07:18 -0700 From: Alexey Bayduraev To: Arnaldo Carvalho de Melo Cc: Jiri Olsa , Namhyung Kim , Alexander Shishkin , Peter Zijlstra , Ingo Molnar , linux-kernel , Andi Kleen , Adrian Hunter , Alexander Antonov , Alexei Budankov , Riccardo Mancini Subject: [PATCH v4 7/8] perf session: Introduce reader return codes Date: Wed, 13 Oct 2021 12:06:41 +0300 Message-Id: <5fca481e91c3c5d2ba033d4c6e9b969f8033ab0f.1634113027.git.alexey.v.bayduraev@linux.intel.com> X-Mailer: git-send-email 2.19.0 In-Reply-To: References: MIME-Version: 1.0 Content-Transfer-Encoding: 8bit Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Adding reader READER_OK and READER_NODATA return codes to make the code more clear. Suggested-by: Jiri Olsa Acked-by: Namhyung Kim Reviewed-by: Riccardo Mancini Tested-by: Riccardo Mancini Signed-off-by: Alexey Bayduraev --- tools/perf/util/session.c | 11 ++++++++--- 1 file changed, 8 insertions(+), 3 deletions(-) diff --git a/tools/perf/util/session.c b/tools/perf/util/session.c index 68d130fe51c2..9714881839e3 100644 --- a/tools/perf/util/session.c +++ b/tools/perf/util/session.c @@ -2258,12 +2258,17 @@ reader__mmap(struct reader *rd, struct perf_session *session) return 0; } +enum { + READER_OK, + READER_NODATA, +}; + static int reader__read_event(struct reader *rd, struct perf_session *session, struct ui_progress *prog) { u64 size; - int err = 0; + int err = READER_OK; union perf_event *event; s64 skip; @@ -2273,7 +2278,7 @@ reader__read_event(struct reader *rd, struct perf_session *session, return PTR_ERR(event); if (!event) - return 1; + return READER_NODATA; size = event->header.size; @@ -2325,7 +2330,7 @@ reader__process_events(struct reader *rd, struct perf_session *session, err = reader__read_event(rd, session, prog); if (err < 0) goto out; - else if (err == 1) + else if (err == READER_NODATA) goto remap; if (session_done()) -- 2.19.0