1*696c3901SYonghong Song // SPDX-License-Identifier: GPL-2.0
2*696c3901SYonghong Song /* Copyright (c) 2022 Facebook */
3*696c3901SYonghong Song #include "vmlinux.h"
4*696c3901SYonghong Song #include <bpf/bpf_helpers.h>
5*696c3901SYonghong Song #include <bpf/bpf_tracing.h>
6*696c3901SYonghong Song 
7*696c3901SYonghong Song struct bpf_testmod_btf_type_tag_1 {
8*696c3901SYonghong Song 	int a;
9*696c3901SYonghong Song };
10*696c3901SYonghong Song 
11*696c3901SYonghong Song struct bpf_testmod_btf_type_tag_2 {
12*696c3901SYonghong Song 	struct bpf_testmod_btf_type_tag_1 *p;
13*696c3901SYonghong Song };
14*696c3901SYonghong Song 
15*696c3901SYonghong Song int g;
16*696c3901SYonghong Song 
17*696c3901SYonghong Song SEC("fentry/bpf_testmod_test_btf_type_tag_user_1")
BPF_PROG(test_user1,struct bpf_testmod_btf_type_tag_1 * arg)18*696c3901SYonghong Song int BPF_PROG(test_user1, struct bpf_testmod_btf_type_tag_1 *arg)
19*696c3901SYonghong Song {
20*696c3901SYonghong Song 	g = arg->a;
21*696c3901SYonghong Song 	return 0;
22*696c3901SYonghong Song }
23*696c3901SYonghong Song 
24*696c3901SYonghong Song SEC("fentry/bpf_testmod_test_btf_type_tag_user_2")
BPF_PROG(test_user2,struct bpf_testmod_btf_type_tag_2 * arg)25*696c3901SYonghong Song int BPF_PROG(test_user2, struct bpf_testmod_btf_type_tag_2 *arg)
26*696c3901SYonghong Song {
27*696c3901SYonghong Song 	g = arg->p->a;
28*696c3901SYonghong Song 	return 0;
29*696c3901SYonghong Song }
30*696c3901SYonghong Song 
31*696c3901SYonghong Song /* int __sys_getsockname(int fd, struct sockaddr __user *usockaddr,
32*696c3901SYonghong Song  *                       int __user *usockaddr_len);
33*696c3901SYonghong Song  */
34*696c3901SYonghong Song SEC("fentry/__sys_getsockname")
BPF_PROG(test_sys_getsockname,int fd,struct sockaddr * usockaddr,int * usockaddr_len)35*696c3901SYonghong Song int BPF_PROG(test_sys_getsockname, int fd, struct sockaddr *usockaddr,
36*696c3901SYonghong Song 	     int *usockaddr_len)
37*696c3901SYonghong Song {
38*696c3901SYonghong Song 	g = usockaddr->sa_family;
39*696c3901SYonghong Song 	return 0;
40*696c3901SYonghong Song }
41