regulator: s2mps11: Adjust supported buck voltages to real values
[linux/fpc-iii.git] / tools / perf / util / data.h
blob14b47be2bd69b6d5578e74334fb5577594469efd
1 /* SPDX-License-Identifier: GPL-2.0 */
2 #ifndef __PERF_DATA_H
3 #define __PERF_DATA_H
5 #include <stdbool.h>
7 enum perf_data_mode {
8 PERF_DATA_MODE_WRITE,
9 PERF_DATA_MODE_READ,
12 struct perf_data_file {
13 char *path;
14 int fd;
15 unsigned long size;
18 struct perf_data {
19 const char *path;
20 struct perf_data_file file;
21 bool is_pipe;
22 bool force;
23 enum perf_data_mode mode;
25 struct {
26 struct perf_data_file *files;
27 int nr;
28 } dir;
31 static inline bool perf_data__is_read(struct perf_data *data)
33 return data->mode == PERF_DATA_MODE_READ;
36 static inline bool perf_data__is_write(struct perf_data *data)
38 return data->mode == PERF_DATA_MODE_WRITE;
41 static inline int perf_data__is_pipe(struct perf_data *data)
43 return data->is_pipe;
46 static inline int perf_data__fd(struct perf_data *data)
48 return data->file.fd;
51 static inline unsigned long perf_data__size(struct perf_data *data)
53 return data->file.size;
56 int perf_data__open(struct perf_data *data);
57 void perf_data__close(struct perf_data *data);
58 ssize_t perf_data__write(struct perf_data *data,
59 void *buf, size_t size);
60 ssize_t perf_data_file__write(struct perf_data_file *file,
61 void *buf, size_t size);
63 * If at_exit is set, only rename current perf.data to
64 * perf.data.<postfix>, continue write on original data.
65 * Set at_exit when flushing the last output.
67 * Return value is fd of new output.
69 int perf_data__switch(struct perf_data *data,
70 const char *postfix,
71 size_t pos, bool at_exit);
73 int perf_data__create_dir(struct perf_data *data, int nr);
74 int perf_data__open_dir(struct perf_data *data);
75 void perf_data__close_dir(struct perf_data *data);
76 #endif /* __PERF_DATA_H */