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: (LGPL-2.1 OR BSD-2-Clause) */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  2) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  3) /*
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  4)  * Common user-facing libbpf helpers.
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  5)  *
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  6)  * Copyright (c) 2019 Facebook
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  7)  */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  8) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  9) #ifndef __LIBBPF_LIBBPF_COMMON_H
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 10) #define __LIBBPF_LIBBPF_COMMON_H
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 11) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 12) #include <string.h>
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 13) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 14) #ifndef LIBBPF_API
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 15) #define LIBBPF_API __attribute__((visibility("default")))
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 16) #endif
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 17) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 18) #define LIBBPF_DEPRECATED(msg) __attribute__((deprecated(msg)))
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 19) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 20) /* Helper macro to declare and initialize libbpf options struct
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 21)  *
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 22)  * This dance with uninitialized declaration, followed by memset to zero,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 23)  * followed by assignment using compound literal syntax is done to preserve
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 24)  * ability to use a nice struct field initialization syntax and **hopefully**
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 25)  * have all the padding bytes initialized to zero. It's not guaranteed though,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 26)  * when copying literal, that compiler won't copy garbage in literal's padding
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 27)  * bytes, but that's the best way I've found and it seems to work in practice.
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 28)  *
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 29)  * Macro declares opts struct of given type and name, zero-initializes,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 30)  * including any extra padding, it with memset() and then assigns initial
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 31)  * values provided by users in struct initializer-syntax as varargs.
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 32)  */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 33) #define DECLARE_LIBBPF_OPTS(TYPE, NAME, ...)				    \
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 34) 	struct TYPE NAME = ({ 						    \
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 35) 		memset(&NAME, 0, sizeof(struct TYPE));			    \
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 36) 		(struct TYPE) {						    \
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 37) 			.sz = sizeof(struct TYPE),			    \
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 38) 			__VA_ARGS__					    \
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 39) 		};							    \
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 40) 	})
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 41) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 42) #endif /* __LIBBPF_LIBBPF_COMMON_H */