diff --git a/cmd/zdb/zdb.c b/cmd/zdb/zdb.c index 18a94da1f7..ecf044090d 100644 --- a/cmd/zdb/zdb.c +++ b/cmd/zdb/zdb.c @@ -128,7 +128,7 @@ uint8_t dump_opt[256]; typedef void object_viewer_t(objset_t *, uint64_t, void *data, size_t size); -uint64_t *zopt_metaslab = NULL; +static uint64_t *zopt_metaslab = NULL; static unsigned zopt_metaslab_args = 0; typedef struct zopt_object_range { @@ -136,7 +136,8 @@ typedef struct zopt_object_range { uint64_t zor_obj_end; uint64_t zor_flags; } zopt_object_range_t; -zopt_object_range_t *zopt_object_ranges = NULL; + +static zopt_object_range_t *zopt_object_ranges = NULL; static unsigned zopt_object_args = 0; static int flagbits[256]; @@ -160,7 +161,7 @@ static int flagbits[256]; #define ZDB_FLAG_PRINT_BLKPTR 0x0040 #define ZDB_FLAG_VERBOSE 0x0080 -uint64_t max_inflight_bytes = 256 * 1024 * 1024; /* 256MB */ +static uint64_t max_inflight_bytes = 256 * 1024 * 1024; /* 256MB */ static int leaked_objects = 0; static range_tree_t *mos_refd_objs; diff --git a/cmd/zstream/zstream_dump.c b/cmd/zstream/zstream_dump.c index 4b562c2373..9955a1361e 100644 --- a/cmd/zstream/zstream_dump.c +++ b/cmd/zstream/zstream_dump.c @@ -54,10 +54,10 @@ */ #define DUMP_GROUPING 4 -uint64_t total_stream_len = 0; -FILE *send_stream = 0; -boolean_t do_byteswap = B_FALSE; -boolean_t do_cksum = B_TRUE; +static uint64_t total_stream_len = 0; +static FILE *send_stream = 0; +static boolean_t do_byteswap = B_FALSE; +static boolean_t do_cksum = B_TRUE; void * safe_malloc(size_t size) diff --git a/cmd/ztest.c b/cmd/ztest.c index b89cdde9ed..a8f9e6b876 100644 --- a/cmd/ztest.c +++ b/cmd/ztest.c @@ -423,11 +423,11 @@ ztest_func_t ztest_fletcher; ztest_func_t ztest_fletcher_incr; ztest_func_t ztest_verify_dnode_bt; -uint64_t zopt_always = 0ULL * NANOSEC; /* all the time */ -uint64_t zopt_incessant = 1ULL * NANOSEC / 10; /* every 1/10 second */ -uint64_t zopt_often = 1ULL * NANOSEC; /* every second */ -uint64_t zopt_sometimes = 10ULL * NANOSEC; /* every 10 seconds */ -uint64_t zopt_rarely = 60ULL * NANOSEC; /* every 60 seconds */ +static uint64_t zopt_always = 0ULL * NANOSEC; /* all the time */ +static uint64_t zopt_incessant = 1ULL * NANOSEC / 10; /* every 1/10 second */ +static uint64_t zopt_often = 1ULL * NANOSEC; /* every second */ +static uint64_t zopt_sometimes = 10ULL * NANOSEC; /* every 10 seconds */ +static uint64_t zopt_rarely = 60ULL * NANOSEC; /* every 60 seconds */ #define ZTI_INIT(func, iters, interval) \ { .zi_func = (func), \ @@ -435,7 +435,7 @@ uint64_t zopt_rarely = 60ULL * NANOSEC; /* every 60 seconds */ .zi_interval = (interval), \ .zi_funcname = # func } -ztest_info_t ztest_info[] = { +static ztest_info_t ztest_info[] = { ZTI_INIT(ztest_dmu_read_write, 1, &zopt_always), ZTI_INIT(ztest_dmu_write_parallel, 10, &zopt_always), ZTI_INIT(ztest_dmu_object_alloc_free, 1, &zopt_always), @@ -515,7 +515,7 @@ typedef struct ztest_shared { static char ztest_dev_template[] = "%s/%s.%llua"; static char ztest_aux_template[] = "%s/%s.%s.%llu"; -ztest_shared_t *ztest_shared; +static ztest_shared_t *ztest_shared; static spa_t *ztest_spa = NULL; static ztest_ds_t *ztest_ds; @@ -2346,7 +2346,7 @@ ztest_replay_setattr(void *arg1, void *arg2, boolean_t byteswap) return (0); } -zil_replay_func_t *ztest_replay_vector[TX_MAX_TYPE] = { +static zil_replay_func_t *ztest_replay_vector[TX_MAX_TYPE] = { NULL, /* 0 no such transaction type */ ztest_replay_create, /* TX_CREATE */ NULL, /* TX_MKDIR */ diff --git a/module/os/linux/spl/spl-condvar.c b/module/os/linux/spl/spl-condvar.c index d0461a9f12..e87954714e 100644 --- a/module/os/linux/spl/spl-condvar.c +++ b/module/os/linux/spl/spl-condvar.c @@ -37,7 +37,7 @@ #endif #define MAX_HRTIMEOUT_SLACK_US 1000 -unsigned int spl_schedule_hrtimeout_slack_us = 0; +static unsigned int spl_schedule_hrtimeout_slack_us = 0; static int param_set_hrtimeout_slack(const char *buf, zfs_kernel_param_t *kp) diff --git a/module/os/linux/spl/spl-err.c b/module/os/linux/spl/spl-err.c index 7d3f6127c4..29781b9515 100644 --- a/module/os/linux/spl/spl-err.c +++ b/module/os/linux/spl/spl-err.c @@ -32,7 +32,7 @@ * analysis and other such goodies. * But we would still default to the current default of not to do that. */ -unsigned int spl_panic_halt; +static unsigned int spl_panic_halt; /* CSTYLED */ module_param(spl_panic_halt, uint, 0644); MODULE_PARM_DESC(spl_panic_halt, "Cause kernel panic on assertion failures"); diff --git a/module/os/linux/spl/spl-generic.c b/module/os/linux/spl/spl-generic.c index 6efaec592b..e3aa900ba6 100644 --- a/module/os/linux/spl/spl-generic.c +++ b/module/os/linux/spl/spl-generic.c @@ -90,7 +90,7 @@ EXPORT_SYMBOL(p0); * and use them when in_interrupt() from linux/preempt_mask.h evaluates to * true. */ -void __percpu *spl_pseudo_entropy; +static void __percpu *spl_pseudo_entropy; /* * spl_rand_next()/spl_rand_jump() are copied from the following CC-0 licensed diff --git a/module/os/linux/spl/spl-kmem-cache.c b/module/os/linux/spl/spl-kmem-cache.c index e355e2bfc3..edd04783b3 100644 --- a/module/os/linux/spl/spl-kmem-cache.c +++ b/module/os/linux/spl/spl-kmem-cache.c @@ -151,7 +151,7 @@ MODULE_PARM_DESC(spl_kmem_cache_kmem_threads, struct list_head spl_kmem_cache_list; /* List of caches */ struct rw_semaphore spl_kmem_cache_sem; /* Cache list lock */ -taskq_t *spl_kmem_cache_taskq; /* Task queue for aging / reclaim */ +static taskq_t *spl_kmem_cache_taskq; /* Task queue for aging / reclaim */ static void spl_cache_shrink(spl_kmem_cache_t *skc, void *obj); diff --git a/module/os/linux/zfs/abd_os.c b/module/os/linux/zfs/abd_os.c index 2ab85f8ccc..fcdd768522 100644 --- a/module/os/linux/zfs/abd_os.c +++ b/module/os/linux/zfs/abd_os.c @@ -132,7 +132,7 @@ static abd_stats_t abd_stats = { { "scatter_sg_table_retry", KSTAT_DATA_UINT64 }, }; -struct { +static struct { wmsum_t abdstat_struct_size; wmsum_t abdstat_linear_cnt; wmsum_t abdstat_linear_data_size; diff --git a/module/os/linux/zfs/zfs_debug.c b/module/os/linux/zfs/zfs_debug.c index 819416b68d..e5a6002506 100644 --- a/module/os/linux/zfs/zfs_debug.c +++ b/module/os/linux/zfs/zfs_debug.c @@ -35,7 +35,7 @@ typedef struct zfs_dbgmsg { static procfs_list_t zfs_dbgmsgs; static uint_t zfs_dbgmsg_size = 0; -uint_t zfs_dbgmsg_maxsize = 4<<20; /* 4MB */ +static uint_t zfs_dbgmsg_maxsize = 4<<20; /* 4MB */ /* * Internal ZFS debug messages are enabled by default. diff --git a/module/os/linux/zfs/zvol_os.c b/module/os/linux/zfs/zvol_os.c index 0d4e0dcd5a..d76bab3c01 100644 --- a/module/os/linux/zfs/zvol_os.c +++ b/module/os/linux/zfs/zvol_os.c @@ -114,7 +114,7 @@ struct zvol_state_os { boolean_t use_blk_mq; }; -taskq_t *zvol_taskq; +static taskq_t *zvol_taskq; static struct ida zvol_ida; typedef struct zv_request_stack { diff --git a/module/zfs/zio.c b/module/zfs/zio.c index dce94b7b29..3f6847a236 100644 --- a/module/zfs/zio.c +++ b/module/zfs/zio.c @@ -3360,7 +3360,7 @@ zio_ddt_write(zio_t *zio) return (zio); } -ddt_entry_t *freedde; /* for debugging */ +static ddt_entry_t *freedde; /* for debugging */ static zio_t * zio_ddt_free(zio_t *zio) diff --git a/module/zfs/zio_compress.c b/module/zfs/zio_compress.c index 4c9cbc9620..0fb91ac815 100644 --- a/module/zfs/zio_compress.c +++ b/module/zfs/zio_compress.c @@ -44,7 +44,7 @@ * If nonzero, every 1/X decompression attempts will fail, simulating * an undetected memory error. */ -unsigned long zio_decompress_fail_fraction = 0; +static unsigned long zio_decompress_fail_fraction = 0; /* * Compression vectors. diff --git a/tests/zfs-tests/cmd/btree_test.c b/tests/zfs-tests/cmd/btree_test.c index fb9de9c777..9a34bf559b 100644 --- a/tests/zfs-tests/cmd/btree_test.c +++ b/tests/zfs-tests/cmd/btree_test.c @@ -23,11 +23,11 @@ #define BUFSIZE 256 -int seed = 0; -int stress_timeout = 180; -int contents_frequency = 100; -int tree_limit = 64 * 1024; -boolean_t stress_only = B_FALSE; +static int seed = 0; +static int stress_timeout = 180; +static int contents_frequency = 100; +static int tree_limit = 64 * 1024; +static boolean_t stress_only = B_FALSE; static void usage(int exit_value) diff --git a/tests/zfs-tests/cmd/checksum/edonr_test.c b/tests/zfs-tests/cmd/checksum/edonr_test.c index 3a0a48533c..d010fbfcd4 100644 --- a/tests/zfs-tests/cmd/checksum/edonr_test.c +++ b/tests/zfs-tests/cmd/checksum/edonr_test.c @@ -40,16 +40,16 @@ * Test messages from: * http://csrc.nist.gov/groups/ST/toolkit/documents/Examples/SHA_All.pdf */ -const char *test_msg0 = "abc"; -const char *test_msg1 = "abcdbcdecdefdefgefghfghighijhijkijkljklmklmn" - "lmnomnopnopq"; -const char *test_msg2 = "abcdefghbcdefghicdefghijdefghijkefghijklfghi" - "jklmghijklmnhijklmnoijklmnopjklmnopqklmnopqrlmnopqrsmnopqrstnopqrstu"; +static const char *test_msg0 = "abc"; +static const char *test_msg1 = "abcdbcdecdefdefgefghfghighijhijkijkljklmklm" + "nlmnomnopnopq"; +static const char *test_msg2 = "abcdefghbcdefghicdefghijdefghijkefghijklfgh" + "ijklmghijklmnhijklmnoijklmnopjklmnopqklmnopqrlmnopqrsmnopqrstnopqrstu"; /* * Test digests computed by hand. There's no formal standard or spec for edonr. */ -const uint8_t edonr_224_test_digests[][28] = { +static const uint8_t edonr_224_test_digests[][28] = { { /* for test_msg0 */ 0x56, 0x63, 0xc4, 0x93, 0x95, 0x20, 0xfa, 0xf6, @@ -67,7 +67,7 @@ const uint8_t edonr_224_test_digests[][28] = { /* no test vector for test_msg2 */ }; -const uint8_t edonr_256_test_digests[][32] = { +static const uint8_t edonr_256_test_digests[][32] = { { /* for test_msg0 */ 0x54, 0xd7, 0x8b, 0x13, 0xc7, 0x4e, 0xda, 0x5a, @@ -85,7 +85,7 @@ const uint8_t edonr_256_test_digests[][32] = { /* no test vectorfor test_msg2 */ }; -const uint8_t edonr_384_test_digests[][48] = { +static const uint8_t edonr_384_test_digests[][48] = { { /* for test_msg0 */ 0x0e, 0x7c, 0xd7, 0x85, 0x78, 0x77, 0xe0, 0x89, @@ -110,7 +110,7 @@ const uint8_t edonr_384_test_digests[][48] = { } }; -const uint8_t edonr_512_test_digests[][64] = { +static const uint8_t edonr_512_test_digests[][64] = { { /* for test_msg0 */ 0x1b, 0x14, 0xdb, 0x15, 0x5f, 0x1d, 0x40, 0x65, diff --git a/tests/zfs-tests/cmd/checksum/sha2_test.c b/tests/zfs-tests/cmd/checksum/sha2_test.c index bb35531109..d99e8757a2 100644 --- a/tests/zfs-tests/cmd/checksum/sha2_test.c +++ b/tests/zfs-tests/cmd/checksum/sha2_test.c @@ -44,17 +44,17 @@ * http://csrc.nist.gov/groups/ST/toolkit/documents/Examples/SHA_All.pdf */ -const char *test_msg0 = "abc"; -const char *test_msg1 = "abcdbcdecdefdefgefghfghighijhijkijkljklmklmn" - "lmnomnopnopq"; -const char *test_msg2 = "abcdefghbcdefghicdefghijdefghijkefghijklfghi" - "jklmghijklmnhijklmnoijklmnopjklmnopqklmnopqrlmnopqrsmnopqrstnopqrstu"; +static const char *test_msg0 = "abc"; +static const char *test_msg1 = "abcdbcdecdefdefgefghfghighijhijkijkljklmklm" + "nlmnomnopnopq"; +static const char *test_msg2 = "abcdefghbcdefghicdefghijdefghijkefghijklfgh" + "ijklmghijklmnhijklmnoijklmnopjklmnopqklmnopqrlmnopqrsmnopqrstnopqrstu"; /* * Test digests from: * http://csrc.nist.gov/groups/ST/toolkit/documents/Examples/SHA_All.pdf */ -const uint8_t sha256_test_digests[][32] = { +static const uint8_t sha256_test_digests[][32] = { { /* for test_msg0 */ 0xBA, 0x78, 0x16, 0xBF, 0x8F, 0x01, 0xCF, 0xEA, @@ -72,7 +72,7 @@ const uint8_t sha256_test_digests[][32] = { /* no test vector for test_msg2 */ }; -const uint8_t sha384_test_digests[][48] = { +static const uint8_t sha384_test_digests[][48] = { { /* for test_msg0 */ 0xCB, 0x00, 0x75, 0x3F, 0x45, 0xA3, 0x5E, 0x8B, @@ -97,7 +97,7 @@ const uint8_t sha384_test_digests[][48] = { } }; -const uint8_t sha512_test_digests[][64] = { +static const uint8_t sha512_test_digests[][64] = { { /* for test_msg0 */ 0xDD, 0xAF, 0x35, 0xA1, 0x93, 0x61, 0x7A, 0xBA, @@ -126,7 +126,7 @@ const uint8_t sha512_test_digests[][64] = { } }; -const uint8_t sha512_224_test_digests[][28] = { +static const uint8_t sha512_224_test_digests[][28] = { { /* for test_msg0 */ 0x46, 0x34, 0x27, 0x0F, 0x70, 0x7B, 0x6A, 0x54, @@ -147,7 +147,7 @@ const uint8_t sha512_224_test_digests[][28] = { } }; -const uint8_t sha512_256_test_digests[][32] = { +static const uint8_t sha512_256_test_digests[][32] = { { /* for test_msg0 */ 0x53, 0x04, 0x8E, 0x26, 0x81, 0x94, 0x1E, 0xF9, diff --git a/tests/zfs-tests/cmd/checksum/skein_test.c b/tests/zfs-tests/cmd/checksum/skein_test.c index 13611c860c..20eb36d3e8 100644 --- a/tests/zfs-tests/cmd/checksum/skein_test.c +++ b/tests/zfs-tests/cmd/checksum/skein_test.c @@ -44,18 +44,18 @@ /* * Test messages from the Skein spec, Appendix C. */ -const uint8_t test_msg0[] = { +static const uint8_t test_msg0[] = { 0xFF }; -const uint8_t test_msg1[] = { +static const uint8_t test_msg1[] = { 0xFF, 0xFE, 0xFD, 0xFC, 0xFB, 0xFA, 0xF9, 0xF8, 0xF7, 0xF6, 0xF5, 0xF4, 0xF3, 0xF2, 0xF1, 0xF0, 0xEF, 0xEE, 0xED, 0xEC, 0xEB, 0xEA, 0xE9, 0xE8, 0xE7, 0xE6, 0xE5, 0xE4, 0xE3, 0xE2, 0xE1, 0xE0 }; -const uint8_t test_msg2[] = { +static const uint8_t test_msg2[] = { 0xFF, 0xFE, 0xFD, 0xFC, 0xFB, 0xFA, 0xF9, 0xF8, 0xF7, 0xF6, 0xF5, 0xF4, 0xF3, 0xF2, 0xF1, 0xF0, 0xEF, 0xEE, 0xED, 0xEC, 0xEB, 0xEA, 0xE9, 0xE8, @@ -66,7 +66,7 @@ const uint8_t test_msg2[] = { 0xC7, 0xC6, 0xC5, 0xC4, 0xC3, 0xC2, 0xC1, 0xC0 }; -const uint8_t test_msg3[] = { +static const uint8_t test_msg3[] = { 0xFF, 0xFE, 0xFD, 0xFC, 0xFB, 0xFA, 0xF9, 0xF8, 0xF7, 0xF6, 0xF5, 0xF4, 0xF3, 0xF2, 0xF1, 0xF0, 0xEF, 0xEE, 0xED, 0xEC, 0xEB, 0xEA, 0xE9, 0xE8, @@ -85,7 +85,7 @@ const uint8_t test_msg3[] = { 0x87, 0x86, 0x85, 0x84, 0x83, 0x82, 0x81, 0x80 }; -const uint8_t test_msg4[] = { +static const uint8_t test_msg4[] = { 0xFF, 0xFE, 0xFD, 0xFC, 0xFB, 0xFA, 0xF9, 0xF8, 0xF7, 0xF6, 0xF5, 0xF4, 0xF3, 0xF2, 0xF1, 0xF0, 0xEF, 0xEE, 0xED, 0xEC, 0xEB, 0xEA, 0xE9, 0xE8, @@ -123,7 +123,7 @@ const uint8_t test_msg4[] = { /* * Test digests from the Skein spec, Appendix C. */ -const uint8_t skein_256_test_digests[][32] = { +static const uint8_t skein_256_test_digests[][32] = { { /* for test_msg0 */ 0x0B, 0x98, 0xDC, 0xD1, 0x98, 0xEA, 0x0E, 0x50, @@ -148,7 +148,7 @@ const uint8_t skein_256_test_digests[][32] = { /* no test digests for test_msg3 and test_msg4 */ }; -const uint8_t skein_512_test_digests[][64] = { +static const uint8_t skein_512_test_digests[][64] = { { /* for test_msg0 */ 0x71, 0xB7, 0xBC, 0xE6, 0xFE, 0x64, 0x52, 0x22, @@ -189,7 +189,7 @@ const uint8_t skein_512_test_digests[][64] = { /* no test digests for test_msg4 */ }; -const uint8_t skein_1024_test_digests[][128] = { +static const uint8_t skein_1024_test_digests[][128] = { { /* for test_msg0 */ 0xE6, 0x2C, 0x05, 0x80, 0x2E, 0xA0, 0x15, 0x24, diff --git a/tests/zfs-tests/cmd/mmap_libaio.c b/tests/zfs-tests/cmd/mmap_libaio.c index 7d76c9b4eb..5ee1f600a7 100644 --- a/tests/zfs-tests/cmd/mmap_libaio.c +++ b/tests/zfs-tests/cmd/mmap_libaio.c @@ -33,7 +33,7 @@ #include #include -io_context_t io_ctx; +static io_context_t io_ctx; static void do_sync_io(struct iocb *iocb)