diff options
Diffstat (limited to 'tools/perf/util/data.h')
-rw-r--r-- | tools/perf/util/data.h | 48 |
1 files changed, 48 insertions, 0 deletions
diff --git a/tools/perf/util/data.h b/tools/perf/util/data.h new file mode 100644 index 000000000000..8c2df80152a5 --- /dev/null +++ b/tools/perf/util/data.h | |||
@@ -0,0 +1,48 @@ | |||
1 | #ifndef __PERF_DATA_H | ||
2 | #define __PERF_DATA_H | ||
3 | |||
4 | #include <stdbool.h> | ||
5 | |||
6 | enum perf_data_mode { | ||
7 | PERF_DATA_MODE_WRITE, | ||
8 | PERF_DATA_MODE_READ, | ||
9 | }; | ||
10 | |||
11 | struct perf_data_file { | ||
12 | const char *path; | ||
13 | int fd; | ||
14 | bool is_pipe; | ||
15 | bool force; | ||
16 | unsigned long size; | ||
17 | enum perf_data_mode mode; | ||
18 | }; | ||
19 | |||
20 | static inline bool perf_data_file__is_read(struct perf_data_file *file) | ||
21 | { | ||
22 | return file->mode == PERF_DATA_MODE_READ; | ||
23 | } | ||
24 | |||
25 | static inline bool perf_data_file__is_write(struct perf_data_file *file) | ||
26 | { | ||
27 | return file->mode == PERF_DATA_MODE_WRITE; | ||
28 | } | ||
29 | |||
30 | static inline int perf_data_file__is_pipe(struct perf_data_file *file) | ||
31 | { | ||
32 | return file->is_pipe; | ||
33 | } | ||
34 | |||
35 | static inline int perf_data_file__fd(struct perf_data_file *file) | ||
36 | { | ||
37 | return file->fd; | ||
38 | } | ||
39 | |||
40 | static inline unsigned long perf_data_file__size(struct perf_data_file *file) | ||
41 | { | ||
42 | return file->size; | ||
43 | } | ||
44 | |||
45 | int perf_data_file__open(struct perf_data_file *file); | ||
46 | void perf_data_file__close(struct perf_data_file *file); | ||
47 | |||
48 | #endif /* __PERF_DATA_H */ | ||