1 /* SPDX-License-Identifier: GPL-2.0 */
2 #ifndef __PERF_MAP_GROUPS_H
3 #define __PERF_MAP_GROUPS_H
5 #include <linux/refcount.h>
6 #include <linux/rbtree.h>
9 #include <linux/types.h>
18 struct rb_root entries
;
20 struct rw_semaphore lock
;
23 void maps__insert(struct maps
*maps
, struct map
*map
);
24 void maps__remove(struct maps
*maps
, struct map
*map
);
25 struct map
*maps__find(struct maps
*maps
, u64 addr
);
26 struct map
*maps__first(struct maps
*maps
);
27 struct map
*map__next(struct map
*map
);
28 struct symbol
*maps__find_symbol_by_name(struct maps
*maps
, const char *name
, struct map
**mapp
);
32 struct machine
*machine
;
36 #define KMAP_NAME_LEN 256
39 struct ref_reloc_sym
*ref_reloc_sym
;
40 struct map_groups
*kmaps
;
41 char name
[KMAP_NAME_LEN
];
44 struct map_groups
*map_groups__new(struct machine
*machine
);
45 void map_groups__delete(struct map_groups
*mg
);
46 bool map_groups__empty(struct map_groups
*mg
);
48 static inline struct map_groups
*map_groups__get(struct map_groups
*mg
)
51 refcount_inc(&mg
->refcnt
);
55 void map_groups__put(struct map_groups
*mg
);
56 void map_groups__init(struct map_groups
*mg
, struct machine
*machine
);
57 void map_groups__exit(struct map_groups
*mg
);
58 int map_groups__clone(struct thread
*thread
, struct map_groups
*parent
);
59 size_t map_groups__fprintf(struct map_groups
*mg
, FILE *fp
);
61 void map_groups__insert(struct map_groups
*mg
, struct map
*map
);
63 static inline void map_groups__remove(struct map_groups
*mg
, struct map
*map
)
65 maps__remove(&mg
->maps
, map
);
68 static inline struct map
*map_groups__find(struct map_groups
*mg
, u64 addr
)
70 return maps__find(&mg
->maps
, addr
);
73 struct map
*map_groups__first(struct map_groups
*mg
);
75 static inline struct map
*map_groups__next(struct map
*map
)
77 return map__next(map
);
80 struct symbol
*map_groups__find_symbol(struct map_groups
*mg
, u64 addr
, struct map
**mapp
);
81 struct symbol
*map_groups__find_symbol_by_name(struct map_groups
*mg
, const char *name
, struct map
**mapp
);
83 struct addr_map_symbol
;
85 int map_groups__find_ams(struct addr_map_symbol
*ams
);
87 int map_groups__fixup_overlappings(struct map_groups
*mg
, struct map
*map
, FILE *fp
);
89 struct map
*map_groups__find_by_name(struct map_groups
*mg
, const char *name
);
91 #endif // __PERF_MAP_GROUPS_H