Orange Pi5 kernel

Deprecated Linux kernel 5.10.110 for OrangePi 5/5B/5+ boards

3 Commits   0 Branches   0 Tags
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  1) // SPDX-License-Identifier: GPL-2.0
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  2) /*
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  3)  * bpf-script-test-prologue.c
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  4)  * Test BPF prologue
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  5)  */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  6) #ifndef LINUX_VERSION_CODE
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  7) # error Need LINUX_VERSION_CODE
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  8) # error Example: for 4.2 kernel, put 'clang-opt="-DLINUX_VERSION_CODE=0x40200" into llvm section of ~/.perfconfig'
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  9) #endif
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 10) #define SEC(NAME) __attribute__((section(NAME), used))
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 11) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 12) #include <uapi/linux/fs.h>
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 13) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 14) /*
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 15)  * If CONFIG_PROFILE_ALL_BRANCHES is selected,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 16)  * 'if' is redefined after include kernel header.
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 17)  * Recover 'if' for BPF object code.
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 18)  */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 19) #ifdef if
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 20) # undef if
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 21) #endif
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 22) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 23) #define FMODE_READ		0x1
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 24) #define FMODE_WRITE		0x2
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 25) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 26) static void (*bpf_trace_printk)(const char *fmt, int fmt_size, ...) =
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 27) 	(void *) 6;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 28) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 29) SEC("func=null_lseek file->f_mode offset orig")
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 30) int bpf_func__null_lseek(void *ctx, int err, unsigned long _f_mode,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 31) 			 unsigned long offset, unsigned long orig)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 32) {
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 33) 	fmode_t f_mode = (fmode_t)_f_mode;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 34) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 35) 	if (err)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 36) 		return 0;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 37) 	if (f_mode & FMODE_WRITE)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 38) 		return 0;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 39) 	if (offset & 1)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 40) 		return 0;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 41) 	if (orig == SEEK_CUR)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 42) 		return 0;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 43) 	return 1;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 44) }
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 45) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 46) char _license[] SEC("license") = "GPL";
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 47) int _version SEC("version") = LINUX_VERSION_CODE;