mmc: bcm2835: Fix DMA channel leak on probe error
[linux/fpc-iii.git] / tools / perf / util / data.h
blob4828f7feea8949eb0e9a7d0464fad3997519c170
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 const char *path;
14 int fd;
17 struct perf_data {
18 struct perf_data_file file;
19 bool is_pipe;
20 bool force;
21 unsigned long size;
22 enum perf_data_mode mode;
25 static inline bool perf_data__is_read(struct perf_data *data)
27 return data->mode == PERF_DATA_MODE_READ;
30 static inline bool perf_data__is_write(struct perf_data *data)
32 return data->mode == PERF_DATA_MODE_WRITE;
35 static inline int perf_data__is_pipe(struct perf_data *data)
37 return data->is_pipe;
40 static inline int perf_data__fd(struct perf_data *data)
42 return data->file.fd;
45 static inline unsigned long perf_data__size(struct perf_data *data)
47 return data->size;
50 int perf_data__open(struct perf_data *data);
51 void perf_data__close(struct perf_data *data);
52 ssize_t perf_data__write(struct perf_data *data,
53 void *buf, size_t size);
54 ssize_t perf_data_file__write(struct perf_data_file *file,
55 void *buf, size_t size);
57 * If at_exit is set, only rename current perf.data to
58 * perf.data.<postfix>, continue write on original data.
59 * Set at_exit when flushing the last output.
61 * Return value is fd of new output.
63 int perf_data__switch(struct perf_data *data,
64 const char *postfix,
65 size_t pos, bool at_exit);
66 #endif /* __PERF_DATA_H */