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