perf session: Use session->fd instead of passing fd as argument
authorJiri Olsa <jolsa@redhat.com>
Wed, 17 Jul 2013 17:49:41 +0000 (19:49 +0200)
committerArnaldo Carvalho de Melo <acme@redhat.com>
Wed, 17 Jul 2013 19:46:07 +0000 (16:46 -0300)
Using session->fd instead of passing fd as argument because it's always
session->fd that's passed as fd argument.

Signed-off-by: Jiri Olsa <jolsa@redhat.com>
Cc: Andi Kleen <ak@linux.intel.com>
Cc: Corey Ashford <cjashfor@linux.vnet.ibm.com>
Cc: David Ahern <dsahern@gmail.com>
Cc: Frederic Weisbecker <fweisbec@gmail.com>
Cc: Ingo Molnar <mingo@elte.hu>
Cc: Namhyung Kim <namhyung@kernel.org>
Cc: Paul Mackerras <paulus@samba.org>
Cc: Peter Zijlstra <a.p.zijlstra@chello.nl>
Link: http://lkml.kernel.org/r/1374083403-14591-2-git-send-email-jolsa@redhat.com
Signed-off-by: Arnaldo Carvalho de Melo <acme@redhat.com>
tools/perf/util/header.c
tools/perf/util/header.h
tools/perf/util/session.c

index b28a65ecd61b766e555bd254cffa2f26c6c97987..b3f253f2841eade726eb7432c208802581fc0127 100644 (file)
@@ -2619,19 +2619,17 @@ static int perf_file_header__read_pipe(struct perf_pipe_file_header *header,
        return 0;
 }
 
-static int perf_header__read_pipe(struct perf_session *session, int fd)
+static int perf_header__read_pipe(struct perf_session *session)
 {
        struct perf_header *header = &session->header;
        struct perf_pipe_file_header f_header;
 
-       if (perf_file_header__read_pipe(&f_header, header, fd,
+       if (perf_file_header__read_pipe(&f_header, header, session->fd,
                                        session->repipe) < 0) {
                pr_debug("incompatible file format\n");
                return -EINVAL;
        }
 
-       session->fd = fd;
-
        return 0;
 }
 
@@ -2725,20 +2723,21 @@ static int perf_evlist__prepare_tracepoint_events(struct perf_evlist *evlist,
        return 0;
 }
 
-int perf_session__read_header(struct perf_session *session, int fd)
+int perf_session__read_header(struct perf_session *session)
 {
        struct perf_header *header = &session->header;
        struct perf_file_header f_header;
        struct perf_file_attr   f_attr;
        u64                     f_id;
        int nr_attrs, nr_ids, i, j;
+       int fd = session->fd;
 
        session->evlist = perf_evlist__new();
        if (session->evlist == NULL)
                return -ENOMEM;
 
        if (session->fd_pipe)
-               return perf_header__read_pipe(session, fd);
+               return perf_header__read_pipe(session);
 
        if (perf_file_header__read(&f_header, header, fd) < 0)
                return -EINVAL;
index 669fda531da655523eb76dfb2ba52a7f3bd855c4..0bacb2d6eafa7d13d38c75374b9a82c8c93e7131 100644 (file)
@@ -96,7 +96,7 @@ struct perf_header {
 struct perf_evlist;
 struct perf_session;
 
-int perf_session__read_header(struct perf_session *session, int fd);
+int perf_session__read_header(struct perf_session *session);
 int perf_session__write_header(struct perf_session *session,
                               struct perf_evlist *evlist,
                               int fd, bool at_exit);
index d0d9f946a1b1c3113237fd6e54d6de9e003ae20d..272c9cf571229b45e09fa6af26d9471a6e61ac00 100644 (file)
@@ -24,7 +24,7 @@ static int perf_session__open(struct perf_session *self, bool force)
                self->fd_pipe = true;
                self->fd = STDIN_FILENO;
 
-               if (perf_session__read_header(self, self->fd) < 0)
+               if (perf_session__read_header(self) < 0)
                        pr_err("incompatible file format (rerun with -v to learn more)");
 
                return 0;
@@ -56,7 +56,7 @@ static int perf_session__open(struct perf_session *self, bool force)
                goto out_close;
        }
 
-       if (perf_session__read_header(self, self->fd) < 0) {
+       if (perf_session__read_header(self) < 0) {
                pr_err("incompatible file format (rerun with -v to learn more)");
                goto out_close;
        }