]> git.karo-electronics.de Git - karo-tx-linux.git/blobdiff - tools/perf/util/map.c
perf tools: Move srcline definitions to separate header
[karo-tx-linux.git] / tools / perf / util / map.c
index 0a943e7b1ea7fc745485f016875395e91feca8c8..9059d20c3b8a83458a05d5911bebd3825b9984e3 100644 (file)
@@ -16,6 +16,7 @@
 #include "debug.h"
 #include "machine.h"
 #include <linux/string.h>
+#include "srcline.h"
 #include "unwind.h"
 
 static void __maps__insert(struct maps *maps, struct map *map);
@@ -141,7 +142,7 @@ void map__init(struct map *map, enum map_type type,
        RB_CLEAR_NODE(&map->rb_node);
        map->groups   = NULL;
        map->erange_warned = false;
-       atomic_set(&map->refcnt, 1);
+       refcount_set(&map->refcnt, 1);
 }
 
 struct map *map__new(struct machine *machine, u64 start, u64 len,
@@ -255,7 +256,7 @@ void map__delete(struct map *map)
 
 void map__put(struct map *map)
 {
-       if (map && atomic_dec_and_test(&map->refcnt))
+       if (map && refcount_dec_and_test(&map->refcnt))
                map__delete(map);
 }
 
@@ -354,7 +355,7 @@ struct map *map__clone(struct map *from)
        struct map *map = memdup(from, sizeof(*map));
 
        if (map != NULL) {
-               atomic_set(&map->refcnt, 1);
+               refcount_set(&map->refcnt, 1);
                RB_CLEAR_NODE(&map->rb_node);
                dso__get(map->dso);
                map->groups = NULL;
@@ -405,7 +406,8 @@ int map__fprintf_srcline(struct map *map, u64 addr, const char *prefix,
 
        if (map && map->dso) {
                srcline = get_srcline(map->dso,
-                                     map__rip_2objdump(map, addr), NULL, true);
+                                     map__rip_2objdump(map, addr), NULL,
+                                     true, true);
                if (srcline != SRCLINE_UNKNOWN)
                        ret = fprintf(fp, "%s%s", prefix, srcline);
                free_srcline(srcline);
@@ -485,7 +487,7 @@ void map_groups__init(struct map_groups *mg, struct machine *machine)
                maps__init(&mg->maps[i]);
        }
        mg->machine = machine;
-       atomic_set(&mg->refcnt, 1);
+       refcount_set(&mg->refcnt, 1);
 }
 
 static void __maps__purge(struct maps *maps)
@@ -547,7 +549,7 @@ void map_groups__delete(struct map_groups *mg)
 
 void map_groups__put(struct map_groups *mg)
 {
-       if (mg && atomic_dec_and_test(&mg->refcnt))
+       if (mg && refcount_dec_and_test(&mg->refcnt))
                map_groups__delete(mg);
 }