perf env: Conditionally compile BPF support code on having HAVE_LIBBPF_SUPPORT
If libbpf isn't selected, no need for a bunch of related code, that were not even being used, as code using these perf_env methods was also enclosed in HAVE_LIBBPF_SUPPORT. Cc: Adrian Hunter <adrian.hunter@intel.com> Cc: Ian Rogers <irogers@google.com> Cc: Jiri Olsa <jolsa@kernel.org> Cc: Namhyung Kim <namhyung@kernel.org> Signed-off-by: Arnaldo Carvalho de Melo <acme@redhat.com>
This commit is contained in:
@@ -11,8 +11,10 @@
|
||||
#include <errno.h>
|
||||
#include <fcntl.h>
|
||||
#include <stdlib.h>
|
||||
#ifdef HAVE_LIBBPF_SUPPORT
|
||||
#include <bpf/libbpf.h>
|
||||
#include "bpf-event.h"
|
||||
#endif
|
||||
#include "compress.h"
|
||||
#include "env.h"
|
||||
#include "namespaces.h"
|
||||
@@ -728,6 +730,7 @@ bool dso__data_status_seen(struct dso *dso, enum dso_data_status_seen by)
|
||||
return false;
|
||||
}
|
||||
|
||||
#ifdef HAVE_LIBBPF_SUPPORT
|
||||
static ssize_t bpf_read(struct dso *dso, u64 offset, char *data)
|
||||
{
|
||||
struct bpf_prog_info_node *node;
|
||||
@@ -765,6 +768,7 @@ static int bpf_size(struct dso *dso)
|
||||
dso->data.file_size = node->info_linear->info.jited_prog_len;
|
||||
return 0;
|
||||
}
|
||||
#endif // HAVE_LIBBPF_SUPPORT
|
||||
|
||||
static void
|
||||
dso_cache__free(struct dso *dso)
|
||||
@@ -894,10 +898,12 @@ static struct dso_cache *dso_cache__populate(struct dso *dso,
|
||||
*ret = -ENOMEM;
|
||||
return NULL;
|
||||
}
|
||||
|
||||
#ifdef HAVE_LIBBPF_SUPPORT
|
||||
if (dso->binary_type == DSO_BINARY_TYPE__BPF_PROG_INFO)
|
||||
*ret = bpf_read(dso, cache_offset, cache->data);
|
||||
else if (dso->binary_type == DSO_BINARY_TYPE__OOL)
|
||||
else
|
||||
#endif
|
||||
if (dso->binary_type == DSO_BINARY_TYPE__OOL)
|
||||
*ret = DSO__DATA_CACHE_SIZE;
|
||||
else
|
||||
*ret = file_read(dso, machine, cache_offset, cache->data);
|
||||
@@ -1018,10 +1024,10 @@ int dso__data_file_size(struct dso *dso, struct machine *machine)
|
||||
|
||||
if (dso->data.status == DSO_DATA_STATUS_ERROR)
|
||||
return -1;
|
||||
|
||||
#ifdef HAVE_LIBBPF_SUPPORT
|
||||
if (dso->binary_type == DSO_BINARY_TYPE__BPF_PROG_INFO)
|
||||
return bpf_size(dso);
|
||||
|
||||
#endif
|
||||
return file_size(dso, machine);
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user