1 /* SPDX-License-Identifier: GPL-2.0 */
2 /*
3 * Define struct scx_enums that stores the load-time values of enums
4 * used by the BPF program.
5 *
6 * Copyright (c) 2024 Meta Platforms, Inc. and affiliates.
7 */
8
9 #ifndef __SCX_ENUMS_H
10 #define __SCX_ENUMS_H
11
__ENUM_set(u64 * val,char * type,char * name)12 static inline void __ENUM_set(u64 *val, char *type, char *name)
13 {
14 bool res;
15
16 res = __COMPAT_read_enum(type, name, val);
17 if (!res)
18 *val = 0;
19 }
20
21 #define SCX_ENUM_SET(skel, type, name) do { \
22 __ENUM_set(&skel->rodata->__##name, #type, #name); \
23 } while (0)
24
25
26 #include "enums.autogen.h"
27
28 #endif /* __SCX_ENUMS_H */
29