Commit 8d541e97 authored by Jiri Olsa's avatar Jiri Olsa Committed by Arnaldo Carvalho de Melo

perf header: Introduce feat_offset into perf_header

Introducing feat_offset into perf_header to make the location of the
features section clear.
Signed-off-by: default avatarJiri Olsa <jolsa@redhat.com>
Cc: Andi Kleen <ak@linux.intel.com>
Cc: Corey Ashford <cjashfor@linux.vnet.ibm.com>
Cc: David Ahern <dsahern@gmail.com>
Cc: Frederic Weisbecker <fweisbec@gmail.com>
Cc: Ingo Molnar <mingo@elte.hu>
Cc: Namhyung Kim <namhyung@kernel.org>
Cc: Paul Mackerras <paulus@samba.org>
Cc: Peter Zijlstra <a.p.zijlstra@chello.nl>
Link: http://lkml.kernel.org/r/1374083403-14591-5-git-send-email-jolsa@redhat.comSigned-off-by: default avatarArnaldo Carvalho de Melo <acme@redhat.com>
parent 944d62ba
...@@ -2225,7 +2225,7 @@ static int perf_header__adds_write(struct perf_header *header, ...@@ -2225,7 +2225,7 @@ static int perf_header__adds_write(struct perf_header *header,
sec_size = sizeof(*feat_sec) * nr_sections; sec_size = sizeof(*feat_sec) * nr_sections;
sec_start = header->data_offset + header->data_size; sec_start = header->feat_offset;
lseek(fd, sec_start + sec_size, SEEK_SET); lseek(fd, sec_start + sec_size, SEEK_SET);
for_each_set_bit(feat, header->adds_features, HEADER_FEAT_BITS) { for_each_set_bit(feat, header->adds_features, HEADER_FEAT_BITS) {
...@@ -2304,6 +2304,7 @@ int perf_session__write_header(struct perf_session *session, ...@@ -2304,6 +2304,7 @@ int perf_session__write_header(struct perf_session *session,
} }
header->data_offset = lseek(fd, 0, SEEK_CUR); header->data_offset = lseek(fd, 0, SEEK_CUR);
header->feat_offset = header->data_offset + header->data_size;
if (at_exit) { if (at_exit) {
err = perf_header__adds_write(header, evlist, fd); err = perf_header__adds_write(header, evlist, fd);
...@@ -2373,7 +2374,7 @@ int perf_header__process_sections(struct perf_header *header, int fd, ...@@ -2373,7 +2374,7 @@ int perf_header__process_sections(struct perf_header *header, int fd,
sec_size = sizeof(*feat_sec) * nr_sections; sec_size = sizeof(*feat_sec) * nr_sections;
lseek(fd, header->data_offset + header->data_size, SEEK_SET); lseek(fd, header->feat_offset, SEEK_SET);
err = perf_header__getbuffer64(header, fd, feat_sec, sec_size); err = perf_header__getbuffer64(header, fd, feat_sec, sec_size);
if (err < 0) if (err < 0)
...@@ -2572,6 +2573,7 @@ int perf_file_header__read(struct perf_file_header *header, ...@@ -2572,6 +2573,7 @@ int perf_file_header__read(struct perf_file_header *header,
ph->data_offset = header->data.offset; ph->data_offset = header->data.offset;
ph->data_size = header->data.size; ph->data_size = header->data.size;
ph->feat_offset = header->data.offset + header->data.size;
return 0; return 0;
} }
......
...@@ -88,6 +88,7 @@ struct perf_header { ...@@ -88,6 +88,7 @@ struct perf_header {
bool needs_swap; bool needs_swap;
u64 data_offset; u64 data_offset;
u64 data_size; u64 data_size;
u64 feat_offset;
DECLARE_BITMAP(adds_features, HEADER_FEAT_BITS); DECLARE_BITMAP(adds_features, HEADER_FEAT_BITS);
struct perf_session_env env; struct perf_session_env env;
}; };
......
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