xref: /aosp_15_r20/external/ltp/include/tst_private.h (revision 49cdfc7efb34551c7342be41a7384b9c40d7cab7)
1*49cdfc7eSAndroid Build Coastguard Worker // SPDX-License-Identifier: GPL-2.0-or-later
2*49cdfc7eSAndroid Build Coastguard Worker /*
3*49cdfc7eSAndroid Build Coastguard Worker  * Copyright (c) 2017-2019 Petr Vorel <[email protected]>
4*49cdfc7eSAndroid Build Coastguard Worker  *
5*49cdfc7eSAndroid Build Coastguard Worker  * Internal helper functions for the shell library. Do not use directly
6*49cdfc7eSAndroid Build Coastguard Worker  * in test programs.
7*49cdfc7eSAndroid Build Coastguard Worker  */
8*49cdfc7eSAndroid Build Coastguard Worker 
9*49cdfc7eSAndroid Build Coastguard Worker #ifndef TST_PRIVATE_H_
10*49cdfc7eSAndroid Build Coastguard Worker #define TST_PRIVATE_H_
11*49cdfc7eSAndroid Build Coastguard Worker 
12*49cdfc7eSAndroid Build Coastguard Worker #include <stdio.h>
13*49cdfc7eSAndroid Build Coastguard Worker #include <netdb.h>
14*49cdfc7eSAndroid Build Coastguard Worker #include "tst_defaults.h"
15*49cdfc7eSAndroid Build Coastguard Worker 
16*49cdfc7eSAndroid Build Coastguard Worker #define MAX_IPV4_PREFIX 32
17*49cdfc7eSAndroid Build Coastguard Worker #define MAX_IPV6_PREFIX 128
18*49cdfc7eSAndroid Build Coastguard Worker 
19*49cdfc7eSAndroid Build Coastguard Worker #define tst_res_comment(...) { \
20*49cdfc7eSAndroid Build Coastguard Worker 	fprintf(stderr, "# "); \
21*49cdfc7eSAndroid Build Coastguard Worker 	tst_res(__VA_ARGS__); } \
22*49cdfc7eSAndroid Build Coastguard Worker 
23*49cdfc7eSAndroid Build Coastguard Worker 
24*49cdfc7eSAndroid Build Coastguard Worker #define tst_brk_comment(...) { \
25*49cdfc7eSAndroid Build Coastguard Worker 	fprintf(stderr, "# "); \
26*49cdfc7eSAndroid Build Coastguard Worker 	tst_brk(TCONF, __VA_ARGS__); } \
27*49cdfc7eSAndroid Build Coastguard Worker 
28*49cdfc7eSAndroid Build Coastguard Worker void tst_print_svar(const char *name, const char *val);
29*49cdfc7eSAndroid Build Coastguard Worker void tst_print_svar_change(const char *name, const char *val);
30*49cdfc7eSAndroid Build Coastguard Worker 
31*49cdfc7eSAndroid Build Coastguard Worker int tst_get_prefix(const char *ip_str, int is_ipv6);
32*49cdfc7eSAndroid Build Coastguard Worker 
33*49cdfc7eSAndroid Build Coastguard Worker /*
34*49cdfc7eSAndroid Build Coastguard Worker  * Checks kernel config for a single configuration option and returns its
35*49cdfc7eSAndroid Build Coastguard Worker  * state if found. The possible return values are the same as for
36*49cdfc7eSAndroid Build Coastguard Worker  * tst_kconfig_var.choice, with the same meaning. See tst_kconfig_read()
37*49cdfc7eSAndroid Build Coastguard Worker  * description in tst_kconfig.h.
38*49cdfc7eSAndroid Build Coastguard Worker  */
39*49cdfc7eSAndroid Build Coastguard Worker char tst_kconfig_get(const char *confname);
40*49cdfc7eSAndroid Build Coastguard Worker 
41*49cdfc7eSAndroid Build Coastguard Worker /*
42*49cdfc7eSAndroid Build Coastguard Worker  * If cmd argument is a single command, this function just checks command
43*49cdfc7eSAndroid Build Coastguard Worker  * whether exists. If not, case skips.
44*49cdfc7eSAndroid Build Coastguard Worker  * If cmd argument is a complex string ie 'mkfs.ext4 >= 1.43.0', this
45*49cdfc7eSAndroid Build Coastguard Worker  * function checks command version whether meets this requirement.
46*49cdfc7eSAndroid Build Coastguard Worker  * If not, case skips.
47*49cdfc7eSAndroid Build Coastguard Worker  */
48*49cdfc7eSAndroid Build Coastguard Worker void tst_check_cmd(const char *cmd);
49*49cdfc7eSAndroid Build Coastguard Worker 
50*49cdfc7eSAndroid Build Coastguard Worker #endif
51