Received: by 2002:a05:6a10:d5a5:0:0:0:0 with SMTP id gn37csp1334632pxb; Thu, 7 Oct 2021 05:52:13 -0700 (PDT) X-Google-Smtp-Source: ABdhPJxxRy+KCRcmhTUwDQlvuytww/FUqn4W6DSn8B5fA3sw4jy7NDopeBIbY3mMmk2rIehDr09Y X-Received: by 2002:a05:6402:354d:: with SMTP id f13mr5944454edd.252.1633611133423; Thu, 07 Oct 2021 05:52:13 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1633611133; cv=none; d=google.com; s=arc-20160816; b=wUhtUh+gl5e6PjeTqhxcl12kMEL5/B4aqkdQaNRidyhtEFm9zSJCQY9mmCDstWQIJE nijAcmZzKHH+8KsZlLdI05ng6YS7M03C80715Blz17eLKZe7iw0tpRj/hs6fQ/b+9mJu NpIjRLrURbOPwYA/PIPOyEnVYRVch0nvPaW69jOGKBwEo6pbRCHbL4SnUiTyigOloq3e mVU5hMGPZcE1CC1xwZsnhb9yHXM6XdVL3yEYHFWXK08oQuPohQGwbjrjXYA1WbEAtBbI 58UwpVRsyY/8Fx2CwmOvl12E6ACVOPvvPjf9KfTi5OxIfGWz2BNqre7SKYxeXDXiluER z4Iw== 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=3tAR9+aZ404VcpAcgiYRKICbIFeRkaug72slkwAgy+c=; b=flpFg82r7g/BwMoONosbNAbMflr/98oUdzsDyrsD+Lki4xjA1JVGbYx2BcQv9gwOOk LsQl5NnONos5/3FbdCBl0BGIXmDHurRKYJ4pF8I8K1Y2KPBKoUEuUJJPUPjSVwbdS9QN xM4br37tSTgt6PGuzuTlUrXEC/DhG0yGFuHFEprI3JT/msCA1CspOqXHH0NIrtOAEMSu LmeEB18cXiQgXGAmGC2Ws0aSHFh9rfYkd/LXk1Z3f/uiaqF3939I8RCxWIY1TraRoBtE 5MyeX+B++lxNQHwUERI/V0HR7Wt+bucKivrRRzXUBc2Xq8PsBzyA/wh7RLqBfK0qaYAx GKsg== 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 x16si17372764edd.401.2021.10.07.05.51.48; Thu, 07 Oct 2021 05:52:13 -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 S240940AbhJGK2M (ORCPT + 99 others); Thu, 7 Oct 2021 06:28:12 -0400 Received: from mga01.intel.com ([192.55.52.88]:3747 "EHLO mga01.intel.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S240904AbhJGK2D (ORCPT ); Thu, 7 Oct 2021 06:28:03 -0400 X-IronPort-AV: E=McAfee;i="6200,9189,10129"; a="249532677" X-IronPort-AV: E=Sophos;i="5.85,354,1624345200"; d="scan'208";a="249532677" Received: from orsmga005.jf.intel.com ([10.7.209.41]) by fmsmga101.fm.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 07 Oct 2021 03:26:10 -0700 X-ExtLoop1: 1 X-IronPort-AV: E=Sophos;i="5.85,354,1624345200"; d="scan'208";a="657335536" Received: from nntpat99-84.inn.intel.com ([10.125.99.84]) by orsmga005.jf.intel.com with ESMTP; 07 Oct 2021 03:26:07 -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 v3 7/8] perf session: Introduce reader return codes Date: Thu, 7 Oct 2021 13:25:42 +0300 Message-Id: <73fff3497e39c90ae9c517d00782d99c842748db.1633596227.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 6b255b0b23e0..7d88c651ffd7 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; session->active_decomp = &rd->decomp_data; 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