@@ -24,6 +24,21 @@ struct {
2424 __uint (max_entries , 64 );
2525} m_event SEC (".maps" );
2626
27+ struct {
28+ __uint (type , BPF_MAP_TYPE_ARRAY );
29+ __uint (key_size , sizeof (int ));
30+ __uint (value_size , sizeof (bpf_args_t ));
31+ __uint (max_entries , 1 );
32+ } m_config SEC (".maps" );
33+
34+ #define CONFIG () ({ \
35+ int _key = 0; \
36+ void * _v = bpf_map_lookup_elem(&m_config, &_key); \
37+ if (!_v) \
38+ return 0; /* this can't happen */ \
39+ (bpf_args_t * )_v ; \
40+ })
41+
2742#define EVENT_OUTPUT (ctx , data ) \
2843 bpf_perf_event_output(ctx, &m_event, BPF_F_CURRENT_CPU, \
2944 &(data), sizeof(data))
@@ -50,25 +65,8 @@ struct {
5065#endif
5166
5267#ifdef COMPAT_MODE
53- struct {
54- __uint (type , BPF_MAP_TYPE_ARRAY );
55- __uint (key_size , sizeof (int ));
56- __uint (value_size , sizeof (bpf_args_t ));
57- __uint (max_entries , 1 );
58- } m_config SEC (".maps" );
59-
60- #define CONFIG () ({ \
61- int _key = 0; \
62- void * _v = bpf_map_lookup_elem(&m_config, &_key); \
63- if (!_v) \
64- return 0; /* this can't happen */ \
65- (bpf_args_t * )_v ; \
66- })
67-
6868#define try_inline __attribute__((always_inline))
6969#else
70- bpf_args_t _bpf_args ;
71- #define CONFIG () &_bpf_args
7270#define try_inline inline
7371#endif
7472
0 commit comments