]> Git Repo - linux.git/blob - tools/testing/selftests/bpf/uptr_test_common.h
Linux 6.14-rc3
[linux.git] / tools / testing / selftests / bpf / uptr_test_common.h
1 /* SPDX-License-Identifier: GPL-2.0 */
2 /* Copyright (c) 2024 Meta Platforms, Inc. and affiliates. */
3
4 #ifndef _UPTR_TEST_COMMON_H
5 #define _UPTR_TEST_COMMON_H
6
7 #define MAGIC_VALUE 0xabcd1234
8 #define PAGE_SIZE 4096
9
10 #ifdef __BPF__
11 /* Avoid fwd btf type being generated for the following struct */
12 struct large_data *dummy_large_data;
13 struct empty_data *dummy_empty_data;
14 struct user_data *dummy_data;
15 struct cgroup *dummy_cgrp;
16 #else
17 #define __uptr
18 #define __kptr
19 #endif
20
21 struct user_data {
22         int a;
23         int b;
24         int result;
25         int nested_result;
26 };
27
28 struct nested_udata {
29         struct user_data __uptr *udata;
30 };
31
32 struct value_type {
33         struct user_data __uptr *udata;
34         struct cgroup __kptr *cgrp;
35         struct nested_udata nested;
36 };
37
38 struct value_lock_type {
39         struct user_data __uptr *udata;
40         struct bpf_spin_lock lock;
41 };
42
43 struct large_data {
44         __u8 one_page[PAGE_SIZE];
45         int a;
46 };
47
48 struct large_uptr {
49         struct large_data __uptr *udata;
50 };
51
52 struct empty_data {
53 };
54
55 struct empty_uptr {
56         struct empty_data __uptr *udata;
57 };
58
59 struct kstruct_uptr {
60         struct cgroup __uptr *cgrp;
61 };
62
63 #endif
This page took 0.032935 seconds and 4 git commands to generate.