14579b4a4SKui-Feng Lee /* SPDX-License-Identifier: GPL-2.0 */ 24579b4a4SKui-Feng Lee /* Copyright (c) 2024 Meta Platforms, Inc. and affiliates. */ 34579b4a4SKui-Feng Lee 44579b4a4SKui-Feng Lee #ifndef _UPTR_TEST_COMMON_H 54579b4a4SKui-Feng Lee #define _UPTR_TEST_COMMON_H 64579b4a4SKui-Feng Lee 74579b4a4SKui-Feng Lee #define MAGIC_VALUE 0xabcd1234 84579b4a4SKui-Feng Lee 94579b4a4SKui-Feng Lee #ifdef __BPF__ 104579b4a4SKui-Feng Lee /* Avoid fwd btf type being generated for the following struct */ 114579b4a4SKui-Feng Lee struct user_data *dummy_data; 124579b4a4SKui-Feng Lee struct cgroup *dummy_cgrp; 134579b4a4SKui-Feng Lee #else 144579b4a4SKui-Feng Lee #define __uptr 154579b4a4SKui-Feng Lee #define __kptr 164579b4a4SKui-Feng Lee #endif 174579b4a4SKui-Feng Lee 184579b4a4SKui-Feng Lee struct user_data { 194579b4a4SKui-Feng Lee int a; 204579b4a4SKui-Feng Lee int b; 214579b4a4SKui-Feng Lee int result; 224579b4a4SKui-Feng Lee int nested_result; 234579b4a4SKui-Feng Lee }; 244579b4a4SKui-Feng Lee 254579b4a4SKui-Feng Lee struct nested_udata { 264579b4a4SKui-Feng Lee struct user_data __uptr *udata; 274579b4a4SKui-Feng Lee }; 284579b4a4SKui-Feng Lee 294579b4a4SKui-Feng Lee struct value_type { 304579b4a4SKui-Feng Lee struct user_data __uptr *udata; 314579b4a4SKui-Feng Lee struct cgroup __kptr *cgrp; 324579b4a4SKui-Feng Lee struct nested_udata nested; 334579b4a4SKui-Feng Lee }; 344579b4a4SKui-Feng Lee 35*cbf9f849SMartin KaFai Lau struct value_lock_type { 36*cbf9f849SMartin KaFai Lau struct user_data __uptr *udata; 37*cbf9f849SMartin KaFai Lau struct bpf_spin_lock lock; 38*cbf9f849SMartin KaFai Lau }; 39*cbf9f849SMartin KaFai Lau 404579b4a4SKui-Feng Lee #endif 41