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-only */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  2) #ifndef UTIL_H
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  3) #define UTIL_H
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  4) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  5) #include <sys/socket.h>
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  6) #include <linux/vm_sockets.h>
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  7) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  8) /* Tests can either run as the client or the server */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  9) enum test_mode {
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 10) 	TEST_MODE_UNSET,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 11) 	TEST_MODE_CLIENT,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 12) 	TEST_MODE_SERVER
^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) /* Test runner options */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 16) struct test_opts {
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 17) 	enum test_mode mode;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 18) 	unsigned int peer_cid;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 19) };
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 20) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 21) /* A test case definition.  Test functions must print failures to stderr and
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 22)  * terminate with exit(EXIT_FAILURE).
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 23)  */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 24) struct test_case {
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 25) 	const char *name; /* human-readable name */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 26) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 27) 	/* Called when test mode is TEST_MODE_CLIENT */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 28) 	void (*run_client)(const struct test_opts *opts);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 29) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 30) 	/* Called when test mode is TEST_MODE_SERVER */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 31) 	void (*run_server)(const struct test_opts *opts);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 32) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 33) 	bool skip;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 34) };
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 35) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 36) void init_signals(void);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 37) unsigned int parse_cid(const char *str);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 38) int vsock_stream_connect(unsigned int cid, unsigned int port);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 39) int vsock_stream_accept(unsigned int cid, unsigned int port,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 40) 			struct sockaddr_vm *clientaddrp);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 41) void vsock_wait_remote_close(int fd);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 42) void send_byte(int fd, int expected_ret, int flags);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 43) void recv_byte(int fd, int expected_ret, int flags);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 44) void run_tests(const struct test_case *test_cases,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 45) 	       const struct test_opts *opts);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 46) void list_tests(const struct test_case *test_cases);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 47) void skip_test(struct test_case *test_cases, size_t test_cases_len,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 48) 	       const char *test_id_str);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 49) #endif /* UTIL_H */