at v6.19 82 lines 2.6 kB view raw
1/* SPDX-License-Identifier: GPL-2.0 */ 2#ifndef __PROBE_FILE_H 3#define __PROBE_FILE_H 4 5#include "probe-event.h" 6 7struct strlist; 8struct strfilter; 9 10/* Cache of probe definitions */ 11struct probe_cache_entry { 12 struct list_head node; 13 bool sdt; 14 struct perf_probe_event pev; 15 char *spev; 16 struct strlist *tevlist; 17}; 18 19struct probe_cache { 20 int fd; 21 struct list_head entries; 22}; 23 24enum probe_type { 25 PROBE_TYPE_U = 0, 26 PROBE_TYPE_S, 27 PROBE_TYPE_X, 28 PROBE_TYPE_STRING, 29 PROBE_TYPE_BITFIELD, 30 PROBE_TYPE_END, 31}; 32 33#define PF_FL_UPROBE 1 34#define PF_FL_RW 2 35#define for_each_probe_cache_entry(entry, pcache) \ 36 list_for_each_entry(entry, &pcache->entries, node) 37 38/* probe-file.c depends on libelf */ 39#ifdef HAVE_LIBELF_SUPPORT 40int open_trace_file(const char *trace_file, bool readwrite); 41int probe_file__open(int flag); 42int probe_file__open_both(int *kfd, int *ufd, int flag); 43struct strlist *probe_file__get_namelist(int fd); 44struct strlist *probe_file__get_rawlist(int fd); 45int probe_file__add_event(int fd, struct probe_trace_event *tev); 46 47int probe_file__get_events(int fd, struct strfilter *filter, 48 struct strlist *plist); 49int probe_file__del_strlist(int fd, struct strlist *namelist); 50 51int probe_cache_entry__get_event(struct probe_cache_entry *entry, 52 struct probe_trace_event **tevs); 53 54struct probe_cache *probe_cache__new(const char *target, struct nsinfo *nsi); 55int probe_cache__add_entry(struct probe_cache *pcache, 56 struct perf_probe_event *pev, 57 struct probe_trace_event *tevs, int ntevs); 58int probe_cache__scan_sdt(struct probe_cache *pcache, const char *pathname); 59int probe_cache__commit(struct probe_cache *pcache); 60void probe_cache__purge(struct probe_cache *pcache); 61void probe_cache__delete(struct probe_cache *pcache); 62int probe_cache__filter_purge(struct probe_cache *pcache, 63 struct strfilter *filter); 64struct 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); 68int probe_cache__show_all_caches(struct strfilter *filter); 69bool probe_type_is_available(enum probe_type type); 70bool kretprobe_offset_is_supported(void); 71bool uprobe_ref_ctr_is_supported(void); 72bool user_access_is_supported(void); 73bool multiprobe_event_is_supported(void); 74bool immediate_value_is_supported(void); 75#else /* ! HAVE_LIBELF_SUPPORT */ 76static inline struct probe_cache *probe_cache__new(const char *tgt __maybe_unused, struct nsinfo *nsi __maybe_unused) 77{ 78 return NULL; 79} 80#define probe_cache__delete(pcache) do {} while (0) 81#endif 82#endif