From d465fc584425c618f8baa13a31b70ffabe053484 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=D0=BD=D0=B0=D0=B1?= Date: Sat, 22 Jan 2022 01:56:46 +0100 Subject: [PATCH] Forbid b{copy,zero,cmp}(). Don't include for MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Reviewed-by: Brian Behlendorf Signed-off-by: Ahelenia ZiemiaƄska Closes #12996 --- cmd/zed/agents/fmd_api.c | 2 +- cmd/zed/agents/fmd_serd.c | 2 +- cmd/zed/agents/zfs_diagnosis.c | 1 - cmd/zfs/zfs_iter.c | 1 - cmd/zfs/zfs_main.c | 2 +- cmd/zfs/zfs_project.c | 2 +- cmd/zinject/translate.c | 3 +- cmd/zinject/zinject.c | 3 +- cmd/zpool/zpool_iter.c | 2 +- cmd/zpool/zpool_util.c | 2 +- cmd/zstream/zstream.c | 2 +- cmd/zstream/zstream_dump.c | 2 +- cmd/zstream/zstream_redup.c | 2 +- cmd/zstream/zstream_token.c | 2 +- config/Rules.am | 3 ++ include/os/freebsd/spl/sys/Makefile.am | 1 - include/os/freebsd/spl/sys/strings.h | 1 - include/os/linux/spl/sys/Makefile.am | 2 +- include/os/linux/spl/sys/string.h | 1 + include/os/linux/spl/sys/strings.h | 30 ----------------- include/sys/xvattr.h | 2 +- include/sys/zfs_context.h | 3 +- lib/libefi/rdwr_efi.c | 1 - lib/libnvpair/libnvpair_json.c | 2 +- lib/libshare/libshare.c | 2 +- lib/libshare/os/freebsd/smb.c | 1 - lib/libshare/os/linux/nfs.c | 1 - lib/libshare/os/linux/smb.c | 1 - lib/libspl/include/sys/Makefile.am | 2 +- lib/libspl/include/sys/string.h | 1 + lib/libspl/include/sys/strings.h | 33 ------------------- lib/libzfs/libzfs_iter.c | 2 +- lib/libzfs/libzfs_mount.c | 2 +- lib/libzfs/libzfs_sendrecv.c | 2 +- lib/libzfs/os/linux/libzfs_mount_os.c | 2 +- lib/libzfs/os/linux/libzfs_pool_os.c | 2 +- module/icp/algs/edonr/edonr.c | 2 +- module/icp/algs/skein/skein_impl.h | 2 +- module/nvpair/nvpair.c | 4 +-- module/os/freebsd/spl/acl_common.c | 1 - module/os/freebsd/zfs/crypto_os.c | 2 -- module/os/linux/spl/spl-generic.c | 2 +- module/os/linux/zfs/zfs_uio.c | 2 +- module/unicode/u8_textprep.c | 2 +- module/zcommon/zfs_deleg.c | 2 +- module/zcommon/zfs_fletcher_aarch64_neon.c | 2 +- module/zcommon/zfs_fletcher_avx512.c | 2 +- module/zcommon/zfs_fletcher_intel.c | 2 +- module/zcommon/zfs_fletcher_sse.c | 2 +- module/zcommon/zfs_fletcher_superscalar.c | 2 +- module/zcommon/zfs_fletcher_superscalar4.c | 2 +- module/zfs/gzip.c | 1 - tests/zfs-tests/cmd/file_common.h | 2 +- .../libzfs_input_check/libzfs_input_check.c | 11 +++---- tests/zfs-tests/cmd/mkbusy/mkbusy.c | 2 +- .../cmd/nvlist_to_lua/nvlist_to_lua.c | 7 ++-- tests/zfs-tests/cmd/rename_dir/rename_dir.c | 15 ++++----- .../rm_lnkcnt_zero_file/rm_lnkcnt_zero_file.c | 1 - .../tests/functional/checksum/skein_test.c | 2 +- .../zfs-tests/tests/functional/ctime/ctime.c | 1 - .../tests/functional/hkdf/hkdf_test.c | 6 ++-- 61 files changed, 63 insertions(+), 141 deletions(-) delete mode 100644 include/os/freebsd/spl/sys/strings.h create mode 100644 include/os/linux/spl/sys/string.h delete mode 100644 include/os/linux/spl/sys/strings.h create mode 100644 lib/libspl/include/sys/string.h delete mode 100644 lib/libspl/include/sys/strings.h diff --git a/cmd/zed/agents/fmd_api.c b/cmd/zed/agents/fmd_api.c index 24d6d357e..d97f67b4f 100644 --- a/cmd/zed/agents/fmd_api.c +++ b/cmd/zed/agents/fmd_api.c @@ -38,7 +38,7 @@ #include #include #include -#include +#include #include #include "fmd_api.h" diff --git a/cmd/zed/agents/fmd_serd.c b/cmd/zed/agents/fmd_serd.c index 497dffe7f..94736ce42 100644 --- a/cmd/zed/agents/fmd_serd.c +++ b/cmd/zed/agents/fmd_serd.c @@ -29,7 +29,7 @@ #include #include #include -#include +#include #include #include diff --git a/cmd/zed/agents/zfs_diagnosis.c b/cmd/zed/agents/zfs_diagnosis.c index 3e45a957f..4fe9ee2bc 100644 --- a/cmd/zed/agents/zfs_diagnosis.c +++ b/cmd/zed/agents/zfs_diagnosis.c @@ -27,7 +27,6 @@ #include #include -#include #include #include #include diff --git a/cmd/zfs/zfs_iter.c b/cmd/zfs/zfs_iter.c index 8b6a49a79..d44bc2ad7 100644 --- a/cmd/zfs/zfs_iter.c +++ b/cmd/zfs/zfs_iter.c @@ -32,7 +32,6 @@ #include #include #include -#include #include diff --git a/cmd/zfs/zfs_main.c b/cmd/zfs/zfs_main.c index 36df2e8f4..938fd2edd 100644 --- a/cmd/zfs/zfs_main.c +++ b/cmd/zfs/zfs_main.c @@ -46,7 +46,7 @@ #include #include #include -#include +#include #include #include #include diff --git a/cmd/zfs/zfs_project.c b/cmd/zfs/zfs_project.c index 341cc005d..757d04358 100644 --- a/cmd/zfs/zfs_project.c +++ b/cmd/zfs/zfs_project.c @@ -27,7 +27,7 @@ #include #include #include -#include +#include #include #include #include diff --git a/cmd/zinject/translate.c b/cmd/zinject/translate.c index 4939c0b85..2b5f1fcd9 100644 --- a/cmd/zinject/translate.c +++ b/cmd/zinject/translate.c @@ -31,7 +31,7 @@ #include #include #include -#include +#include #include #include #include @@ -186,6 +186,7 @@ initialize_range(err_type_t type, int level, char *range, switch (type) { default: break; + case TYPE_DATA: break; diff --git a/cmd/zinject/zinject.c b/cmd/zinject/zinject.c index 10d5dbe90..74c54baeb 100644 --- a/cmd/zinject/zinject.c +++ b/cmd/zinject/zinject.c @@ -144,6 +144,7 @@ #include #include #include +#include #include #include @@ -159,7 +160,7 @@ libzfs_handle_t *g_zfs; int zfs_fd; -static const char *errtable[TYPE_INVAL] = { +static const char *const errtable[TYPE_INVAL] = { "data", "dnode", "mos", diff --git a/cmd/zpool/zpool_iter.c b/cmd/zpool/zpool_iter.c index 65e53f8e0..ec3f768e3 100644 --- a/cmd/zpool/zpool_iter.c +++ b/cmd/zpool/zpool_iter.c @@ -32,7 +32,7 @@ #include #include #include -#include +#include #include #include diff --git a/cmd/zpool/zpool_util.c b/cmd/zpool/zpool_util.c index 1c64c83d8..91dbb8ec4 100644 --- a/cmd/zpool/zpool_util.c +++ b/cmd/zpool/zpool_util.c @@ -28,7 +28,7 @@ #include #include #include -#include +#include #include #include "zpool_util.h" diff --git a/cmd/zstream/zstream.c b/cmd/zstream/zstream.c index 523ae0689..a228f45fa 100644 --- a/cmd/zstream/zstream.c +++ b/cmd/zstream/zstream.c @@ -23,7 +23,7 @@ #include #include #include -#include +#include #include #include #include diff --git a/cmd/zstream/zstream_dump.c b/cmd/zstream/zstream_dump.c index 04a4986b4..977256cae 100644 --- a/cmd/zstream/zstream_dump.c +++ b/cmd/zstream/zstream_dump.c @@ -34,7 +34,7 @@ #include #include #include -#include +#include #include #include diff --git a/cmd/zstream/zstream_redup.c b/cmd/zstream/zstream_redup.c index 36431dc1e..20aff17ae 100644 --- a/cmd/zstream/zstream_redup.c +++ b/cmd/zstream/zstream_redup.c @@ -27,7 +27,7 @@ #include #include #include -#include +#include #include #include #include diff --git a/cmd/zstream/zstream_token.c b/cmd/zstream/zstream_token.c index 36a76a4bb..bedb6893c 100644 --- a/cmd/zstream/zstream_token.c +++ b/cmd/zstream/zstream_token.c @@ -34,7 +34,7 @@ #include #include #include -#include +#include #include #include diff --git a/config/Rules.am b/config/Rules.am index cbef12e21..154073848 100644 --- a/config/Rules.am +++ b/config/Rules.am @@ -58,6 +58,9 @@ AM_CPPFLAGS += -D"strtok(...)=strtok(__VA_ARGS__) __attribute__((deprecated(\"Us AM_CPPFLAGS += -D"__xpg_basename(...)=__xpg_basename(__VA_ARGS__) __attribute__((deprecated(\"basename(3) is underspecified. Use zfs_basename() instead!\")))" AM_CPPFLAGS += -D"basename(...)=basename(__VA_ARGS__) __attribute__((deprecated(\"basename(3) is underspecified. Use zfs_basename() instead!\")))" AM_CPPFLAGS += -D"dirname(...)=dirname(__VA_ARGS__) __attribute__((deprecated(\"dirname(3) is underspecified. Use zfs_dirnamelen() instead!\")))" +AM_CPPFLAGS += -D"bcopy(...)=__attribute__((deprecated(\"bcopy(3) is deprecated. Use memcpy(3)/memmove(3) instead!\"))) bcopy(__VA_ARGS__)" +AM_CPPFLAGS += -D"bcmp(...)=__attribute__((deprecated(\"bcmp(3) is deprecated. Use memcmp(3) instead!\"))) bcmp(__VA_ARGS__)" +AM_CPPFLAGS += -D"bzero(...)=__attribute__((deprecated(\"bzero(3) is deprecated. Use memset(3) instead!\"))) bzero(__VA_ARGS__)" if ASAN_ENABLED AM_CPPFLAGS += -DZFS_ASAN_ENABLED diff --git a/include/os/freebsd/spl/sys/Makefile.am b/include/os/freebsd/spl/sys/Makefile.am index 232aaf569..816f73354 100644 --- a/include/os/freebsd/spl/sys/Makefile.am +++ b/include/os/freebsd/spl/sys/Makefile.am @@ -48,7 +48,6 @@ KERNEL_H = \ simd.h \ spl_condvar.h \ string.h \ - strings.h \ sunddi.h \ sysmacros.h \ systeminfo.h \ diff --git a/include/os/freebsd/spl/sys/strings.h b/include/os/freebsd/spl/sys/strings.h deleted file mode 100644 index 651685d30..000000000 --- a/include/os/freebsd/spl/sys/strings.h +++ /dev/null @@ -1 +0,0 @@ -/* do not delete */ diff --git a/include/os/linux/spl/sys/Makefile.am b/include/os/linux/spl/sys/Makefile.am index 48c27f970..0dc9b90c1 100644 --- a/include/os/linux/spl/sys/Makefile.am +++ b/include/os/linux/spl/sys/Makefile.am @@ -33,7 +33,7 @@ KERNEL_H = \ signal.h \ simd.h \ stat.h \ - strings.h \ + string.h \ sunddi.h \ sysmacros.h \ systeminfo.h \ diff --git a/include/os/linux/spl/sys/string.h b/include/os/linux/spl/sys/string.h new file mode 100644 index 000000000..38134dcf4 --- /dev/null +++ b/include/os/linux/spl/sys/string.h @@ -0,0 +1 @@ +#include diff --git a/include/os/linux/spl/sys/strings.h b/include/os/linux/spl/sys/strings.h deleted file mode 100644 index 48e417d14..000000000 --- a/include/os/linux/spl/sys/strings.h +++ /dev/null @@ -1,30 +0,0 @@ -/* - * Copyright (C) 2018 Lawrence Livermore National Security, LLC. - * Produced at Lawrence Livermore National Laboratory (cf, DISCLAIMER). - * UCRL-CODE-235197 - * - * This file is part of the SPL, Solaris Porting Layer. - * - * The SPL is free software; you can redistribute it and/or modify it - * under the terms of the GNU General Public License as published by the - * Free Software Foundation; either version 2 of the License, or (at your - * option) any later version. - * - * The SPL is distributed in the hope that it will be useful, but WITHOUT - * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or - * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License - * for more details. - * - * You should have received a copy of the GNU General Public License along - * with the SPL. If not, see . - */ -#ifndef _SPL_SYS_STRINGS_H -#define _SPL_SYS_STRINGS_H - -#include - -#define bzero(ptr, size) memset(ptr, 0, size) -#define bcopy(src, dest, size) memmove(dest, src, size) -#define bcmp(src, dest, size) memcmp((src), (dest), (size_t)(size)) - -#endif /* _SPL_SYS_STRINGS_H */ diff --git a/include/sys/xvattr.h b/include/sys/xvattr.h index fc9bd6ae5..277c46940 100644 --- a/include/sys/xvattr.h +++ b/include/sys/xvattr.h @@ -40,7 +40,7 @@ #define _SYS_XVATTR_H #include -#include +#include #define AV_SCANSTAMP_SZ 32 /* length of anti-virus scanstamp */ diff --git a/include/sys/zfs_context.h b/include/sys/zfs_context.h index 9d99388be..61a6365f5 100644 --- a/include/sys/zfs_context.h +++ b/include/sys/zfs_context.h @@ -55,7 +55,7 @@ extern "C" { #include #include #include -#include +#include #include #include #include @@ -91,7 +91,6 @@ extern "C" { #include #include #include -#include #include #include #include diff --git a/lib/libefi/rdwr_efi.c b/lib/libefi/rdwr_efi.c index e32c45131..950c9562f 100644 --- a/lib/libefi/rdwr_efi.c +++ b/lib/libefi/rdwr_efi.c @@ -29,7 +29,6 @@ #include #include #include -#include #include #include #include diff --git a/lib/libnvpair/libnvpair_json.c b/lib/libnvpair/libnvpair_json.c index b27f7e4f6..19acea8f5 100644 --- a/lib/libnvpair/libnvpair_json.c +++ b/lib/libnvpair/libnvpair_json.c @@ -15,7 +15,7 @@ #include #include -#include +#include #include #include diff --git a/lib/libshare/libshare.c b/lib/libshare/libshare.c index a228645fb..7bc31d7a6 100644 --- a/lib/libshare/libshare.c +++ b/lib/libshare/libshare.c @@ -27,8 +27,8 @@ #include #include +#include #include -#include #include #include #include diff --git a/lib/libshare/os/freebsd/smb.c b/lib/libshare/os/freebsd/smb.c index a25990d3b..445784b75 100644 --- a/lib/libshare/os/freebsd/smb.c +++ b/lib/libshare/os/freebsd/smb.c @@ -27,7 +27,6 @@ #include #include #include -#include #include #include #include diff --git a/lib/libshare/os/linux/nfs.c b/lib/libshare/os/linux/nfs.c index 002c5e24c..5acfa3fb8 100644 --- a/lib/libshare/os/linux/nfs.c +++ b/lib/libshare/os/linux/nfs.c @@ -29,7 +29,6 @@ #include #include #include -#include #include #include #include diff --git a/lib/libshare/os/linux/smb.c b/lib/libshare/os/linux/smb.c index 312ffb97d..bcb9b4270 100644 --- a/lib/libshare/os/linux/smb.c +++ b/lib/libshare/os/linux/smb.c @@ -50,7 +50,6 @@ #include #include #include -#include #include #include #include diff --git a/lib/libspl/include/sys/Makefile.am b/lib/libspl/include/sys/Makefile.am index 6816a0125..8305a5180 100644 --- a/lib/libspl/include/sys/Makefile.am +++ b/lib/libspl/include/sys/Makefile.am @@ -29,7 +29,7 @@ libspl_HEADERS = \ simd.h \ stack.h \ stdtypes.h \ - strings.h \ + string.h \ stropts.h \ sunddi.h \ systeminfo.h \ diff --git a/lib/libspl/include/sys/string.h b/lib/libspl/include/sys/string.h new file mode 100644 index 000000000..3b2f59002 --- /dev/null +++ b/lib/libspl/include/sys/string.h @@ -0,0 +1 @@ +#include diff --git a/lib/libspl/include/sys/strings.h b/lib/libspl/include/sys/strings.h deleted file mode 100644 index c142047dc..000000000 --- a/lib/libspl/include/sys/strings.h +++ /dev/null @@ -1,33 +0,0 @@ -/* - * CDDL HEADER START - * - * The contents of this file are subject to the terms of the - * Common Development and Distribution License, Version 1.0 only - * (the "License"). You may not use this file except in compliance - * with the License. - * - * You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE - * or http://www.opensolaris.org/os/licensing. - * See the License for the specific language governing permissions - * and limitations under the License. - * - * When distributing Covered Code, include this CDDL HEADER in each - * file and include the License file at usr/src/OPENSOLARIS.LICENSE. - * If applicable, add the following below this CDDL HEADER, with the - * fields enclosed by brackets "[]" replaced with your own identifying - * information: Portions Copyright [yyyy] [name of copyright owner] - * - * CDDL HEADER END - */ -/* - * Copyright 2006 Sun Microsystems, Inc. All rights reserved. - * Use is subject to license terms. - */ - -#ifndef _LIBSPL_SYS_STRINGS_H -#define _LIBSPL_SYS_STRINGS_H - -#include -#include - -#endif diff --git a/lib/libzfs/libzfs_iter.c b/lib/libzfs/libzfs_iter.c index 3c537be79..132454886 100644 --- a/lib/libzfs/libzfs_iter.c +++ b/lib/libzfs/libzfs_iter.c @@ -28,7 +28,7 @@ #include #include -#include +#include #include #include #include diff --git a/lib/libzfs/libzfs_mount.c b/lib/libzfs/libzfs_mount.c index 62c46be95..794fd2f29 100644 --- a/lib/libzfs/libzfs_mount.c +++ b/lib/libzfs/libzfs_mount.c @@ -74,7 +74,7 @@ #include #include #include -#include +#include #include #include #include diff --git a/lib/libzfs/libzfs_sendrecv.c b/lib/libzfs/libzfs_sendrecv.c index 2d866dfa7..4e805c575 100644 --- a/lib/libzfs/libzfs_sendrecv.c +++ b/lib/libzfs/libzfs_sendrecv.c @@ -38,7 +38,7 @@ #include #include #include -#include +#include #include #include #include diff --git a/lib/libzfs/os/linux/libzfs_mount_os.c b/lib/libzfs/os/linux/libzfs_mount_os.c index 1b01caeb7..eab068d59 100644 --- a/lib/libzfs/os/linux/libzfs_mount_os.c +++ b/lib/libzfs/os/linux/libzfs_mount_os.c @@ -37,7 +37,7 @@ #include #include #include -#include +#include #include #include #include diff --git a/lib/libzfs/os/linux/libzfs_pool_os.c b/lib/libzfs/os/linux/libzfs_pool_os.c index 4484a57d3..147efbc0e 100644 --- a/lib/libzfs/os/linux/libzfs_pool_os.c +++ b/lib/libzfs/os/linux/libzfs_pool_os.c @@ -34,7 +34,7 @@ #include #include #include -#include +#include #include #include #include diff --git a/module/icp/algs/edonr/edonr.c b/module/icp/algs/edonr/edonr.c index dcf63fc18..6f3a43e26 100644 --- a/module/icp/algs/edonr/edonr.c +++ b/module/icp/algs/edonr/edonr.c @@ -35,7 +35,7 @@ * cryptographic use. Users of Edon-R must interface directly to this module. */ -#include +#include #include #include diff --git a/module/icp/algs/skein/skein_impl.h b/module/icp/algs/skein/skein_impl.h index 1fa249e95..eff19ce83 100644 --- a/module/icp/algs/skein/skein_impl.h +++ b/module/icp/algs/skein/skein_impl.h @@ -25,7 +25,7 @@ #define _SKEIN_IMPL_H_ #include -#include +#include #include "skein_impl.h" #include "skein_port.h" diff --git a/module/nvpair/nvpair.c b/module/nvpair/nvpair.c index 53b4f7e5c..a5222dac7 100644 --- a/module/nvpair/nvpair.c +++ b/module/nvpair/nvpair.c @@ -40,7 +40,7 @@ #include #include #include -#include +#include #include #include @@ -53,7 +53,7 @@ #include #endif -#define skip_whitespace(p) while ((*(p) == ' ') || (*(p) == '\t')) p++ +#define skip_whitespace(p) while ((*(p) == ' ') || (*(p) == '\t')) (p)++ /* * nvpair.c - Provides kernel & userland interfaces for manipulating diff --git a/module/os/freebsd/spl/acl_common.c b/module/os/freebsd/spl/acl_common.c index 718d0de8b..334a8b463 100644 --- a/module/os/freebsd/spl/acl_common.c +++ b/module/os/freebsd/spl/acl_common.c @@ -37,7 +37,6 @@ #include #include #include -#include #include #include #include diff --git a/module/os/freebsd/zfs/crypto_os.c b/module/os/freebsd/zfs/crypto_os.c index ddb95b0d8..c4d5f8761 100644 --- a/module/os/freebsd/zfs/crypto_os.c +++ b/module/os/freebsd/zfs/crypto_os.c @@ -39,8 +39,6 @@ __FBSDID("$FreeBSD$"); #include #include #include -#else -#include #endif #include diff --git a/module/os/linux/spl/spl-generic.c b/module/os/linux/spl/spl-generic.c index bf83d2fc2..cc9a973fe 100644 --- a/module/os/linux/spl/spl-generic.c +++ b/module/os/linux/spl/spl-generic.c @@ -42,7 +42,7 @@ #include #include #include -#include +#include #include #include #include diff --git a/module/os/linux/zfs/zfs_uio.c b/module/os/linux/zfs/zfs_uio.c index 1b315c270..ce47b3e60 100644 --- a/module/os/linux/zfs/zfs_uio.c +++ b/module/os/linux/zfs/zfs_uio.c @@ -44,7 +44,7 @@ #include #include #include -#include +#include #include #include diff --git a/module/unicode/u8_textprep.c b/module/unicode/u8_textprep.c index 863f69f7b..b6b07b245 100644 --- a/module/unicode/u8_textprep.c +++ b/module/unicode/u8_textprep.c @@ -36,7 +36,7 @@ */ #include -#include +#include #include #include #include diff --git a/module/zcommon/zfs_deleg.c b/module/zcommon/zfs_deleg.c index 8a4a6ca86..acd2feca3 100644 --- a/module/zcommon/zfs_deleg.c +++ b/module/zcommon/zfs_deleg.c @@ -36,7 +36,7 @@ #include #include #endif -#include +#include #include #include "zfs_prop.h" #include "zfs_deleg.h" diff --git a/module/zcommon/zfs_fletcher_aarch64_neon.c b/module/zcommon/zfs_fletcher_aarch64_neon.c index 319c5332d..3e14875d6 100644 --- a/module/zcommon/zfs_fletcher_aarch64_neon.c +++ b/module/zcommon/zfs_fletcher_aarch64_neon.c @@ -45,7 +45,7 @@ #include #include -#include +#include #include ZFS_NO_SANITIZE_UNDEFINED diff --git a/module/zcommon/zfs_fletcher_avx512.c b/module/zcommon/zfs_fletcher_avx512.c index 9166834f5..713806d28 100644 --- a/module/zcommon/zfs_fletcher_avx512.c +++ b/module/zcommon/zfs_fletcher_avx512.c @@ -27,7 +27,7 @@ #include #include #include -#include +#include #include #include diff --git a/module/zcommon/zfs_fletcher_intel.c b/module/zcommon/zfs_fletcher_intel.c index 15bfe3cc3..42b6309d3 100644 --- a/module/zcommon/zfs_fletcher_intel.c +++ b/module/zcommon/zfs_fletcher_intel.c @@ -43,8 +43,8 @@ #if defined(HAVE_AVX) && defined(HAVE_AVX2) #include +#include #include -#include #include ZFS_NO_SANITIZE_UNDEFINED diff --git a/module/zcommon/zfs_fletcher_sse.c b/module/zcommon/zfs_fletcher_sse.c index 3ee679965..791bbd49f 100644 --- a/module/zcommon/zfs_fletcher_sse.c +++ b/module/zcommon/zfs_fletcher_sse.c @@ -45,8 +45,8 @@ #include #include +#include #include -#include #include ZFS_NO_SANITIZE_UNDEFINED diff --git a/module/zcommon/zfs_fletcher_superscalar.c b/module/zcommon/zfs_fletcher_superscalar.c index dec3c1750..ba3fb54cb 100644 --- a/module/zcommon/zfs_fletcher_superscalar.c +++ b/module/zcommon/zfs_fletcher_superscalar.c @@ -44,7 +44,7 @@ #include #include #include -#include +#include #include ZFS_NO_SANITIZE_UNDEFINED diff --git a/module/zcommon/zfs_fletcher_superscalar4.c b/module/zcommon/zfs_fletcher_superscalar4.c index 9e69dc30e..e3eda0295 100644 --- a/module/zcommon/zfs_fletcher_superscalar4.c +++ b/module/zcommon/zfs_fletcher_superscalar4.c @@ -44,7 +44,7 @@ #include #include #include -#include +#include #include ZFS_NO_SANITIZE_UNDEFINED diff --git a/module/zfs/gzip.c b/module/zfs/gzip.c index f2a7b6d83..6282229c8 100644 --- a/module/zfs/gzip.c +++ b/module/zfs/gzip.c @@ -28,7 +28,6 @@ #include #include -#include #include #include 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 #include #include -#include +#include #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 #include #include -#include #include #include @@ -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 #include #include -#include +#include #include #include #include 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 #include #include -#include #include #include -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 #include #include -#include 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 #include #include -#include 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 #include -#include +#include #include #include #include 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 #include #include -#include #include #include #include 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 -#include +#include #include #include #include -#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;