1 /* SPDX-License-Identifier: GPL-2.0 */
12 enum perf_dir_version {
13 PERF_DIR_SINGLE_FILE = 0,
17 struct perf_data_file {
25 struct perf_data_file file;
29 enum perf_data_mode mode;
33 struct perf_data_file *files;
38 static inline bool perf_data__is_read(struct perf_data *data)
40 return data->mode == PERF_DATA_MODE_READ;
43 static inline bool perf_data__is_write(struct perf_data *data)
45 return data->mode == PERF_DATA_MODE_WRITE;
48 static inline int perf_data__is_pipe(struct perf_data *data)
53 static inline bool perf_data__is_dir(struct perf_data *data)
58 static inline bool perf_data__is_single_file(struct perf_data *data)
60 return data->dir.version == PERF_DIR_SINGLE_FILE;
63 static inline int perf_data__fd(struct perf_data *data)
68 int perf_data__open(struct perf_data *data);
69 void perf_data__close(struct perf_data *data);
70 ssize_t perf_data__write(struct perf_data *data,
71 void *buf, size_t size);
72 ssize_t perf_data_file__write(struct perf_data_file *file,
73 void *buf, size_t size);
75 * If at_exit is set, only rename current perf.data to
76 * perf.data.<postfix>, continue write on original data.
77 * Set at_exit when flushing the last output.
79 * Return value is fd of new output.
81 int perf_data__switch(struct perf_data *data,
83 size_t pos, bool at_exit, char **new_filepath);
85 int perf_data__create_dir(struct perf_data *data, int nr);
86 int perf_data__open_dir(struct perf_data *data);
87 void perf_data__close_dir(struct perf_data *data);
88 int perf_data__update_dir(struct perf_data *data);
89 unsigned long perf_data__size(struct perf_data *data);
90 int perf_data__make_kcore_dir(struct perf_data *data, char *buf, size_t buf_sz);
91 char *perf_data__kallsyms_name(struct perf_data *data);
92 #endif /* __PERF_DATA_H */