/* SPDX-License-Identifier: GPL-2.0 */ /* * Copyright (c) 2024 Meta Platforms, Inc. and affiliates. * Copyright (c) 2024 Tejun Heo * Copyright (c) 2024 David Vernet */ #ifndef __SCX_COMPAT_BPF_H #define __SCX_COMPAT_BPF_H #define __COMPAT_ENUM_OR_ZERO(__type, __ent) \ ({ \ __type __ret = 0; \ if (bpf_core_enum_value_exists(__type, __ent)) \ __ret = __ent; \ __ret; \ }) /* * Define sched_ext_ops. This may be expanded to define multiple variants for * backward compatibility. See compat.h::SCX_OPS_LOAD/ATTACH(). */ #define SCX_OPS_DEFINE(__name, ...) \ SEC(".struct_ops.link") \ struct sched_ext_ops __name = { \ __VA_ARGS__, \ }; #endif /* __SCX_COMPAT_BPF_H */