Linux Audio

Check our new training course

Loading...
Note: File does not exist in v4.17.
 1/* SPDX-License-Identifier: GPL-2.0 */
 2#ifndef __PERF_MAP_GROUPS_H
 3#define __PERF_MAP_GROUPS_H
 4
 5#include <linux/refcount.h>
 6#include <linux/rbtree.h>
 7#include <stdio.h>
 8#include <stdbool.h>
 9#include <linux/types.h>
10#include "rwsem.h"
11
12struct ref_reloc_sym;
13struct machine;
14struct map;
15struct thread;
16
17struct maps {
18	struct rb_root      entries;
19	struct rb_root	    names;
20	struct rw_semaphore lock;
21};
22
23void maps__insert(struct maps *maps, struct map *map);
24void maps__remove(struct maps *maps, struct map *map);
25struct map *maps__find(struct maps *maps, u64 addr);
26struct map *maps__first(struct maps *maps);
27struct map *map__next(struct map *map);
28struct symbol *maps__find_symbol_by_name(struct maps *maps, const char *name, struct map **mapp);
29
30struct map_groups {
31	struct maps	 maps;
32	struct machine	 *machine;
33	refcount_t	 refcnt;
34#ifdef HAVE_LIBUNWIND_SUPPORT
35	void				*addr_space;
36	struct unwind_libunwind_ops	*unwind_libunwind_ops;
37#endif
38};
39
40#define KMAP_NAME_LEN 256
41
42struct kmap {
43	struct ref_reloc_sym *ref_reloc_sym;
44	struct map_groups    *kmaps;
45	char		     name[KMAP_NAME_LEN];
46};
47
48struct map_groups *map_groups__new(struct machine *machine);
49void map_groups__delete(struct map_groups *mg);
50bool map_groups__empty(struct map_groups *mg);
51
52static inline struct map_groups *map_groups__get(struct map_groups *mg)
53{
54	if (mg)
55		refcount_inc(&mg->refcnt);
56	return mg;
57}
58
59void map_groups__put(struct map_groups *mg);
60void map_groups__init(struct map_groups *mg, struct machine *machine);
61void map_groups__exit(struct map_groups *mg);
62int map_groups__clone(struct thread *thread, struct map_groups *parent);
63size_t map_groups__fprintf(struct map_groups *mg, FILE *fp);
64
65void map_groups__insert(struct map_groups *mg, struct map *map);
66
67static inline void map_groups__remove(struct map_groups *mg, struct map *map)
68{
69	maps__remove(&mg->maps, map);
70}
71
72static inline struct map *map_groups__find(struct map_groups *mg, u64 addr)
73{
74	return maps__find(&mg->maps, addr);
75}
76
77struct map *map_groups__first(struct map_groups *mg);
78
79static inline struct map *map_groups__next(struct map *map)
80{
81	return map__next(map);
82}
83
84struct symbol *map_groups__find_symbol(struct map_groups *mg, u64 addr, struct map **mapp);
85struct symbol *map_groups__find_symbol_by_name(struct map_groups *mg, const char *name, struct map **mapp);
86
87struct addr_map_symbol;
88
89int map_groups__find_ams(struct addr_map_symbol *ams);
90
91int map_groups__fixup_overlappings(struct map_groups *mg, struct map *map, FILE *fp);
92
93struct map *map_groups__find_by_name(struct map_groups *mg, const char *name);
94
95int map_groups__merge_in(struct map_groups *kmaps, struct map *new_map);
96
97#endif // __PERF_MAP_GROUPS_H