]> git.proxmox.com Git - mirror_ubuntu-bionic-kernel.git/commitdiff
perf tools: Add perf_data_file__write function
authorJiri Olsa <jolsa@kernel.org>
Mon, 23 Jan 2017 21:42:56 +0000 (22:42 +0100)
committerArnaldo Carvalho de Melo <acme@redhat.com>
Mon, 30 Oct 2017 16:38:50 +0000 (13:38 -0300)
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>
tools/perf/util/data.c
tools/perf/util/data.h

index 07ef56a4123c8caaadab24a6685fc9e706ed2be6..f80a23d031d649ac1386450e1f3d1401a309b8d4 100644 (file)
@@ -144,10 +144,16 @@ void perf_data__close(struct perf_data *data)
        close(data->file.fd);
 }
 
+ssize_t perf_data_file__write(struct perf_data_file *file,
+                             void *buf, size_t size)
+{
+       return writen(file->fd, buf, size);
+}
+
 ssize_t perf_data__write(struct perf_data *data,
                              void *buf, size_t size)
 {
-       return writen(data->file.fd, buf, size);
+       return perf_data_file__write(&data->file, buf, size);
 }
 
 int perf_data__switch(struct perf_data *data,
index 1797bed3aa4b302e1af1a0a4d2c17c196b313a59..000c43bbb7acc4c06bc5c7c1daafd040a27734d0 100644 (file)
@@ -50,6 +50,8 @@ int perf_data__open(struct perf_data *data);
 void perf_data__close(struct perf_data *data);
 ssize_t perf_data__write(struct perf_data *data,
                              void *buf, size_t size);
+ssize_t perf_data_file__write(struct perf_data_file *file,
+                             void *buf, size_t size);
 /*
  * If at_exit is set, only rename current perf.data to
  * perf.data.<postfix>, continue write on original data.