1*4579b4a4SKui-Feng Lee /* SPDX-License-Identifier: GPL-2.0 */ 2*4579b4a4SKui-Feng Lee /* Copyright (c) 2024 Meta Platforms, Inc. and affiliates. */ 3*4579b4a4SKui-Feng Lee 4*4579b4a4SKui-Feng Lee #ifndef _UPTR_TEST_COMMON_H 5*4579b4a4SKui-Feng Lee #define _UPTR_TEST_COMMON_H 6*4579b4a4SKui-Feng Lee 7*4579b4a4SKui-Feng Lee #define MAGIC_VALUE 0xabcd1234 8*4579b4a4SKui-Feng Lee 9*4579b4a4SKui-Feng Lee #ifdef __BPF__ 10*4579b4a4SKui-Feng Lee /* Avoid fwd btf type being generated for the following struct */ 11*4579b4a4SKui-Feng Lee struct user_data *dummy_data; 12*4579b4a4SKui-Feng Lee struct cgroup *dummy_cgrp; 13*4579b4a4SKui-Feng Lee #else 14*4579b4a4SKui-Feng Lee #define __uptr 15*4579b4a4SKui-Feng Lee #define __kptr 16*4579b4a4SKui-Feng Lee #endif 17*4579b4a4SKui-Feng Lee 18*4579b4a4SKui-Feng Lee struct user_data { 19*4579b4a4SKui-Feng Lee int a; 20*4579b4a4SKui-Feng Lee int b; 21*4579b4a4SKui-Feng Lee int result; 22*4579b4a4SKui-Feng Lee int nested_result; 23*4579b4a4SKui-Feng Lee }; 24*4579b4a4SKui-Feng Lee 25*4579b4a4SKui-Feng Lee struct nested_udata { 26*4579b4a4SKui-Feng Lee struct user_data __uptr *udata; 27*4579b4a4SKui-Feng Lee }; 28*4579b4a4SKui-Feng Lee 29*4579b4a4SKui-Feng Lee struct value_type { 30*4579b4a4SKui-Feng Lee struct user_data __uptr *udata; 31*4579b4a4SKui-Feng Lee struct cgroup __kptr *cgrp; 32*4579b4a4SKui-Feng Lee struct nested_udata nested; 33*4579b4a4SKui-Feng Lee }; 34*4579b4a4SKui-Feng Lee 35*4579b4a4SKui-Feng Lee #endif 36