diff options
author | наб <[email protected]> | 2022-01-22 01:56:46 +0100 |
---|---|---|
committer | Brian Behlendorf <[email protected]> | 2022-03-15 15:13:48 -0700 |
commit | d465fc584425c618f8baa13a31b70ffabe053484 (patch) | |
tree | d5c120208b294829231adc7d7efbb28fdee3adcd /tests | |
parent | 861166b02701dfc8f63a105bd32758e806c84fd7 (diff) |
Forbid b{copy,zero,cmp}(). Don't include <strings.h> for <string.h>
Reviewed-by: Brian Behlendorf <[email protected]>
Signed-off-by: Ahelenia Ziemiańska <[email protected]>
Closes #12996
Diffstat (limited to 'tests')
-rw-r--r-- | tests/zfs-tests/cmd/file_common.h | 2 | ||||
-rw-r--r-- | tests/zfs-tests/cmd/libzfs_input_check/libzfs_input_check.c | 11 | ||||
-rw-r--r-- | tests/zfs-tests/cmd/mkbusy/mkbusy.c | 2 | ||||
-rw-r--r-- | tests/zfs-tests/cmd/nvlist_to_lua/nvlist_to_lua.c | 7 | ||||
-rw-r--r-- | tests/zfs-tests/cmd/rename_dir/rename_dir.c | 15 | ||||
-rw-r--r-- | tests/zfs-tests/cmd/rm_lnkcnt_zero_file/rm_lnkcnt_zero_file.c | 1 | ||||
-rw-r--r-- | tests/zfs-tests/tests/functional/checksum/skein_test.c | 2 | ||||
-rw-r--r-- | tests/zfs-tests/tests/functional/ctime/ctime.c | 1 | ||||
-rw-r--r-- | tests/zfs-tests/tests/functional/hkdf/hkdf_test.c | 6 |
9 files changed, 19 insertions, 28 deletions
diff --git a/tests/zfs-tests/cmd/file_common.h b/tests/zfs-tests/cmd/file_common.h index 64b1777a9..f0c0e32b5 100644 --- a/tests/zfs-tests/cmd/file_common.h +++ b/tests/zfs-tests/cmd/file_common.h @@ -52,7 +52,7 @@ extern "C" { #include <stdio.h> #include <unistd.h> #include <stdlib.h> -#include <strings.h> +#include <string.h> #define BLOCKSZ 8192 #define DATA 0xa5 diff --git a/tests/zfs-tests/cmd/libzfs_input_check/libzfs_input_check.c b/tests/zfs-tests/cmd/libzfs_input_check/libzfs_input_check.c index fba18068c..bfa450be5 100644 --- a/tests/zfs-tests/cmd/libzfs_input_check/libzfs_input_check.c +++ b/tests/zfs-tests/cmd/libzfs_input_check/libzfs_input_check.c @@ -20,7 +20,6 @@ #include <stdio.h> #include <stdlib.h> #include <string.h> -#include <strings.h> #include <libzfs_core.h> #include <libzutil.h> @@ -33,19 +32,19 @@ * Test the nvpair inputs for the non-legacy zfs ioctl commands. */ -boolean_t unexpected_failures; -int zfs_fd; -const char *active_test; +static boolean_t unexpected_failures; +static int zfs_fd; +static const char *active_test; /* * Tracks which zfs_ioc_t commands were tested */ -boolean_t ioc_tested[ZFS_IOC_LAST - ZFS_IOC_FIRST]; +static boolean_t ioc_tested[ZFS_IOC_LAST - ZFS_IOC_FIRST]; /* * Legacy ioctls that are skipped (for now) */ -static unsigned ioc_skip[] = { +static const zfs_ioc_t ioc_skip[] = { ZFS_IOC_POOL_CREATE, ZFS_IOC_POOL_DESTROY, ZFS_IOC_POOL_IMPORT, diff --git a/tests/zfs-tests/cmd/mkbusy/mkbusy.c b/tests/zfs-tests/cmd/mkbusy/mkbusy.c index c32f1ecdc..835dc5a02 100644 --- a/tests/zfs-tests/cmd/mkbusy/mkbusy.c +++ b/tests/zfs-tests/cmd/mkbusy/mkbusy.c @@ -24,7 +24,7 @@ #include <sys/stat.h> #include <fcntl.h> #include <dirent.h> -#include <strings.h> +#include <string.h> #include <stdlib.h> #include <unistd.h> #include <errno.h> diff --git a/tests/zfs-tests/cmd/nvlist_to_lua/nvlist_to_lua.c b/tests/zfs-tests/cmd/nvlist_to_lua/nvlist_to_lua.c index 3072ca979..4d2abfeb1 100644 --- a/tests/zfs-tests/cmd/nvlist_to_lua/nvlist_to_lua.c +++ b/tests/zfs-tests/cmd/nvlist_to_lua/nvlist_to_lua.c @@ -20,13 +20,12 @@ #include <stdio.h> #include <stdlib.h> #include <string.h> -#include <strings.h> #include <libzfs_core.h> #include <sys/nvpair.h> -nvlist_t *nvl; -const char *pool; -boolean_t unexpected_failures; +static nvlist_t *nvl; +static const char *pool; +static boolean_t unexpected_failures; static boolean_t nvlist_equal(nvlist_t *nvla, nvlist_t *nvlb) diff --git a/tests/zfs-tests/cmd/rename_dir/rename_dir.c b/tests/zfs-tests/cmd/rename_dir/rename_dir.c index 897ec7b84..3c3f45146 100644 --- a/tests/zfs-tests/cmd/rename_dir/rename_dir.c +++ b/tests/zfs-tests/cmd/rename_dir/rename_dir.c @@ -46,7 +46,6 @@ #include <stdlib.h> #include <unistd.h> #include <stdio.h> -#include <strings.h> int main(void) @@ -58,6 +57,7 @@ main(void) perror("fork"); exit(1); break; + case 0: while (i > 0) { int c_count = 0; @@ -65,11 +65,11 @@ main(void) c_count++; if (rename("1/2/3/c", "a/b/c") == 0) c_count++; - if (c_count) { + if (c_count) (void) fprintf(stderr, "c_count: %d", c_count); - } } - break; + _exit(0); + default: while (i > 0) { int p_count = 0; @@ -77,12 +77,9 @@ main(void) p_count++; if (rename("a/b/c/d/e/1", "1") == 0) p_count++; - if (p_count) { + if (p_count) (void) fprintf(stderr, "p_count: %d", p_count); - } } - break; + return (0); } - - return (0); } diff --git a/tests/zfs-tests/cmd/rm_lnkcnt_zero_file/rm_lnkcnt_zero_file.c b/tests/zfs-tests/cmd/rm_lnkcnt_zero_file/rm_lnkcnt_zero_file.c index f8b6e3e80..9aeabb08e 100644 --- a/tests/zfs-tests/cmd/rm_lnkcnt_zero_file/rm_lnkcnt_zero_file.c +++ b/tests/zfs-tests/cmd/rm_lnkcnt_zero_file/rm_lnkcnt_zero_file.c @@ -45,7 +45,6 @@ #include <sys/stat.h> #include <stdlib.h> #include <unistd.h> -#include <strings.h> static char *filebase; diff --git a/tests/zfs-tests/tests/functional/checksum/skein_test.c b/tests/zfs-tests/tests/functional/checksum/skein_test.c index aff9fec43..99b47b453 100644 --- a/tests/zfs-tests/tests/functional/checksum/skein_test.c +++ b/tests/zfs-tests/tests/functional/checksum/skein_test.c @@ -34,7 +34,7 @@ #include <sys/skein.h> #include <stdlib.h> -#include <strings.h> +#include <string.h> #include <stdio.h> #include <sys/time.h> #include <sys/stdtypes.h> diff --git a/tests/zfs-tests/tests/functional/ctime/ctime.c b/tests/zfs-tests/tests/functional/ctime/ctime.c index 41dcf6abc..cb2be72ee 100644 --- a/tests/zfs-tests/tests/functional/ctime/ctime.c +++ b/tests/zfs-tests/tests/functional/ctime/ctime.c @@ -38,7 +38,6 @@ #include <stdio.h> #include <stdlib.h> #include <unistd.h> -#include <strings.h> #include <errno.h> #include <fcntl.h> #include <libgen.h> diff --git a/tests/zfs-tests/tests/functional/hkdf/hkdf_test.c b/tests/zfs-tests/tests/functional/hkdf/hkdf_test.c index e280af69b..473a9ba9a 100644 --- a/tests/zfs-tests/tests/functional/hkdf/hkdf_test.c +++ b/tests/zfs-tests/tests/functional/hkdf/hkdf_test.c @@ -18,13 +18,11 @@ */ #include <stdio.h> -#include <strings.h> +#include <string.h> #include <sys/crypto/icp.h> #include <sys/sha2.h> #include <sys/hkdf.h> -#define NELEMS(x) (sizeof (x) / sizeof ((x)[0])) - /* * Byte arrays are given as char pointers so that they * can be specified as strings. @@ -214,7 +212,7 @@ main(void) icp_init(); - for (i = 0; i < NELEMS(test_vectors); i++) { + for (i = 0; i < ARRAY_SIZE(test_vectors); i++) { ret = run_test(i, &test_vectors[i]); if (ret != 0) break; |