All of lore.kernel.org
 help / color / mirror / Atom feed
From: Jiri Olsa <jolsa@kernel.org>
To: Arnaldo Carvalho de Melo <acme@kernel.org>
Cc: lkml <linux-kernel@vger.kernel.org>,
	Ingo Molnar <mingo@kernel.org>,
	Namhyung Kim <namhyung@kernel.org>,
	David Ahern <dsahern@gmail.com>,
	Peter Zijlstra <a.p.zijlstra@chello.nl>,
	Andi Kleen <andi@firstfloor.org>,
	"Jin, Yao" <yao.jin@linux.intel.com>,
	"Wangnan (F)" <wangnan0@huawei.com>,
	"Du, Changbin" <changbin.du@intel.com>
Subject: [PATCH 5/9] perf tools: Add perf_data_file__write function
Date: Fri, 13 Oct 2017 10:37:32 +0200	[thread overview]
Message-ID: <20171013083736.15037-6-jolsa@kernel.org> (raw)
In-Reply-To: <20171013083736.15037-1-jolsa@kernel.org>

Adding perf_data_file__write function to provide
single file write operation.

Link: http://lkml.kernel.org/n/tip-c3f9p4xzykr845ktqcek6p4t@git.kernel.org
Signed-off-by: Jiri Olsa <jolsa@kernel.org>
---
 tools/perf/util/data.c | 8 +++++++-
 tools/perf/util/data.h | 2 ++
 2 files changed, 9 insertions(+), 1 deletion(-)

diff --git a/tools/perf/util/data.c b/tools/perf/util/data.c
index 07ef56a4123c..f80a23d031d6 100644
--- a/tools/perf/util/data.c
+++ b/tools/perf/util/data.c
@@ -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,
diff --git a/tools/perf/util/data.h b/tools/perf/util/data.h
index 1797bed3aa4b..000c43bbb7ac 100644
--- a/tools/perf/util/data.h
+++ b/tools/perf/util/data.h
@@ -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.
-- 
2.13.6

  parent reply	other threads:[~2017-10-13  8:39 UTC|newest]

Thread overview: 16+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2017-10-13  8:37 [PATCH 0/9] perf tools: Assorted fixes Jiri Olsa
2017-10-13  8:37 ` [PATCH 1/9] perf tools: Fix crash in perf_hpp__reset_output_field Jiri Olsa
2017-10-20  7:18   ` [tip:perf/urgent] perf hists: Fix crash in perf_hpp__reset_output_field() tip-bot for Jiri Olsa
2017-10-13  8:37 ` [PATCH 2/9] perf tools: Add extra integrity checks to fmt_free Jiri Olsa
2017-10-20  7:19   ` [tip:perf/urgent] perf hists: Add extra integrity checks to fmt_free() tip-bot for Jiri Olsa
2017-10-13  8:37 ` [PATCH 3/9] perf tools: Rename struct perf_data_file to perf_data Jiri Olsa
2017-10-13  8:37 ` [PATCH 4/9] perf tools: Add struct perf_data_file Jiri Olsa
2017-10-13  8:37 ` Jiri Olsa [this message]
2017-10-13  8:37 ` [PATCH 6/9] perf stat: Move the shadow stats scale computation in perf_stat__update_shadow_stats Jiri Olsa
2017-10-13  8:37 ` [PATCH 7/9] perf stat: Make --per-thread update shadow stats to show metrics Jiri Olsa
2017-10-13  8:37 ` [PATCH 8/9] perf tools: Check wether the eBPF file exists in event parsing Jiri Olsa
2017-10-20  7:19   ` [tip:perf/urgent] " tip-bot for Jiri Olsa
2017-10-13  8:37 ` [PATCH 9/9] perf tools: Unwind properly location after REJECT Jiri Olsa
2017-10-13 19:50   ` Arnaldo Carvalho de Melo
2017-10-24 12:51     ` [PATCHv2 " Jiri Olsa
2017-10-25 14:07       ` Jiri Olsa

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20171013083736.15037-6-jolsa@kernel.org \
    --to=jolsa@kernel.org \
    --cc=a.p.zijlstra@chello.nl \
    --cc=acme@kernel.org \
    --cc=andi@firstfloor.org \
    --cc=changbin.du@intel.com \
    --cc=dsahern@gmail.com \
    --cc=linux-kernel@vger.kernel.org \
    --cc=mingo@kernel.org \
    --cc=namhyung@kernel.org \
    --cc=wangnan0@huawei.com \
    --cc=yao.jin@linux.intel.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.