From: Timothy Day Date: Thu, 28 Mar 2024 07:53:54 +0000 (-0700) Subject: LU-8191 tests: convert functions to static X-Git-Url: https://git.whamcloud.com/?a=commitdiff_plain;h=0c57ae875305101da01c19699fbd429f0bf9ee07;p=fs%2Flustre-release.git LU-8191 tests: convert functions to static Static analysis shows that a number of functions could be made static. This patch declares several functions in various test helpers static. Lustre-change: https://review.whamcloud.com/51433 Lustre-commit: 629d6bca95f96bd307d6a9da9b04d73d3fe7c68f Test-Parameters: trivial Signed-off-by: Timothy Day Change-Id: I065fb4398ed1670ce6ad58cf946054f6bd1ec282 Reviewed-on: https://review.whamcloud.com/c/ex/lustre-release/+/54603 Tested-by: jenkins Tested-by: Maloo Reviewed-by: Andreas Dilger --- diff --git a/lustre/tests/aiocp.c b/lustre/tests/aiocp.c index b561f3c..dca1289 100644 --- a/lustre/tests/aiocp.c +++ b/lustre/tests/aiocp.c @@ -69,7 +69,7 @@ int alignment = 512; /* buffer alignment */ struct timeval delay; /* delay between i/o */ -int init_iocb(int n, int iosize) +static int init_iocb(int n, int iosize) { void *buf; int i; @@ -100,14 +100,14 @@ int init_iocb(int n, int iosize) return 0; } -struct iocb *alloc_iocb() +static struct iocb *alloc_iocb() { if (!iocb_free_count) return 0; return iocb_free[--iocb_free_count]; } -void free_iocb(struct iocb *io) +static void free_iocb(struct iocb *io) { iocb_free[iocb_free_count++] = io; } @@ -115,7 +115,7 @@ void free_iocb(struct iocb *io) /* * io_wait_run() - wait for an io_event and then call the callback. */ -int io_wait_run(io_context_t ctx, struct timespec *to) +static int io_wait_run(io_context_t ctx, struct timespec *to) { struct io_event events[aio_maxio]; struct io_event *ep; @@ -212,7 +212,7 @@ static void rd_done(io_context_t ctx, struct iocb *iocb, long res, long res2) printf("%d", iosize); } -void usage(void) +static void usage(void) { fprintf(stderr, "Usage: aiocp [-a align] [-s size] [-b blksize] [-n num_io] [-f open_flag] SOURCE DEST\n" @@ -227,7 +227,7 @@ void usage(void) /* * Scale value by kilo, mega, or giga. */ -long long scale_by_kmg(long long value, char scale) +static long long scale_by_kmg(long long value, char scale) { switch (scale) { case 'g': diff --git a/lustre/tests/check_fallocate.c b/lustre/tests/check_fallocate.c index 4de7345..72f27ad 100644 --- a/lustre/tests/check_fallocate.c +++ b/lustre/tests/check_fallocate.c @@ -51,14 +51,14 @@ /* global */ loff_t blksize; -void usage(char *prog) +static void usage(char *prog) { fprintf(stderr, "usage: %s \n", prog); fprintf(stderr, "filepath: absolute pathname of Lustre file\n"); exit(1); } -int write_data_to_file(int fd) +static int write_data_to_file(int fd) { char buf[blksize + 1]; int rc, i, j; @@ -77,7 +77,7 @@ int write_data_to_file(int fd) return 0; } -int get_stat(int fd, struct stat *st) +static int get_stat(int fd, struct stat *st) { int rc = 0; @@ -89,7 +89,7 @@ int get_stat(int fd, struct stat *st) return rc; } -int __do_fallocate(int fd, int mode, loff_t offset, loff_t len) +static int __do_fallocate(int fd, int mode, loff_t offset, loff_t len) { int rc; @@ -104,7 +104,7 @@ int __do_fallocate(int fd, int mode, loff_t offset, loff_t len) return rc; } -int post_fallocate_checks(int fd, int mode, loff_t offset, loff_t len, +static int post_fallocate_checks(int fd, int mode, loff_t offset, loff_t len, loff_t expected_new_size) { struct stat st; @@ -129,7 +129,7 @@ out: return rc; } -int create_hole(int fd) +static int create_hole(int fd) { int rc; @@ -146,7 +146,8 @@ out: return rc; } -int do_fallocate(int fd, int mode, loff_t offset, loff_t expected_new_size) +static int do_fallocate(int fd, int mode, loff_t offset, + loff_t expected_new_size) { int rc; loff_t len; @@ -167,7 +168,7 @@ out: } -int test_prealloc_nonsparse(int fd) +static int test_prealloc_nonsparse(int fd) { int rc, mode; loff_t offset, expected_new_size; @@ -191,7 +192,7 @@ out: return rc; } -int test_prealloc_sparse(int fd) +static int test_prealloc_sparse(int fd) { int rc, mode; loff_t offset, expected_new_size; diff --git a/lustre/tests/check_fhandle_syscalls.c b/lustre/tests/check_fhandle_syscalls.c index a6e8e01..b1a8777 100644 --- a/lustre/tests/check_fhandle_syscalls.c +++ b/lustre/tests/check_fhandle_syscalls.c @@ -47,7 +47,7 @@ #define MAX_HANDLE_SZ 128 -void usage(char *prog) +static void usage(char *prog) { fprintf(stderr, "usage: %s \n", prog); @@ -123,7 +123,7 @@ static int debug_mark(const char *msg) } /* verify a file contents */ -int check_access(const char *filename, +static int check_access(const char *filename, int mnt_fd, struct file_handle *fh, struct stat *st_orig) { int fd2, rc, len, offset; diff --git a/lustre/tests/checkfiemap.c b/lustre/tests/checkfiemap.c index 2dea812..59284ae 100644 --- a/lustre/tests/checkfiemap.c +++ b/lustre/tests/checkfiemap.c @@ -51,7 +51,7 @@ /* This test executes fiemap ioctl and check * a) there are no file ranges marked with FIEMAP_EXTENT_UNWRITTEN * b) data ranges sizes sum is equal to given in second param */ -int check_fiemap(int fd, long long orig_size) +static int check_fiemap(int fd, long long orig_size) { /* This buffer is enougth for 1MB length file */ union { struct fiemap f; char c[4096]; } fiemap_buf; diff --git a/lustre/tests/checkstat.c b/lustre/tests/checkstat.c index b1e869e4..119227a 100644 --- a/lustre/tests/checkstat.c +++ b/lustre/tests/checkstat.c @@ -45,7 +45,7 @@ #include #include -void +static void usage(char *argv0, int help) { char *progname = strrchr(argv0, '/'); diff --git a/lustre/tests/chownmany.c b/lustre/tests/chownmany.c index 119e963..25ec906 100644 --- a/lustre/tests/chownmany.c +++ b/lustre/tests/chownmany.c @@ -38,7 +38,7 @@ #include #include -void usage(char *prog) +static void usage(char *prog) { printf("usage: %s owner filenamefmt count\n", prog); printf(" %s owner filenamefmt start count\n", prog); diff --git a/lustre/tests/createmany.c b/lustre/tests/createmany.c index b891102..3e47201 100644 --- a/lustre/tests/createmany.c +++ b/lustre/tests/createmany.c @@ -71,7 +71,7 @@ static char *get_file_name(const char *fmt, long n, int has_fmt_spec) return filename; } -double now(void) +static double now(void) { struct timeval tv; gettimeofday(&tv, NULL); diff --git a/lustre/tests/createtest.c b/lustre/tests/createtest.c index 17008a8..9249489 100644 --- a/lustre/tests/createtest.c +++ b/lustre/tests/createtest.c @@ -41,7 +41,7 @@ #define S_SHIFT 12 #endif -int usage(char *prog) +static int usage(char *prog) { fprintf(stderr, "usage: %s \n", prog); exit(1); diff --git a/lustre/tests/euid_access.c b/lustre/tests/euid_access.c index 1e20b74..744dd75 100644 --- a/lustre/tests/euid_access.c +++ b/lustre/tests/euid_access.c @@ -33,7 +33,7 @@ #include #include -void print_groups(int num_groups, gid_t *groups) +static void print_groups(int num_groups, gid_t *groups) { int i; diff --git a/lustre/tests/flock_deadlock.c b/lustre/tests/flock_deadlock.c index 8a85802..7692455 100644 --- a/lustre/tests/flock_deadlock.c +++ b/lustre/tests/flock_deadlock.c @@ -102,7 +102,7 @@ enum { printf("%d: done\n", pid); \ } -void catch_alarm() +static void catch_alarm(int i) { fprintf(stderr, "lock timeout\n"); exit(124); diff --git a/lustre/tests/flocks_test.c b/lustre/tests/flocks_test.c index 2716be3..989a52f 100644 --- a/lustre/tests/flocks_test.c +++ b/lustre/tests/flocks_test.c @@ -45,7 +45,7 @@ /** * helper functions */ -int t_fcntl(int fd, int cmd, ...) +static int t_fcntl(int fd, int cmd, ...) { va_list ap; long arg; @@ -107,7 +107,7 @@ int t_fcntl(int fd, int cmd, ...) return rc; } -int t_unlink(const char *path) +static int t_unlink(const char *path) { int rc; @@ -123,13 +123,13 @@ int t_unlink(const char *path) * * normal flock test */ -void t1_usage(void) +static void t1_usage(void) { fprintf(stderr, "usage: flocks_test 1 {on|off} {-c|-f|-l} /path/to/file\n"); } -int t1(int argc, char *argv[]) +static int t1(int argc, char *argv[]) { int fd; int mount_with_flock = 0; @@ -198,7 +198,7 @@ struct thread_info { int rc; } th_data; -void *t2_thread1(void *arg) +static void *t2_thread1(void *arg) { struct thread_info *ti = arg; struct flock *lock = ti->lock; @@ -219,7 +219,7 @@ void *t2_thread1(void *arg) return &ti->rc; } -void *t2_thread2(void *arg) +static void *t2_thread2(void *arg) { struct thread_info *ti = arg; struct flock *lock = ti->lock; @@ -241,7 +241,7 @@ void *t2_thread2(void *arg) return &ti->rc; } -int t2(int argc, char *argv[]) +static int t2(int argc, char *argv[]) { struct flock lock = { .l_type = F_RDLCK, @@ -302,7 +302,7 @@ out: * two conflicting flocks from different processes but same fs * should succeed. */ -int t3(int argc, char *argv[]) +static int t3(int argc, char *argv[]) { int fd, fd2; int pid; @@ -381,7 +381,7 @@ out: return rc; } -int t4(int argc, char *argv[]) +static int t4(int argc, char *argv[]) { struct flock lock = { .l_type = F_WRLCK, @@ -512,7 +512,7 @@ out: " sleep N: sleep for N secs after fcntl\n" \ " file1: fcntl is called for this file\n" -int t5(int argc, char *argv[]) +static int t5(int argc, char *argv[]) { struct flock lock = { .l_type = F_WRLCK, @@ -590,7 +590,7 @@ int t5(int argc, char *argv[]) /** ============================================================== * program entry */ -void usage(void) +static void usage(void) { fprintf(stderr, "usage: flocks_test test# [corresponding arguments]\n"); diff --git a/lustre/tests/fsx.c b/lustre/tests/fsx.c index 931d20d..4394d5d 100644 --- a/lustre/tests/fsx.c +++ b/lustre/tests/fsx.c @@ -211,7 +211,7 @@ int page_mask; FILE *fsxlogf; int badoff = -1; -void +static void vwarnc(code, fmt, ap) int code; const char *fmt; @@ -225,7 +225,7 @@ vwarnc(code, fmt, ap) fprintf(stderr, "%s\n", strerror(code)); } -void +static void __attribute__((format(__printf__, 1, 2))) warn(const char *fmt, ...) { @@ -236,7 +236,7 @@ warn(const char *fmt, ...) va_end(ap); } -void +static void __attribute__((format(__printf__, 1, 2))) prt(char *fmt, ...) { @@ -258,14 +258,14 @@ prt(char *fmt, ...) * which transparently handles passing of function name. * This version also keeps checkpatch happy. */ -void +static void ptrerr_func(const char *func, const char *prefix) { prt("%s: %s%s%s\n", func, prefix, prefix ? ": " : "", strerror(errno)); } #define prterr(prefix) ptrerr_func(__func__, prefix) -void +static void log4(int operation, int arg0, int arg1, int arg2) { struct log_entry *le; @@ -284,7 +284,7 @@ log4(int operation, int arg0, int arg1, int arg2) logptr = 0; } -const char * +static const char * fill_tf_buf(const struct test_file *tf) { static int max_tf_len; @@ -303,7 +303,7 @@ fill_tf_buf(const struct test_file *tf) return tf_buf; } -void +static void logdump(void) { int i, count, down; @@ -432,7 +432,7 @@ logdump(void) } } -void +static void save_buffer(char *buffer, off_t bufferlength, int fd) { off_t ret; @@ -473,7 +473,7 @@ save_buffer(char *buffer, off_t bufferlength, int fd) } } -void +static void report_failure(int status) { logdump(); @@ -494,7 +494,7 @@ report_failure(int status) #define short_at(cp) ((unsigned short)((*((unsigned char *)(cp)) << 8) | \ *(((unsigned char *)(cp)) + 1))) -void +static void check_buffers(unsigned int offset, unsigned int size) { unsigned char c, t; @@ -538,7 +538,7 @@ check_buffers(unsigned int offset, unsigned int size) } } -struct test_file * +static struct test_file * get_tf(void) { unsigned int index = 0; @@ -561,7 +561,7 @@ get_tf(void) return &test_files[index % num_test_files]; } -void +static void assign_fd_policy(char *policy) { if (!strcmp(policy, "random")) { @@ -574,7 +574,7 @@ assign_fd_policy(char *policy) } } -int +static int get_fd(void) { struct test_file *tf = get_tf(); @@ -589,7 +589,7 @@ static const char *my_basename(const char *path) return c ? c++ : path; } -void +static void open_test_files(char **argv, int argc) { struct test_file *tf; @@ -624,7 +624,7 @@ open_test_files(char **argv, int argc) prt("fd %d: %s\n", i, tf->path); } -void +static void close_test_files(void) { int i; @@ -638,7 +638,7 @@ close_test_files(void) } } -void +static void check_size(void) { struct stat statbuf; @@ -659,7 +659,7 @@ check_size(void) } } -void +static void check_trunc_hack(void) { struct stat statbuf; @@ -688,7 +688,7 @@ check_trunc_hack(void) } } -void +static void output_line(struct test_file *tf, int op, unsigned int offset, unsigned int size) { @@ -719,7 +719,7 @@ output_line(struct test_file *tf, int op, unsigned int offset, (int)size < 0 ? -(int)size : size); } -void +static void mirror_output_line(struct test_file *tf, int op, int mirrors, int id) { char *mirror_ops[] = { @@ -749,7 +749,8 @@ mirror_output_line(struct test_file *tf, int op, int mirrors, int id) } } -void output_debug(unsigned int offset, unsigned int size, const char *what) +static void output_debug(unsigned int offset, unsigned int size, + const char *what) { struct timeval t; @@ -761,7 +762,7 @@ void output_debug(unsigned int offset, unsigned int size, const char *what) } } -void +static void doflush(unsigned int offset, unsigned int size) { unsigned int pg_offset; @@ -794,7 +795,7 @@ doflush(unsigned int offset, unsigned int size) output_debug(offset, size, "flush done"); } -void +static void doread(unsigned int offset, unsigned int size) { off_t ret; @@ -844,7 +845,7 @@ doread(unsigned int offset, unsigned int size) check_buffers(offset, size); } -void +static void check_eofpage(char *s, unsigned int offset, char *p, int size) { long last_page, should_be_zero; @@ -871,7 +872,7 @@ check_eofpage(char *s, unsigned int offset, char *p, int size) } } -void +static void domapread(unsigned int offset, unsigned int size) { unsigned int pg_offset; @@ -930,7 +931,7 @@ domapread(unsigned int offset, unsigned int size) check_buffers(offset, size); } -void +static void gendata(char *original_buf, char *good_buf, unsigned int offset, unsigned int size) { @@ -942,7 +943,7 @@ gendata(char *original_buf, char *good_buf, unsigned int offset, } } -void +static void dowrite(unsigned int offset, unsigned int size) { off_t ret; @@ -1007,7 +1008,7 @@ dowrite(unsigned int offset, unsigned int size) } } -void +static void domapwrite(unsigned int offset, unsigned int size) { unsigned int pg_offset; @@ -1082,7 +1083,7 @@ domapwrite(unsigned int offset, unsigned int size) output_debug(offset, map_size, "munmap done"); } -void +static void dotruncate(unsigned int size) { int oldsize = file_size; @@ -1116,7 +1117,7 @@ dotruncate(unsigned int size) output_debug(size, 0, "truncate done"); } -void +static void do_punch_hole(unsigned int offset, unsigned int length) { int max_offset = 0; @@ -1161,7 +1162,7 @@ do_punch_hole(unsigned int offset, unsigned int length) memset(good_buf + max_offset, '\0', max_len); } -void +static void do_zero_range(unsigned int offset, unsigned int length) { unsigned int end_offset; @@ -1217,7 +1218,7 @@ do_zero_range(unsigned int offset, unsigned int length) * fallocate is basically a no-op unless extending, * then a lot like a truncate */ -void +static void do_preallocate(unsigned int offset, unsigned int length) { off_t end_offset; @@ -1271,7 +1272,7 @@ do_preallocate(unsigned int offset, unsigned int length) output_debug(offset, length, "fallocate done"); } -void +static void writefileimage() { ssize_t iret; @@ -1297,7 +1298,7 @@ writefileimage() } } -void +static void docloseopen(void) { int direct = 0; @@ -1381,7 +1382,7 @@ free: return rc < 0 ? rc : count; } -void +static void do_mirror_ops(int op) { int mirror_count; @@ -1501,7 +1502,7 @@ do { \ (len) = (size) - (off); \ } while (0) -void +static void test(void) { unsigned long offset; @@ -1616,7 +1617,7 @@ out: check_size(); } -void +static void segv(int sig) { if (jmpbuf_good) { @@ -1626,7 +1627,7 @@ segv(int sig) report_failure(9999); } -void +static void cleanup(sig) int sig; { @@ -1636,7 +1637,7 @@ cleanup(sig) exit(sig); } -void +static void usage(void) { fprintf(stdout, @@ -1696,7 +1697,7 @@ usage(void) exit(90); } -int +static int getnum(char *s, char **e) { int ret = -1; @@ -1729,7 +1730,7 @@ getnum(char *s, char **e) return (ret); } -int +static int test_fallocate(int mode) { int ret = 0; diff --git a/lustre/tests/lgetxattr_size_check.c b/lustre/tests/lgetxattr_size_check.c index 2c674dc..08b25ef 100644 --- a/lustre/tests/lgetxattr_size_check.c +++ b/lustre/tests/lgetxattr_size_check.c @@ -5,7 +5,7 @@ #include #include -void usage(char *prog) +static void usage(char *prog) { printf("Usage: %s \n", prog); } diff --git a/lustre/tests/listxattr_size_check.c b/lustre/tests/listxattr_size_check.c index 5124a3a..b9eafb1 100644 --- a/lustre/tests/listxattr_size_check.c +++ b/lustre/tests/listxattr_size_check.c @@ -33,7 +33,7 @@ #include #include -void usage(char *prog) +static void usage(char *prog) { printf("Usage: %s \n", prog); } diff --git a/lustre/tests/ll_dirstripe_verify.c b/lustre/tests/ll_dirstripe_verify.c index 379708b..b197c69 100644 --- a/lustre/tests/ll_dirstripe_verify.c +++ b/lustre/tests/ll_dirstripe_verify.c @@ -59,7 +59,7 @@ * If zero bytes are read it will be treated as failure as such * zero cannot be returned from this function. */ -int read_proc_entry(char *proc_path, char *buf, int len) +static int read_proc_entry(char *proc_path, char *buf, int len) { int rc, fd; @@ -90,7 +90,7 @@ int read_proc_entry(char *proc_path, char *buf, int len) return rc; } -int compare(struct obd_uuid *puuid, struct lov_user_md *lum_dir, +static int compare(struct obd_uuid *puuid, struct lov_user_md *lum_dir, struct lov_user_md *lum_file1, struct lov_user_md *lum_file2) { int stripe_count = 0, min_stripe_count = 0, def_stripe_count = 1; @@ -206,7 +206,7 @@ int compare(struct obd_uuid *puuid, struct lov_user_md *lum_dir, return 0; } -int compare_lum(struct obd_uuid *puuid, struct lov_user_md *lum_dir, +static int compare_lum(struct obd_uuid *puuid, struct lov_user_md *lum_dir, struct lov_user_md *lum_file1, struct lov_user_md *lum_file2) { struct lov_comp_md_v1 *comp_dir, *comp_file1; diff --git a/lustre/tests/ll_sparseness_verify.c b/lustre/tests/ll_sparseness_verify.c index 1cede94..8ab4c92 100644 --- a/lustre/tests/ll_sparseness_verify.c +++ b/lustre/tests/ll_sparseness_verify.c @@ -47,7 +47,7 @@ #define BUFSIZE (1024 * 1024) -void error(char *fmt, ...) +static void error(char *fmt, ...) { va_list ap; @@ -57,7 +57,7 @@ void error(char *fmt, ...) exit(1); } -int compare_offsets(const void *a, const void *b) +static int compare_offsets(const void *a, const void *b) { off_t *A = (off_t *)a; off_t *B = (off_t *)b; diff --git a/lustre/tests/llapi_hsm_test.c b/lustre/tests/llapi_hsm_test.c index 32998af..6326863 100644 --- a/lustre/tests/llapi_hsm_test.c +++ b/lustre/tests/llapi_hsm_test.c @@ -78,7 +78,7 @@ static bool is_bitmap; /* Register and unregister 2000 times. Ensures there is no fd leak * since there is usually 1024 fd per process. */ -int test1(void) +static int test1(void) { int i; int rc; @@ -101,7 +101,7 @@ int test1(void) } /* Re-register */ -int test2(void) +static int test2(void) { int rc; struct hsm_copytool_private *ctdata1; @@ -127,7 +127,7 @@ int test2(void) } /* Bad parameters to llapi_hsm_copytool_register(). */ -int test3(void) +static int test3(void) { int rc; struct hsm_copytool_private *ctdata; @@ -173,7 +173,7 @@ int test3(void) } /* Bad parameters to llapi_hsm_copytool_unregister(). */ -int test4(void) +static int test4(void) { int rc; @@ -185,7 +185,7 @@ int test4(void) } /* Test llapi_hsm_copytool_recv in non blocking mode */ -int test5(void) +static int test5(void) { int rc; int i; @@ -213,7 +213,7 @@ int test5(void) } /* Test llapi_hsm_copytool_recv with bogus parameters */ -int test6(void) +static int test6(void) { struct hsm_copytool_private *ctdata; struct hsm_action_list *hal; @@ -248,7 +248,7 @@ int test6(void) } /* Test polling (without actual traffic) */ -int test7(void) +static int test7(void) { int rc; struct hsm_copytool_private *ctdata; @@ -317,7 +317,7 @@ static int create_testfile(size_t length) } /* Test llapi_hsm_state_get. */ -void test50(void) +static void test50(void) { struct hsm_user_state hus; int rc; @@ -358,7 +358,7 @@ void test50(void) } /* Test llapi_hsm_state_set. */ -void test51(void) +static void test51(void) { int rc; int fd; @@ -488,7 +488,7 @@ void test51(void) } /* Test llapi_hsm_current_action */ -void test52(void) +static void test52(void) { int rc; int fd; @@ -510,7 +510,7 @@ void test52(void) /* Helper to simulate archiving a file. No actual data movement * happens. */ -void helper_archiving(void (*progress) +static void helper_archiving(void (*progress) (struct hsm_copyaction_private *hcp, size_t length), const size_t length) { @@ -590,7 +590,7 @@ void helper_archiving(void (*progress) } /* Simple archive. No progress. */ -void test100(void) +static void test100(void) { const size_t length = 100; @@ -625,7 +625,7 @@ static void test101_progress(struct hsm_copyaction_private *hcp, size_t length) "length=%llu", (unsigned long long)hca.hca_location.length); } -void test101(void) +static void test101(void) { const size_t length = 1000; @@ -660,7 +660,7 @@ static void test102_progress(struct hsm_copyaction_private *hcp, size_t length) "length=%llu", (unsigned long long)hca.hca_location.length); } -void test102(void) +static void test102(void) { const size_t length = 1000; @@ -691,7 +691,7 @@ static void test103_progress(struct hsm_copyaction_private *hcp, size_t length) "length=%llu", (unsigned long long)hca.hca_location.length); } -void test103(void) +static void test103(void) { const size_t length = 1000; @@ -728,7 +728,7 @@ static void test104_progress(struct hsm_copyaction_private *hcp, size_t length) "length=%llu", (unsigned long long)hca.hca_location.length); } -void test104(void) +static void test104(void) { const size_t length = 1000; @@ -762,7 +762,7 @@ static void test105_progress(struct hsm_copyaction_private *hcp, size_t length) "length=%llu", (unsigned long long)hca.hca_location.length); } -void test105(void) +static void test105(void) { const size_t length = 1000; @@ -793,7 +793,7 @@ static void test106_progress(struct hsm_copyaction_private *hcp, size_t length) "length=%llu", (unsigned long long)hca.hca_location.length); } -void test106(void) +static void test106(void) { const size_t length = 1000; @@ -824,7 +824,7 @@ static void test107_progress(struct hsm_copyaction_private *hcp, size_t length) "length=%llu", (unsigned long long)hca.hca_location.length); } -void test107(void) +static void test107(void) { const size_t length = 1000; @@ -858,7 +858,7 @@ static void test108_progress(struct hsm_copyaction_private *hcp, size_t length) "length=%llu", (unsigned long long)hca.hca_location.length); } -void test108(void) +static void test108(void) { const size_t length = 1000; @@ -889,7 +889,7 @@ static void test109_progress(struct hsm_copyaction_private *hcp, size_t length) "length=%llu", (unsigned long long)hca.hca_location.length); } -void test109(void) +static void test109(void) { const size_t length = 1000; @@ -924,7 +924,7 @@ static void test110_progress(struct hsm_copyaction_private *hcp, size_t length) } } -void test110(void) +static void test110(void) { const size_t length = 1000; @@ -959,7 +959,7 @@ static void test111_progress(struct hsm_copyaction_private *hcp, size_t length) } } -void test111(void) +static void test111(void) { const size_t length = 1000; @@ -1014,7 +1014,7 @@ static void test112_progress(struct hsm_copyaction_private *hcp, size_t length) } } -void test112(void) +static void test112(void) { const size_t length = 1000; diff --git a/lustre/tests/llapi_layout_test.c b/lustre/tests/llapi_layout_test.c index f875f91..c402b58 100644 --- a/lustre/tests/llapi_layout_test.c +++ b/lustre/tests/llapi_layout_test.c @@ -73,7 +73,7 @@ static char *poolname; static bool run_list_provided; static int num_osts = -1; -void usage(char *prog) +static void usage(char *prog) { printf("Usage: %s [-d lustre_dir] [-p pool_name] [-o num_osts] " "[-s $n,$m,... (skip tests)] [-t $n,$m,... (run tests)]\n", @@ -86,7 +86,7 @@ void usage(char *prog) #define T0_STRIPE_SIZE 1048576 #define T0_OST_OFFSET (num_osts - 1) #define T0_DESC "Read/write layout attributes then create a file" -void test0(void) +static void test0(void) { int rc; int fd; @@ -137,7 +137,7 @@ void test0(void) llapi_layout_free(layout); } -void __test1_helper(struct llapi_layout *layout) +static void __test1_helper(struct llapi_layout *layout) { uint64_t ost0; uint64_t ost1; @@ -168,7 +168,7 @@ void __test1_helper(struct llapi_layout *layout) } #define T1_DESC "Read test0 file by path and verify attributes" -void test1(void) +static void test1(void) { char path[PATH_MAX]; @@ -180,7 +180,7 @@ void test1(void) } #define T2_DESC "Read test0 file by FD and verify attributes" -void test2(void) +static void test2(void) { int fd; int rc; @@ -202,7 +202,7 @@ void test2(void) } #define T3_DESC "Read test0 file by FID and verify attributes" -void test3(void) +static void test3(void) { int rc; struct llapi_layout *layout; @@ -228,7 +228,7 @@ void test3(void) #define T4_STRIPE_COUNT 2 #define T4_STRIPE_SIZE 2097152 #define T4_DESC "Verify compatibility with 'lfs setstripe'" -void test4(void) +static void test4(void) { int rc; uint64_t ost0; @@ -282,7 +282,7 @@ void test4(void) #define T5FILE "t5" #define T5_DESC "llapi_layout_get_by_path ENOENT handling" -void test5(void) +static void test5(void) { int rc; char path[PATH_MAX]; @@ -299,7 +299,7 @@ void test5(void) } #define T6_DESC "llapi_layout_get_by_fd EBADF handling" -void test6(void) +static void test6(void) { errno = 0; struct llapi_layout *layout = llapi_layout_get_by_fd(9999, 0); @@ -308,7 +308,7 @@ void test6(void) #define T7FILE "t7" #define T7_DESC "llapi_layout_get_by_path EACCES handling" -void test7(void) +static void test7(void) { int fd; int rc; @@ -352,7 +352,7 @@ void test7(void) * striping attributes. */ #define T8FILE "t8" #define T8_DESC "llapi_layout_get_by_path ENODATA handling" -void test8(void) +static void test8(void) { int fd; int rc; @@ -392,7 +392,7 @@ void test8(void) /* Verify llapi_layout_patter_set() return values for various inputs. */ #define T9_DESC "verify llapi_layout_pattern_set() return values" -void test9(void) +static void test9(void) { struct llapi_layout *layout; int rc; @@ -423,7 +423,7 @@ void test9(void) /* Verify stripe_count interfaces return errors as expected */ #define T10_DESC "stripe_count error handling" -void test10(void) +static void test10(void) { int rc; uint64_t count; @@ -465,7 +465,7 @@ void test10(void) /* Verify stripe_size interfaces return errors as expected */ #define T11_DESC "stripe_size error handling" -void test11(void) +static void test11(void) { int rc; uint64_t size; @@ -508,7 +508,7 @@ void test11(void) /* Verify pool_name interfaces return errors as expected */ #define T12_DESC "pool_name error handling" -void test12(void) +static void test12(void) { int rc; struct llapi_layout *layout; @@ -549,7 +549,7 @@ void test12(void) #define T13FILE "t13" #define T13_STRIPE_COUNT 2 #define T13_DESC "ost_index error handling" -void test13(void) +static void test13(void) { int rc; int fd; @@ -614,7 +614,7 @@ void test13(void) /* Verify llapi_layout_file_create() returns errors as expected */ #define T14_DESC "llapi_layout_file_create error handling" -void test14(void) +static void test14(void) { int rc; struct llapi_layout *layout = llapi_layout_alloc(); @@ -631,7 +631,7 @@ void test14(void) #define T15FILE "t15" #define T15_STRIPE_COUNT 2 #define T15_DESC "Can't change striping attributes of existing file" -void test15(void) +static void test15(void) { int rc; int fd; @@ -674,7 +674,7 @@ void test15(void) /* Default stripe attributes are applied as expected. */ #define T16FILE "t16" #define T16_DESC "Default stripe attributes are applied as expected" -void test16(void) +static void test16(void) { int rc; int fd; @@ -750,7 +750,7 @@ void test16(void) /* Setting stripe count to LLAPI_LAYOUT_WIDE uses all available OSTs. */ #define T17FILE "t17" #define T17_DESC "LLAPI_LAYOUT_WIDE is honored" -void test17(void) +static void test17(void) { int rc; int fd; @@ -793,7 +793,7 @@ void test17(void) /* Setting pool with "fsname.pool" notation. */ #define T18FILE "t18" #define T18_DESC "Setting pool with fsname.pool notation" -void test18(void) +static void test18(void) { int rc; int fd; @@ -835,7 +835,7 @@ void test18(void) } #define T19_DESC "Maximum length pool name is NULL-terminated" -void test19(void) +static void test19(void) { struct llapi_layout *layout; char *name = "0123456789abcde"; @@ -854,7 +854,7 @@ void test19(void) #define T20FILE "t20" #define T20_DESC "LLAPI_LAYOUT_DEFAULT is honored" -void test20(void) +static void test20(void) { int rc; int fd; @@ -913,7 +913,7 @@ void test20(void) } #define T21_DESC "llapi_layout_file_create fails for non-Lustre file" -void test21(void) +static void test21(void) { struct llapi_layout *layout; char template[PATH_MAX]; @@ -939,7 +939,7 @@ void test21(void) #define T22FILE "t22" #define T22_DESC "llapi_layout_file_create applied mode correctly" -void test22(void) +static void test22(void) { int rc; int fd; @@ -972,7 +972,7 @@ void test22(void) } #define T23_DESC "llapi_layout_get_by_path fails for non-Lustre file" -void test23(void) +static void test23(void) { struct llapi_layout *layout; char template[PATH_MAX]; @@ -997,7 +997,7 @@ void test23(void) * for file with unspecified layout. */ #define T24FILE "t24" #define T24_DESC "LAYOUT_GET_EXPECTED works with existing file" -void test24(void) +static void test24(void) { int fd; int rc; @@ -1038,7 +1038,7 @@ void test24(void) * for directory with unspecified layout. */ #define T25DIR "d25" #define T25_DESC "LAYOUT_GET_EXPECTED works with directory" -void test25(void) +static void test25(void) { int rc; struct llapi_layout *layout; @@ -1077,7 +1077,7 @@ void test25(void) #define T26DIR "d26" #define T26_DESC "LAYOUT_GET_EXPECTED partially specified parent" #define T26_STRIPE_SIZE (1048576 * 4) -void test26(void) +static void test26(void) { int rc; struct llapi_layout *layout; @@ -1125,7 +1125,7 @@ void test26(void) #define T27DIR "d27" #define T27_DESC "LAYOUT_GET_EXPECTED with non existing file" #define T27_STRIPE_SIZE (1048576 * 3) -void test27(void) +static void test27(void) { int rc; struct llapi_layout *layout; @@ -1175,7 +1175,7 @@ void test27(void) * with a stripe_count of -1. */ #define T28DIR "d28" #define T28_DESC "LLAPI_LAYOUT_WIDE returned as expected" -void test28(void) +static void test28(void) { int rc; struct llapi_layout *layout; @@ -1210,7 +1210,7 @@ void test28(void) #define T29FILE "f29" #define T29_DESC "set ost index to non-zero stripe number" -void test29(void) +static void test29(void) { int rc, fd, i; uint64_t ost0, ost1, nost; @@ -1323,7 +1323,7 @@ void test29(void) #define T30FILE "f30" #define T30_DESC "create composite file, traverse components" -void test30(void) +static void test30(void) { int rc, fd; uint64_t start[3], end[3]; @@ -1425,7 +1425,7 @@ void test30(void) #define T31FILE "f31" #define T31_DESC "add/delete component to/from existing file" -void test31(void) +static void test31(void) { int rc, fd, i; uint64_t start[2], end[2]; @@ -1537,7 +1537,7 @@ void test31(void) #define T32FILE "t32" #define T32_STRIPE_COUNT (num_osts*2) #define T32_DESC "Test overstriping with layout_file_create" -void test32(void) +static void test32(void) { int rc; int fd; @@ -1590,7 +1590,7 @@ void test32(void) #define T33FILE "t33" #define T33_STRIPE_COUNT (num_osts*2) #define T33_DESC "Test overstriping with llapi_file_open" -void test33(void) +static void test33(void) { int rc; int fd; @@ -1628,7 +1628,7 @@ void test33(void) #define T34FILE "f34" #define T34_DESC "create simple valid & invalid self extending layouts" -void test34(void) +static void test34(void) { int rc, fd; uint64_t start[4], end[4]; @@ -1785,7 +1785,8 @@ static struct test_tbl_entry test_tbl[] = { #define NUM_TESTS (sizeof(test_tbl) / sizeof(struct test_tbl_entry)) -void print_test_desc(int test_num, const char *test_desc, const char *status) +static void print_test_desc(int test_num, const char *test_desc, + const char *status) { int i; @@ -1797,7 +1798,8 @@ void print_test_desc(int test_num, const char *test_desc, const char *status) /* This function runs a single test by forking the process. This way, * if there is a segfault during a test, the test program won't crash. */ -int test(void (*test_fn)(), const char *test_desc, bool test_skip, int test_num) +static int test(void (*test_fn)(), const char *test_desc, bool test_skip, + int test_num) { int rc = 0; pid_t pid; diff --git a/lustre/tests/llapi_root_test.c b/lustre/tests/llapi_root_test.c index 0867e82..628dac4 100644 --- a/lustre/tests/llapi_root_test.c +++ b/lustre/tests/llapi_root_test.c @@ -89,7 +89,7 @@ static void cleanup(void) } #define TEST1_THR_NBR 20 -void *test1_thr(void *arg) +static void *test1_thr(void *arg) { char *fidstr = arg; char path[PATH_MAX]; diff --git a/lustre/tests/lockahead_test.c b/lustre/tests/lockahead_test.c index 7fd180e..66e81f3 100644 --- a/lustre/tests/lockahead_test.c +++ b/lustre/tests/lockahead_test.c @@ -90,7 +90,7 @@ static void cleanup(void) } /* Trivial helper for one advice */ -void setup_ladvise_lockahead(struct llapi_lu_ladvise *advice, int mode, +static void setup_ladvise_lockahead(struct llapi_lu_ladvise *advice, int mode, int flags, size_t start, size_t end, bool async) { advice->lla_advice = LU_LADVISE_LOCKAHEAD; diff --git a/lustre/tests/mcreate.c b/lustre/tests/mcreate.c index 39ddba5..e3bd165 100644 --- a/lustre/tests/mcreate.c +++ b/lustre/tests/mcreate.c @@ -38,7 +38,7 @@ #include #include -void usage(const char *prog, int status) +static void usage(const char *prog, int status) { fprintf(status == 0 ? stdout : stderr, "Usage: %s [OPTION]... FILE\n" diff --git a/lustre/tests/memhog.c b/lustre/tests/memhog.c index a98e88f..df0aaea 100644 --- a/lustre/tests/memhog.c +++ b/lustre/tests/memhog.c @@ -35,7 +35,7 @@ #define CHUNK (128 * 1024) -void usage(const char *prog, FILE *out) +static void usage(const char *prog, FILE *out) { fprintf(out, "usage: %s allocsize\n", prog); fprintf(out, " allocsize is kbytes, or number[KMGP] (P = pages)\n"); diff --git a/lustre/tests/mmap_cat.c b/lustre/tests/mmap_cat.c index d98c6f3..7a43099 100644 --- a/lustre/tests/mmap_cat.c +++ b/lustre/tests/mmap_cat.c @@ -46,7 +46,7 @@ char usage[] = "Usage: %s \n" " mmap and cat its content\n"; -size_t getFilesize(const char *filename) +static size_t getFilesize(const char *filename) { struct stat st; diff --git a/lustre/tests/multiop.c b/lustre/tests/multiop.c index cccd454..4139f7a 100644 --- a/lustre/tests/multiop.c +++ b/lustre/tests/multiop.c @@ -112,7 +112,7 @@ char usage[] = " Z[num] lseek(SEEK_CUR) [optional offset, default 0]\n" " _ wait for signal\n"; -void usr1_handler(int unused) +static void usr1_handler(int unused) { int saved_errno = errno; @@ -166,7 +166,7 @@ struct flag_mapping { {"", -1} }; -int get_flags(char *data, int *rflags) +static int get_flags(char *data, int *rflags) { char *cloned_flags; char *tmp; diff --git a/lustre/tests/openfile.c b/lustre/tests/openfile.c index b01a415..ce0f4ec 100644 --- a/lustre/tests/openfile.c +++ b/lustre/tests/openfile.c @@ -70,7 +70,7 @@ FLAG_MAPPING flag_table[] = { {"", -1} }; -void Usage_and_abort(void) +static void Usage_and_abort(void) { fprintf(stderr, "Usage: openfile -f flags [ -m mode ] filename\n"); fprintf(stderr, diff --git a/lustre/tests/rename_many.c b/lustre/tests/rename_many.c index c67c6dc..28310ea 100644 --- a/lustre/tests/rename_many.c +++ b/lustre/tests/rename_many.c @@ -60,7 +60,7 @@ int creat_errors; int rename_errors; int unlink_errors; -void usage(const char *progname) +static void usage(const char *progname) { fprintf(stderr, "usage: %s [-n numfiles] [-s seed] [-v] [-x] [dir]\n" "\t-c: only do the create step of first loop\n" @@ -72,7 +72,8 @@ void usage(const char *progname) "\t-x: don't exit on error\n", progname); } -void handler(int sig) { +static void handler(int sig) +{ static long last_time; long now = time(0); diff --git a/lustre/tests/runas.c b/lustre/tests/runas.c index 162e83c..3468d1c 100644 --- a/lustre/tests/runas.c +++ b/lustre/tests/runas.c @@ -53,7 +53,7 @@ static const char usage[] = " -j egid switch egid to GID\n" " -G set supplementary groups\n"; -void Usage_and_abort(const char *name) +static void Usage_and_abort(const char *name) { fprintf(stderr, usage, name); exit(-1); diff --git a/lustre/tests/rw_seq_cst_vs_drop_caches.c b/lustre/tests/rw_seq_cst_vs_drop_caches.c index 3cb9aba..e428fb0 100644 --- a/lustre/tests/rw_seq_cst_vs_drop_caches.c +++ b/lustre/tests/rw_seq_cst_vs_drop_caches.c @@ -21,7 +21,7 @@ int mmap_mode; /* -m flag */ -void usage(void) +static void usage(void) { fprintf(stdout, "%s: rw_seq_cst_vs_drop_caches [-m] /mnt/lustre/file0 /mnt/lustre2/file0\n" diff --git a/lustre/tests/rwv.c b/lustre/tests/rwv.c index 331586d..4cbbd66 100644 --- a/lustre/tests/rwv.c +++ b/lustre/tests/rwv.c @@ -53,7 +53,7 @@ #define ACT_VERIFY 16 #define ACT_OUTPUT 32 -void usage() +static void usage(void) { printf("usage: rwv -f filename <-r|-w> [-a] [-z] [-d] [-v]"); printf(" [-s offset] [-o[outf]] -n iovcnt SIZE1 SIZE2 SIZE3...\n"); @@ -67,7 +67,7 @@ void usage() printf("-o write the file content of read to an optional file\n"); } -int data_verify(struct iovec *iov, int iovcnt, char c) +static int data_verify(struct iovec *iov, int iovcnt, char c) { int i; diff --git a/lustre/tests/splice-test.c b/lustre/tests/splice-test.c index 09ae140c..a877cd4 100644 --- a/lustre/tests/splice-test.c +++ b/lustre/tests/splice-test.c @@ -21,7 +21,7 @@ #define SECTOR_SIZE (sysconf(_SC_PAGESIZE)) #define BUFFER_SIZE (150 * SECTOR_SIZE) -void read_from_pipe(int fd, const char *filename, size_t size) +static void read_from_pipe(int fd, const char *filename, size_t size) { char buffer[SECTOR_SIZE]; size_t sz; @@ -42,7 +42,7 @@ void read_from_pipe(int fd, const char *filename, size_t size) } } -void do_splice1(int fd, const char *filename, size_t size) +static void do_splice1(int fd, const char *filename, size_t size) { bool retried = false; int pipefd[2]; @@ -69,7 +69,7 @@ void do_splice1(int fd, const char *filename, size_t size) close(pipefd[1]); } -void do_splice2(int fd, const char *filename, size_t size) +static void do_splice2(int fd, const char *filename, size_t size) { bool retried = false; int pipefd[2]; @@ -105,7 +105,7 @@ void do_splice2(int fd, const char *filename, size_t size) } } -void usage(const char *argv0) +static void usage(const char *argv0) { fprintf(stderr, "USAGE: %s [-rd] {filename}\n", basename(argv0)); exit(2); diff --git a/lustre/tests/statx.c b/lustre/tests/statx.c index dc9f573..7a98b33 100644 --- a/lustre/tests/statx.c +++ b/lustre/tests/statx.c @@ -205,7 +205,7 @@ static inline unsigned char to_uchar(char ch) return ch; } -void usage(char *prog) +static void usage(char *prog) { printf("Usage: %s [options] ...\n", prog); printf("Display file status via statx() syscall.\n" diff --git a/lustre/tests/swap_lock_test.c b/lustre/tests/swap_lock_test.c index e79b4d8..f7760ee 100644 --- a/lustre/tests/swap_lock_test.c +++ b/lustre/tests/swap_lock_test.c @@ -110,7 +110,7 @@ static char *create_file_name(const char *name) /* Create a file of a given size in the test directory, filed with * c. Will assert on error. */ -int create_file(const char *name, size_t size, unsigned char c) +static int create_file(const char *name, size_t size, unsigned char c) { int fd; char *filename; diff --git a/lustre/tests/test_brw.c b/lustre/tests/test_brw.c index c5d3395..af400b6 100644 --- a/lustre/tests/test_brw.c +++ b/lustre/tests/test_brw.c @@ -51,7 +51,7 @@ #define WRITE 2 #define LPDS sizeof(uint64_t) -int block_debug_setup(void *addr, int len, uint64_t off, uint64_t id) +static int block_debug_setup(void *addr, int len, uint64_t off, uint64_t id) { off = htole64(off); id = htole64(id); @@ -65,7 +65,7 @@ int block_debug_setup(void *addr, int len, uint64_t off, uint64_t id) return 0; } -int block_debug_check(char *who, void *addr, int size, uint64_t off, +static int block_debug_check(char *who, void *addr, int size, uint64_t off, uint64_t id) { uint64_t ne_off; @@ -101,7 +101,7 @@ int block_debug_check(char *who, void *addr, int size, uint64_t off, #undef LPDS -void usage(char *prog) +static void usage(char *prog) { fprintf(stderr, "usage: %s file count [[d]{r|w|rw} [pages_per_vec [objid]]]\n", diff --git a/lustre/tests/unlinkmany.c b/lustre/tests/unlinkmany.c index f83ba57..be6a9d6 100644 --- a/lustre/tests/unlinkmany.c +++ b/lustre/tests/unlinkmany.c @@ -38,7 +38,7 @@ #include #include -void usage(char *prog) +static void usage(char *prog) { printf("usage: %s [option] filenamefmt count\n", prog); printf(" %s [option] filenamefmt start count\n", prog); diff --git a/lustre/tests/utime.c b/lustre/tests/utime.c index 17c37d9..79fa26f 100644 --- a/lustre/tests/utime.c +++ b/lustre/tests/utime.c @@ -43,7 +43,7 @@ #include #include -void usage(char *prog) +static void usage(char *prog) { fprintf(stderr, "usage: %s [-s ]\n", prog); exit(1); diff --git a/lustre/tests/write_time_limit.c b/lustre/tests/write_time_limit.c index 6384cf2..049220b 100644 --- a/lustre/tests/write_time_limit.c +++ b/lustre/tests/write_time_limit.c @@ -49,7 +49,7 @@ volatile sig_atomic_t keep_going = 1; /* The signal handler just clears the flag and re-enables itself. */ -void catch_alarm(int sig) +static void catch_alarm(int sig) { keep_going = 0; signal(sig, catch_alarm); diff --git a/lustre/tests/writemany.c b/lustre/tests/writemany.c index 3615500..05678be 100644 --- a/lustre/tests/writemany.c +++ b/lustre/tests/writemany.c @@ -45,7 +45,7 @@ char cmdname[512]; int o_abort; int o_quiet; -void usage(char *name) +static void usage(char *name) { fprintf(stderr, "usage: %s [opts] \n", name); @@ -61,7 +61,7 @@ struct kid_list_t { struct kid_list_t *head; -int push_kid(pid_t kid) +static int push_kid(pid_t kid) { struct kid_list_t *new; @@ -75,7 +75,7 @@ int push_kid(pid_t kid) return 0; } -void kill_kids(void) +static void kill_kids(void) { while (head) { kill(head->kid, SIGTERM); @@ -84,13 +84,13 @@ void kill_kids(void) } static int usr1_received; -void usr1_handler(int unused) +static void usr1_handler(int unused) { usr1_received = 1; kill_kids(); } -int wait_for_threads(int live_threads) +static int wait_for_threads(int live_threads) { int rc = 0; @@ -138,14 +138,14 @@ int wait_for_threads(int live_threads) return rc; } -void print_err(char *op, char *filename, struct timeval *time, int err) +static void print_err(char *op, char *filename, struct timeval *time, int err) { fprintf(stderr, "%s: %d.%.06d error: %s(%s): %s\n", cmdname, (int)(time->tv_sec), (int)(time->tv_usec), op, filename, strerror(errno)); } -int run_one_child(char *file, int thread, int seconds) +static int run_one_child(char *file, int thread, int seconds) { struct timeval start, cur; double diff; diff --git a/lustre/tests/writeme.c b/lustre/tests/writeme.c index 38c7c37..ad5f14b 100644 --- a/lustre/tests/writeme.c +++ b/lustre/tests/writeme.c @@ -37,7 +37,7 @@ #include #include -void usage(char *prog) +static void usage(char *prog) { printf("usage: %s [-s] [-b ] filename\n", prog); exit(1);