Re: [PATCH 09/18] perf: Drop redundant FD macro definitions

From: Arnaldo Carvalho de Melo
Date: Mon Jul 25 2011 - 11:05:15 EST


Em Sat, Apr 23, 2011 at 06:28:11PM +0200, Borislav Petkov escreveu:
> From: Borislav Petkov <borislav.petkov@xxxxxxx>
>
> Put a single define in the util/util.h header which should be generic
> enough and included by all builtin commands.

I'll apply this one, but will move those definitions to evsel.h, as they
operate on an evlist instance (e->fd).

- Arnaldo

> Signed-off-by: Borislav Petkov <borislav.petkov@xxxxxxx>
> ---
> tools/perf/builtin-record.c | 2 --
> tools/perf/builtin-top.c | 2 --
> tools/perf/util/evlist.c | 3 ---
> tools/perf/util/evsel.c | 2 --
> tools/perf/util/util.h | 3 +++
> 5 files changed, 3 insertions(+), 9 deletions(-)
>
> diff --git a/tools/perf/builtin-record.c b/tools/perf/builtin-record.c
> index 4165382..4497a38 100644
> --- a/tools/perf/builtin-record.c
> +++ b/tools/perf/builtin-record.c
> @@ -30,8 +30,6 @@
> #include <sched.h>
> #include <sys/mman.h>
>
> -#define FD(e, x, y) (*(int *)xyarray__entry(e->fd, x, y))
> -
> enum write_mode_t {
> WRITE_FORCE,
> WRITE_APPEND
> diff --git a/tools/perf/builtin-top.c b/tools/perf/builtin-top.c
> index 7e3d6e3..7fd50c1 100644
> --- a/tools/perf/builtin-top.c
> +++ b/tools/perf/builtin-top.c
> @@ -62,8 +62,6 @@
> #include <linux/unistd.h>
> #include <linux/types.h>
>
> -#define FD(e, x, y) (*(int *)xyarray__entry(e->fd, x, y))
> -
> static struct perf_top top = {
> .count_filter = 5,
> .delay_secs = 2,
> diff --git a/tools/perf/util/evlist.c b/tools/perf/util/evlist.c
> index 45da8d1..65a8031 100644
> --- a/tools/perf/util/evlist.c
> +++ b/tools/perf/util/evlist.c
> @@ -19,9 +19,6 @@
> #include <linux/bitops.h>
> #include <linux/hash.h>
>
> -#define FD(e, x, y) (*(int *)xyarray__entry(e->fd, x, y))
> -#define SID(e, x, y) xyarray__entry(e->sample_id, x, y)
> -
> void perf_evlist__init(struct perf_evlist *evlist, struct cpu_map *cpus,
> struct thread_map *threads)
> {
> diff --git a/tools/perf/util/evsel.c b/tools/perf/util/evsel.c
> index d6fd59b..13ee267 100644
> --- a/tools/perf/util/evsel.c
> +++ b/tools/perf/util/evsel.c
> @@ -13,8 +13,6 @@
> #include "cpumap.h"
> #include "thread_map.h"
>
> -#define FD(e, x, y) (*(int *)xyarray__entry(e->fd, x, y))
> -
> void perf_evsel__init(struct perf_evsel *evsel,
> struct perf_event_attr *attr, int idx)
> {
> diff --git a/tools/perf/util/util.h b/tools/perf/util/util.h
> index fc78428..c32d66d 100644
> --- a/tools/perf/util/util.h
> +++ b/tools/perf/util/util.h
> @@ -39,6 +39,9 @@
> /* Approximation of the length of the decimal representation of this type. */
> #define decimal_length(x) ((int)(sizeof(x) * 2.56 + 0.5) + 1)
>
> +#define FD(e, x, y) (*(int *)xyarray__entry(e->fd, x, y))
> +#define SID(e, x, y) xyarray__entry(e->sample_id, x, y)
> +
> #define _ALL_SOURCE 1
> #define _GNU_SOURCE 1
> #define _BSD_SOURCE 1
> --
> 1.7.4.rc2
--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.tux.org/lkml/