tools lib bpf: Rename bpf_map__get_fd() to bpf_map__fd()
authorArnaldo Carvalho de Melo <acme@redhat.com>
Fri, 3 Jun 2016 15:15:52 +0000 (12:15 -0300)
committerArnaldo Carvalho de Melo <acme@redhat.com>
Mon, 6 Jun 2016 21:19:15 +0000 (18:19 -0300)
For consistency, leaving "get" for reference counting.

Acked-by: Wang Nan <wangnan0@huawei.com>
Cc: Adrian Hunter <adrian.hunter@intel.com>
Cc: David Ahern <dsahern@gmail.com>
Cc: Jiri Olsa <jolsa@kernel.org>
Cc: Milian Wolff <milian.wolff@kdab.com>
Cc: Namhyung Kim <namhyung@kernel.org>
Link: http://lkml.kernel.org/n/tip-msy8sxfz9th6gl2xjeci2btm@git.kernel.org
Signed-off-by: Arnaldo Carvalho de Melo <acme@redhat.com>
tools/lib/bpf/libbpf.c
tools/lib/bpf/libbpf.h
tools/perf/util/bpf-loader.c

index 215be67f038b2754043c484693e436ea615529e7..57924db2d16f09fd1b9f0b3c3e71cc0dabd54956 100644 (file)
@@ -1311,12 +1311,9 @@ int bpf_program__nth_fd(struct bpf_program *prog, int n)
        return fd;
 }
 
-int bpf_map__get_fd(struct bpf_map *map)
+int bpf_map__fd(struct bpf_map *map)
 {
-       if (!map)
-               return -EINVAL;
-
-       return map->fd;
+       return map ? map->fd : -EINVAL;
 }
 
 const struct bpf_map_def *bpf_map__def(struct bpf_map *map)
index bad5bac58db4e62d0e99e09cc788ebbec75d035b..cb838d0ea75347642ec7d547df74b05b4130c0cb 100644 (file)
@@ -180,7 +180,7 @@ bpf_map__next(struct bpf_map *map, struct bpf_object *obj);
             (pos) != NULL;                             \
             (pos) = bpf_map__next((pos), (obj)))
 
-int bpf_map__get_fd(struct bpf_map *map);
+int bpf_map__fd(struct bpf_map *map);
 const struct bpf_map_def *bpf_map__def(struct bpf_map *map);
 const char *bpf_map__name(struct bpf_map *map);
 
index 73c1e7cf87601fa963cb4e57ece6c9031675c934..12e6ef4c2f9e621231e9c7ea0d332332f668312a 100644 (file)
@@ -1270,7 +1270,7 @@ bpf_map_config_foreach_key(struct bpf_map *map,
                pr_debug("ERROR: failed to get definition from map %s\n", name);
                return -BPF_LOADER_ERRNO__INTERNAL;
        }
-       map_fd = bpf_map__get_fd(map);
+       map_fd = bpf_map__fd(map);
        if (map_fd < 0) {
                pr_debug("ERROR: failed to get fd from map %s\n", name);
                return map_fd;