1 // SPDX-License-Identifier: GPL-2.0
2 /* Copyright (c) 2024 Meta Platforms, Inc. and affiliates. */
5 #include <bpf/bpf_helpers.h>
6 #include "uptr_test_common.h"
9 __uint(type, BPF_MAP_TYPE_TASK_STORAGE);
10 __uint(map_flags, BPF_F_NO_PREALLOC);
12 __type(value, struct value_lock_type);
13 } datamap SEC(".maps");
15 /* load test only. not used */
17 int not_used(void *ctx)
19 struct value_lock_type *ptr;
20 struct task_struct *task;
21 struct user_data *udata;
23 task = bpf_get_current_task_btf();
24 ptr = bpf_task_storage_get(&datamap, task, 0, 0);
28 bpf_spin_lock(&ptr->lock);
32 bpf_spin_unlock(&ptr->lock);
35 udata->result = MAGIC_VALUE + udata->a + udata->b;
37 bpf_spin_unlock(&ptr->lock);
42 char _license[] SEC("license") = "GPL";