perf session: Introduce reader return codes
Add READER_OK and READER_NODATA return codes to make the code more clear. Suggested-by: Jiri Olsa <jolsa@kernel.org> Reviewed-by: Jiri Olsa <jolsa@redhat.com> Reviewed-by: Riccardo Mancini <rickyman7@gmail.com> Signed-off-by: Alexey Bayduraev <alexey.v.bayduraev@linux.intel.com> Tested-by: Riccardo Mancini <rickyman7@gmail.com> Acked-by: Namhyung 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.com Signed-off-by: Arnaldo Carvalho de Melo <acme@redhat.com>
This commit is contained in:
parent
5c10dc9244
commit
4c0028864c
|
@ -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 @@ more:
|
|||
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())
|
||||
|
|
Loading…
Reference in New Issue