blob: 5ecc9d3925dbb53c3190d8c6aa075c5e38bd3935 [file] [log] [blame]
Masami Hiramatsu92f6c722015-07-15 18:14:07 +09001#ifndef __PROBE_FILE_H
2#define __PROBE_FILE_H
3
Masami Hiramatsu92f6c722015-07-15 18:14:07 +09004#include "probe-event.h"
5
Arnaldo Carvalho de Melo8ec20b12017-04-18 10:57:25 -03006struct strlist;
7struct strfilter;
8
Masami Hiramatsudd975492016-06-15 12:28:30 +09009/* Cache of probe definitions */
10struct probe_cache_entry {
11 struct list_head node;
Masami Hiramatsu6430a94e2016-07-01 17:04:10 +090012 bool sdt;
Masami Hiramatsudd975492016-06-15 12:28:30 +090013 struct perf_probe_event pev;
14 char *spev;
15 struct strlist *tevlist;
16};
17
18struct probe_cache {
19 int fd;
20 struct list_head entries;
21};
22
Masami Hiramatsu180b2062016-08-18 17:58:31 +090023enum probe_type {
24 PROBE_TYPE_U = 0,
25 PROBE_TYPE_S,
26 PROBE_TYPE_X,
27 PROBE_TYPE_STRING,
28 PROBE_TYPE_BITFIELD,
29 PROBE_TYPE_END,
30};
31
Masami Hiramatsu92f6c722015-07-15 18:14:07 +090032#define PF_FL_UPROBE 1
33#define PF_FL_RW 2
Masami Hiramatsu05bf2c82016-07-12 19:05:04 +090034#define for_each_probe_cache_entry(entry, pcache) \
35 list_for_each_entry(entry, &pcache->entries, node)
Masami Hiramatsu92f6c722015-07-15 18:14:07 +090036
Masami Hiramatsu40218da2016-06-24 18:06:46 +090037/* probe-file.c depends on libelf */
38#ifdef HAVE_LIBELF_SUPPORT
Naveen N. Raoe491bc22017-02-23 17:07:23 +053039int open_trace_file(const char *trace_file, bool readwrite);
Masami Hiramatsu92f6c722015-07-15 18:14:07 +090040int probe_file__open(int flag);
41int probe_file__open_both(int *kfd, int *ufd, int flag);
42struct strlist *probe_file__get_namelist(int fd);
43struct strlist *probe_file__get_rawlist(int fd);
44int probe_file__add_event(int fd, struct probe_trace_event *tev);
Arnaldo Carvalho de Melo8ec20b12017-04-18 10:57:25 -030045
Masami Hiramatsu92f6c722015-07-15 18:14:07 +090046int probe_file__del_events(int fd, struct strfilter *filter);
Namhyung Kime607f142015-09-04 21:16:03 +090047int probe_file__get_events(int fd, struct strfilter *filter,
48 struct strlist *plist);
49int probe_file__del_strlist(int fd, struct strlist *namelist);
50
Masami Hiramatsu42bba262016-07-12 19:05:18 +090051int probe_cache_entry__get_event(struct probe_cache_entry *entry,
52 struct probe_trace_event **tevs);
53
Masami Hiramatsudd975492016-06-15 12:28:30 +090054struct probe_cache *probe_cache__new(const char *target);
55int probe_cache__add_entry(struct probe_cache *pcache,
56 struct perf_probe_event *pev,
57 struct probe_trace_event *tevs, int ntevs);
Masami Hiramatsu6430a94e2016-07-01 17:04:10 +090058int probe_cache__scan_sdt(struct probe_cache *pcache, const char *pathname);
Masami Hiramatsudd975492016-06-15 12:28:30 +090059int probe_cache__commit(struct probe_cache *pcache);
60void probe_cache__purge(struct probe_cache *pcache);
61void probe_cache__delete(struct probe_cache *pcache);
Masami Hiramatsu4a0f65c2016-07-01 17:03:36 +090062int probe_cache__filter_purge(struct probe_cache *pcache,
63 struct strfilter *filter);
Masami Hiramatsubc062232016-07-01 17:03:12 +090064struct probe_cache_entry *probe_cache__find(struct probe_cache *pcache,
65 struct perf_probe_event *pev);
66struct probe_cache_entry *probe_cache__find_by_name(struct probe_cache *pcache,
67 const char *group, const char *event);
Masami Hiramatsu1f3736c2016-07-01 17:03:26 +090068int probe_cache__show_all_caches(struct strfilter *filter);
Masami Hiramatsu180b2062016-08-18 17:58:31 +090069bool probe_type_is_available(enum probe_type type);
Naveen N. Rao7ab31d92017-03-08 13:56:09 +053070bool kretprobe_offset_is_supported(void);
Masami Hiramatsu40218da2016-06-24 18:06:46 +090071#else /* ! HAVE_LIBELF_SUPPORT */
72static inline struct probe_cache *probe_cache__new(const char *tgt __maybe_unused)
73{
74 return NULL;
75}
76#define probe_cache__delete(pcache) do {} while (0)
77#endif
Masami Hiramatsu92f6c722015-07-15 18:14:07 +090078#endif