Merge branch 'for-linus' of git://git.kernel.org/pub/scm/linux/kernel/git/gerg/m68knommu
[cascardo/linux.git] / tools / perf / util / probe-file.h
1 #ifndef __PROBE_FILE_H
2 #define __PROBE_FILE_H
3
4 #include "strlist.h"
5 #include "strfilter.h"
6 #include "probe-event.h"
7
8 /* Cache of probe definitions */
9 struct probe_cache_entry {
10         struct list_head        node;
11         bool                    sdt;
12         struct perf_probe_event pev;
13         char                    *spev;
14         struct strlist          *tevlist;
15 };
16
17 struct probe_cache {
18         int     fd;
19         struct list_head entries;
20 };
21
22 #define PF_FL_UPROBE    1
23 #define PF_FL_RW        2
24 #define for_each_probe_cache_entry(entry, pcache) \
25         list_for_each_entry(entry, &pcache->entries, node)
26
27 /* probe-file.c depends on libelf */
28 #ifdef HAVE_LIBELF_SUPPORT
29 int probe_file__open(int flag);
30 int probe_file__open_both(int *kfd, int *ufd, int flag);
31 struct strlist *probe_file__get_namelist(int fd);
32 struct strlist *probe_file__get_rawlist(int fd);
33 int probe_file__add_event(int fd, struct probe_trace_event *tev);
34 int probe_file__del_events(int fd, struct strfilter *filter);
35 int probe_file__get_events(int fd, struct strfilter *filter,
36                                   struct strlist *plist);
37 int probe_file__del_strlist(int fd, struct strlist *namelist);
38
39 int probe_cache_entry__get_event(struct probe_cache_entry *entry,
40                                  struct probe_trace_event **tevs);
41
42 struct probe_cache *probe_cache__new(const char *target);
43 int probe_cache__add_entry(struct probe_cache *pcache,
44                            struct perf_probe_event *pev,
45                            struct probe_trace_event *tevs, int ntevs);
46 int probe_cache__scan_sdt(struct probe_cache *pcache, const char *pathname);
47 int probe_cache__commit(struct probe_cache *pcache);
48 void probe_cache__purge(struct probe_cache *pcache);
49 void probe_cache__delete(struct probe_cache *pcache);
50 int probe_cache__filter_purge(struct probe_cache *pcache,
51                               struct strfilter *filter);
52 struct probe_cache_entry *probe_cache__find(struct probe_cache *pcache,
53                                             struct perf_probe_event *pev);
54 struct probe_cache_entry *probe_cache__find_by_name(struct probe_cache *pcache,
55                                         const char *group, const char *event);
56 int probe_cache__show_all_caches(struct strfilter *filter);
57 #else   /* ! HAVE_LIBELF_SUPPORT */
58 static inline struct probe_cache *probe_cache__new(const char *tgt __maybe_unused)
59 {
60         return NULL;
61 }
62 #define probe_cache__delete(pcache) do {} while (0)
63 #endif
64 #endif