1 /* SPDX-License-Identifier: GPL-2.0 */
6 #include <linux/types.h>
13 enum perf_dir_version {
14 PERF_DIR_SINGLE_FILE = 0,
18 struct perf_data_file {
26 struct perf_data_file file;
30 enum perf_data_mode mode;
34 struct perf_data_file *files;
39 static inline bool perf_data__is_read(struct perf_data *data)
41 return data->mode == PERF_DATA_MODE_READ;
44 static inline bool perf_data__is_write(struct perf_data *data)
46 return data->mode == PERF_DATA_MODE_WRITE;
49 static inline int perf_data__is_pipe(struct perf_data *data)
54 static inline bool perf_data__is_dir(struct perf_data *data)
59 static inline bool perf_data__is_single_file(struct perf_data *data)
61 return data->dir.version == PERF_DIR_SINGLE_FILE;
64 static inline int perf_data__fd(struct perf_data *data)
69 int perf_data__open(struct perf_data *data);
70 void perf_data__close(struct perf_data *data);
71 ssize_t perf_data__write(struct perf_data *data,
72 void *buf, size_t size);
73 ssize_t perf_data_file__write(struct perf_data_file *file,
74 void *buf, size_t size);
76 * If at_exit is set, only rename current perf.data to
77 * perf.data.<postfix>, continue write on original data.
78 * Set at_exit when flushing the last output.
80 * Return value is fd of new output.
82 int perf_data__switch(struct perf_data *data,
84 size_t pos, bool at_exit, char **new_filepath);
86 int perf_data__create_dir(struct perf_data *data, int nr);
87 int perf_data__open_dir(struct perf_data *data);
88 void perf_data__close_dir(struct perf_data *data);
89 int perf_data__update_dir(struct perf_data *data);
90 unsigned long perf_data__size(struct perf_data *data);
91 int perf_data__make_kcore_dir(struct perf_data *data, char *buf, size_t buf_sz);
92 char *perf_data__kallsyms_name(struct perf_data *data);
93 #endif /* __PERF_DATA_H */