18 #ifndef _BOILERPLATE_TUNABLES_H 19 #define _BOILERPLATE_TUNABLES_H 22 #include <boilerplate/setup.h> 28 static inline int __may_change_config_tunable(
void)
30 return !__config_done;
33 #define __tunable_set_call(__name, __scope) \ 34 __assign_ ## __name ## _ ## __scope 36 #define __tunable_get_call(__name, __scope) \ 37 __read_ ## __name ## _ ## __scope 39 #define __define_tunable(__name, __type, __val, __scope) \ 40 void __tunable_set_call(__name, __scope)(__typeof__(__type) __val) 42 #define __read_tunable(__name, __type, __scope) \ 43 __typeof__(__type) __tunable_get_call(__name, __scope)(void) 45 #define define_config_tunable(__name, __type, __val) \ 46 __define_tunable(__name, __type, __val, config) 48 #define define_runtime_tunable(__name, __type, __val) \ 49 __define_tunable(__name, __type, __val, runtime) 51 #define read_config_tunable(__name, __type) \ 52 __read_tunable(__name, __type, config) 54 #define read_runtime_tunable(__name, __type) \ 55 __read_tunable(__name, __type, runtime) 57 #define set_config_tunable(__name, __val) \ 59 assert(__may_change_config_tunable()); \ 60 __tunable_set_call(__name, config)(__val); \ 63 #define get_config_tunable(__name) \ 64 __tunable_get_call(__name, config)() 66 #define set_runtime_tunable(__name, __val) \ 67 __tunable_set_call(__name, runtime)(__val) 69 #define get_runtime_tunable(__name) \ 70 __tunable_get_call(__name, runtime)() 72 static inline define_config_tunable(cpu_affinity, cpu_set_t, cpus)
74 __base_setup_data.cpu_affinity = cpus;
77 static inline read_config_tunable(cpu_affinity, cpu_set_t)
79 return __base_setup_data.cpu_affinity;
82 static inline define_config_tunable(no_mlock,
int, nolock)
84 __base_setup_data.no_mlock = nolock;
87 static inline read_config_tunable(no_mlock,
int)
89 return __base_setup_data.no_mlock;
92 static inline define_config_tunable(no_sanity,
int, nosanity)
94 __base_setup_data.no_sanity = nosanity;
97 static inline read_config_tunable(no_sanity,
int)
99 return __base_setup_data.no_sanity;
102 static inline define_runtime_tunable(verbosity_level,
int, level)
104 __base_setup_data.verbosity_level = level;
107 static inline read_runtime_tunable(verbosity_level,
int)
109 return __base_setup_data.verbosity_level;
112 static inline define_runtime_tunable(trace_level,
int, level)
114 __base_setup_data.trace_level = level;
117 static inline read_runtime_tunable(trace_level,
int)
119 return __base_setup_data.trace_level;