Commit 4c002886 authored by Alexey Bayduraev's avatar Alexey Bayduraev Committed by Arnaldo Carvalho de Melo

perf session: Introduce reader return codes

Add READER_OK and READER_NODATA return codes to make the code more
clear.
Suggested-by: default avatarJiri Olsa <jolsa@kernel.org>
Reviewed-by: default avatarJiri Olsa <jolsa@redhat.com>
Reviewed-by: default avatarRiccardo Mancini <rickyman7@gmail.com>
Signed-off-by: default avatarAlexey Bayduraev <alexey.v.bayduraev@linux.intel.com>
Tested-by: default avatarRiccardo Mancini <rickyman7@gmail.com>
Acked-by: default avatarNamhyung Kim <namhyung@gmail.com>
Cc: Adrian Hunter <adrian.hunter@intel.com>
Cc: Alexander Antonov <alexander.antonov@linux.intel.com>
Cc: Alexander Shishkin <alexander.shishkin@linux.intel.com>
Cc: Alexei Budankov <abudankov@huawei.com>
Cc: Andi Kleen <ak@linux.intel.com>
Cc: Ingo Molnar <mingo@redhat.com>
Cc: Namhyung Kim <namhyung@kernel.org>
Cc: Peter Zijlstra <peterz@infradead.org>
Link: https://lore.kernel.org/r/5fca481e91c3c5d2ba033d4c6e9b969f8033ab0f.1634113027.git.alexey.v.bayduraev@linux.intel.comSigned-off-by: default avatarArnaldo Carvalho de Melo <acme@redhat.com>
parent 5c10dc92
......@@ -2263,12 +2263,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;
......@@ -2278,7 +2283,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;
......@@ -2330,7 +2335,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())
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment