Linux kernel mirror (for testing) git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
kernel os linux

perf tools: Add perf_data_file__write function

Adding perf_data_file__write function to provide single file write
operation.

Signed-off-by: Jiri Olsa <jolsa@kernel.org>
Cc: Andi Kleen <andi@firstfloor.org>
Cc: Changbin Du <changbin.du@intel.com>
Cc: David Ahern <dsahern@gmail.com>
Cc: Jin Yao <yao.jin@linux.intel.com>
Cc: Namhyung Kim <namhyung@kernel.org>
Cc: Peter Zijlstra <peterz@infradead.org>
Cc: Wang Nan <wangnan0@huawei.com>
Link: http://lkml.kernel.org/n/tip-c3f9p4xzykr845ktqcek6p4t@git.kernel.org
Signed-off-by: Arnaldo Carvalho de Melo <acme@redhat.com>

authored by

Jiri Olsa and committed by
Arnaldo Carvalho de Melo
e268687b eae8ad80

+9 -1
+7 -1
tools/perf/util/data.c
··· 144 144 close(data->file.fd); 145 145 } 146 146 147 + ssize_t perf_data_file__write(struct perf_data_file *file, 148 + void *buf, size_t size) 149 + { 150 + return writen(file->fd, buf, size); 151 + } 152 + 147 153 ssize_t perf_data__write(struct perf_data *data, 148 154 void *buf, size_t size) 149 155 { 150 - return writen(data->file.fd, buf, size); 156 + return perf_data_file__write(&data->file, buf, size); 151 157 } 152 158 153 159 int perf_data__switch(struct perf_data *data,
+2
tools/perf/util/data.h
··· 50 50 void perf_data__close(struct perf_data *data); 51 51 ssize_t perf_data__write(struct perf_data *data, 52 52 void *buf, size_t size); 53 + ssize_t perf_data_file__write(struct perf_data_file *file, 54 + void *buf, size_t size); 53 55 /* 54 56 * If at_exit is set, only rename current perf.data to 55 57 * perf.data.<postfix>, continue write on original data.