Whamcloud - gitweb
LU-8191 tests: convert functions to static 33/51433/3
authorTimothy Day <timday@amazon.com>
Fri, 23 Jun 2023 20:39:12 +0000 (20:39 +0000)
committerOleg Drokin <green@whamcloud.com>
Sat, 8 Jul 2023 22:41:22 +0000 (22:41 +0000)
Static analysis shows that a number of functions
could be made static. This patch declares several
functions in various test helpers static.

Test-Parameters: trivial
Signed-off-by: Timothy Day <timday@amazon.com>
Change-Id: I065fb4398ed1670ce6ad58cf946054f6bd1ec282
Reviewed-on: https://review.whamcloud.com/c/fs/lustre-release/+/51433
Tested-by: jenkins <devops@whamcloud.com>
Tested-by: Maloo <maloo@whamcloud.com>
Reviewed-by: Andreas Dilger <adilger@whamcloud.com>
Reviewed-by: Petros Koutoupis <petros.koutoupis@hpe.com>
Reviewed-by: Oleg Drokin <green@whamcloud.com>
39 files changed:
lustre/tests/aiocp.c
lustre/tests/check_fallocate.c
lustre/tests/check_fhandle_syscalls.c
lustre/tests/checkfiemap.c
lustre/tests/checkstat.c
lustre/tests/chownmany.c
lustre/tests/createmany.c
lustre/tests/createtest.c
lustre/tests/euid_access.c
lustre/tests/flock_deadlock.c
lustre/tests/flocks_test.c
lustre/tests/fsx.c
lustre/tests/iabf/iabf.c
lustre/tests/lgetxattr_size_check.c
lustre/tests/listxattr_size_check.c
lustre/tests/ll_dirstripe_verify.c
lustre/tests/ll_sparseness_verify.c
lustre/tests/llapi_hsm_test.c
lustre/tests/llapi_layout_test.c
lustre/tests/llapi_root_test.c
lustre/tests/lockahead_test.c
lustre/tests/mcreate.c
lustre/tests/memhog.c
lustre/tests/mmap_cat.c
lustre/tests/multiop.c
lustre/tests/openfile.c
lustre/tests/rename_many.c
lustre/tests/runas.c
lustre/tests/rw_seq_cst_vs_drop_caches.c
lustre/tests/rwv.c
lustre/tests/splice-test.c
lustre/tests/statx.c
lustre/tests/swap_lock_test.c
lustre/tests/test_brw.c
lustre/tests/unlinkmany.c
lustre/tests/utime.c
lustre/tests/write_time_limit.c
lustre/tests/writemany.c
lustre/tests/writeme.c

index 2f39408..e5ea7a6 100644 (file)
@@ -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':
index 4de7345..72f27ad 100644 (file)
 /* global */
 loff_t blksize;
 
-void usage(char *prog)
+static void usage(char *prog)
 {
        fprintf(stderr, "usage: %s <filepath>\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;
index 63fbc26..2fdd124 100644 (file)
@@ -47,7 +47,7 @@
 
 #define MAX_HANDLE_SZ 128
 
-void usage(char *prog)
+static void usage(char *prog)
 {
        fprintf(stderr, "usage: %s <filepath> <mount2>\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;
index 2dea812..59284ae 100644 (file)
@@ -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;
index 203ff02..4cc845e 100644 (file)
@@ -44,7 +44,7 @@
 #include <pwd.h>
 #include <grp.h>
 
-void
+static void
 usage(char *argv0, int help)
 {
        char *progname = strrchr(argv0, '/');
@@ -78,7 +78,7 @@ usage(char *argv0, int help)
 /* using realpath() implies the paths must be resolved/exist
  * so this will fail for dangling links
  */
-int check_canonical(char *lname, char *checklink, int verbose)
+static int check_canonical(char *lname, char *checklink, int verbose)
 {
        char *lname_canon;
        char *checklink_canon;
index c01e99c..2a910da 100644 (file)
@@ -37,7 +37,7 @@
 #include <unistd.h>
 #include <stdlib.h>
 
-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);
index 7367d0c..be3fed6 100644 (file)
@@ -75,7 +75,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);
index 15146f5..a39fbbc 100644 (file)
@@ -40,7 +40,7 @@
 #define S_SHIFT 12
 #endif
 
-int usage(char *prog)
+static int usage(char *prog)
 {
        fprintf(stderr, "usage: %s <basename>\n", prog);
        exit(1);
index 1e20b74..744dd75 100644 (file)
@@ -33,7 +33,7 @@
 #include <grp.h>
 #include <fcntl.h>
 
-void print_groups(int num_groups, gid_t *groups)
+static void print_groups(int num_groups, gid_t *groups)
 {
        int i;
 
index 8a85802..7692455 100644 (file)
@@ -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);
index e6fc12e..c82f635 100644 (file)
@@ -44,7 +44,7 @@
 /**
  * helper functions
  */
-int t_fcntl(int fd, int cmd, ...)
+static int t_fcntl(int fd, int cmd, ...)
 {
        va_list ap;
        long arg;
@@ -106,7 +106,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;
 
@@ -122,13 +122,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;
@@ -197,7 +197,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;
@@ -218,7 +218,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;
@@ -240,7 +240,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,
@@ -301,7 +301,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;
@@ -380,7 +380,7 @@ out:
        return rc;
 }
 
-int t4(int argc, char *argv[])
+static int t4(int argc, char *argv[])
 {
        struct flock lock = {
                .l_type = F_WRLCK,
@@ -511,7 +511,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,
@@ -589,7 +589,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");
index 8c31179..d621295 100644 (file)
@@ -217,7 +217,7 @@ int page_mask;
 FILE *fsxlogf;
 int badoff = -1;
 
-void
+static void
 vwarnc(code, fmt, ap)
        int code;
        const char *fmt;
@@ -231,7 +231,7 @@ vwarnc(code, fmt, ap)
        fprintf(stderr, "%s\n", strerror(code));
 }
 
-void
+static void
 __attribute__((format(__printf__, 1, 2)))
 warn(const char *fmt, ...)
 {
@@ -242,7 +242,7 @@ warn(const char *fmt, ...)
        va_end(ap);
 }
 
-void
+static void
 __attribute__((format(__printf__, 1, 2)))
 prt(char *fmt, ...)
 {
@@ -264,14 +264,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;
@@ -290,7 +290,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;
@@ -309,7 +309,7 @@ fill_tf_buf(const struct test_file *tf)
        return tf_buf;
 }
 
-void
+static void
 logdump(void)
 {
        int i, count, down;
@@ -436,7 +436,7 @@ logdump(void)
        }
 }
 
-void
+static void
 save_buffer(char *buffer, off_t bufferlength, int fd)
 {
        off_t ret;
@@ -477,7 +477,7 @@ save_buffer(char *buffer, off_t bufferlength, int fd)
        }
 }
 
-void
+static void
 report_failure(int status)
 {
        logdump();
@@ -498,7 +498,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;
@@ -542,7 +542,7 @@ check_buffers(unsigned int offset, unsigned int size)
        }
 }
 
-struct test_file *
+static struct test_file *
 get_tf(void)
 {
        unsigned int index = 0;
@@ -565,7 +565,7 @@ get_tf(void)
        return &test_files[index % num_test_files];
 }
 
-void
+static void
 assign_fd_policy(char *policy)
 {
        if (!strcmp(policy, "random")) {
@@ -578,7 +578,7 @@ assign_fd_policy(char *policy)
        }
 }
 
-int
+static int
 get_fd(void)
 {
        struct test_file *tf = get_tf();
@@ -593,7 +593,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;
@@ -628,7 +628,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;
@@ -642,7 +642,7 @@ close_test_files(void)
        }
 }
 
-void
+static void
 check_size(void)
 {
        struct stat statbuf;
@@ -663,7 +663,7 @@ check_size(void)
        }
 }
 
-void
+static void
 check_trunc_hack(void)
 {
        struct stat statbuf;
@@ -692,7 +692,7 @@ check_trunc_hack(void)
        }
 }
 
-void
+static void
 output_line(struct test_file *tf, int op, unsigned int offset,
            unsigned int size)
 {
@@ -723,7 +723,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)
 {
        if (!(!quiet &&
@@ -747,7 +747,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;
 
@@ -759,7 +760,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;
@@ -792,7 +793,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;
@@ -842,7 +843,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;
@@ -869,7 +870,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;
@@ -928,7 +929,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)
 {
@@ -940,7 +941,7 @@ gendata(char *original_buf, char *good_buf, unsigned int offset,
        }
 }
 
-void
+static void
 dowrite(unsigned int offset, unsigned int size)
 {
        off_t ret;
@@ -1005,7 +1006,7 @@ dowrite(unsigned int offset, unsigned int size)
        }
 }
 
-void
+static void
 domapwrite(unsigned int offset, unsigned int size)
 {
        unsigned int pg_offset;
@@ -1080,7 +1081,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;
@@ -1114,7 +1115,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;
@@ -1159,7 +1160,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;
@@ -1215,7 +1216,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;
@@ -1269,7 +1270,7 @@ do_preallocate(unsigned int offset, unsigned int length)
        output_debug(offset, length, "fallocate done");
 }
 
-void
+static void
 writefileimage()
 {
        ssize_t iret;
@@ -1295,7 +1296,7 @@ writefileimage()
        }
 }
 
-void
+static void
 docloseopen(void)
 {
        int direct = 0;
@@ -1379,7 +1380,7 @@ free:
        return rc < 0 ? rc : count;
 }
 
-void
+static void
 do_mirror_ops(int op)
 {
        int mirror_count;
@@ -1499,7 +1500,7 @@ do {                                      \
                (len) = (size) - (off); \
 } while (0)
 
-void
+static void
 test(void)
 {
        unsigned long offset;
@@ -1614,7 +1615,7 @@ out:
                check_size();
 }
 
-void
+static void
 segv(int sig)
 {
        if (jmpbuf_good) {
@@ -1624,7 +1625,7 @@ segv(int sig)
        report_failure(9999);
 }
 
-void
+static void
 cleanup(sig)
        int     sig;
 {
@@ -1634,7 +1635,7 @@ cleanup(sig)
        exit(sig);
 }
 
-void
+static void
 usage(void)
 {
        fprintf(stdout,
@@ -1694,7 +1695,7 @@ usage(void)
        exit(90);
 }
 
-int
+static int
 getnum(char *s, char **e)
 {
        int ret = -1;
@@ -1727,7 +1728,7 @@ getnum(char *s, char **e)
        return (ret);
 }
 
-int
+static int
 test_fallocate(int mode)
 {
        int ret = 0;
index 39eb242..4b24ecb 100644 (file)
@@ -104,7 +104,7 @@ struct iabf_task {
        char **it_argv;
 };
 
-long iabf_getenvl(const char *name, long def)
+static long iabf_getenvl(const char *name, long def)
 {
        const char *s = getenv(name);
        return s != NULL ? atol(s) : def;
@@ -388,7 +388,7 @@ static int iabf(struct iabf_control *ic, char **a, char **b)
 }
 
 /* strsep() for argvs */
-char **arg_sep(char ***pargs, const char *delim)
+static char **arg_sep(char ***pargs, const char *delim)
 {
        char **begin, **end;
 
index 2c674dc..08b25ef 100644 (file)
@@ -5,7 +5,7 @@
 #include <string.h>
 #include <errno.h>
 
-void usage(char *prog)
+static void usage(char *prog)
 {
        printf("Usage: %s <pathname> <xattr name>\n", prog);
 }
index 5124a3a..b9eafb1 100644 (file)
@@ -33,7 +33,7 @@
 #include <string.h>
 #include <errno.h>
 
-void usage(char *prog)
+static void usage(char *prog)
 {
        printf("Usage: %s <pathname>\n", prog);
 }
index 3a26e67..e6d4472 100644 (file)
@@ -58,7 +58,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;
 
@@ -89,7 +89,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;
@@ -205,7 +205,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;
index fb954da..4dbf589 100644 (file)
@@ -46,7 +46,7 @@
 
 #define BUFSIZE (1024 * 1024)
 
-void error(char *fmt, ...)
+static void error(char *fmt, ...)
 {
        va_list ap;
 
@@ -56,7 +56,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;
index 2d4ab13..5994431 100644 (file)
@@ -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;
 
@@ -1049,7 +1049,7 @@ static void test113_progress(struct hsm_copyaction_private *hcp, size_t length)
        }
 }
 
-void test113(void)
+static void test113(void)
 {
        const size_t length = 1000;
 
index f875f91..c402b58 100644 (file)
@@ -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;
index 0867e82..628dac4 100644 (file)
@@ -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];
index f3b8e51..3373242 100644 (file)
@@ -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;
index ce88321..62f8831 100644 (file)
@@ -37,7 +37,7 @@
 #include <unistd.h>
 #include <getopt.h>
 
-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"
index 752bb2a..ce3a914 100644 (file)
@@ -34,7 +34,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");
index ca2e55e..0fb1edb 100644 (file)
@@ -45,7 +45,7 @@ char usage[] =
 "Usage: %s <file>\n"
 "       mmap <file> and cat its content\n";
 
-size_t getFilesize(const char *filename)
+static size_t getFilesize(const char *filename)
 {
        struct stat st;
 
index 5241027..719f41f 100644 (file)
@@ -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;
index 593e295..eff1a8f 100644 (file)
@@ -69,7 +69,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,
index 719e630..6e1164e 100644 (file)
@@ -59,7 +59,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"
@@ -71,7 +71,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);
 
index ff799eb..cd37147 100644 (file)
@@ -52,7 +52,7 @@ static const char usage[] =
 "  -j egid              switch egid to GID\n"
 "  -G[gid0,gid1,...]    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);
index 3cb9aba..e428fb0 100644 (file)
@@ -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"
index 90e9f87..a6f4e61 100644 (file)
@@ -52,7 +52,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");
@@ -66,7 +66,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;
 
index 09ae140..a877cd4 100644 (file)
@@ -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);
index d5c2e88..93466f1 100644 (file)
@@ -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] <FILE>...\n", prog);
        printf("Display file status via statx() syscall.\n"
index e79b4d8..f7760ee 100644 (file)
@@ -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;
index 14e790b..a99c7a6 100644 (file)
@@ -50,7 +50,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);
@@ -64,7 +64,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;
@@ -100,7 +100,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",
index 1cc3de5..9be3609 100644 (file)
@@ -37,7 +37,7 @@
 #include <unistd.h>
 #include <stdlib.h>
 
-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);
index 4295e5a..752dfcb 100644 (file)
@@ -42,7 +42,7 @@
 #include <utime.h>
 #include <errno.h>
 
-void usage(char *prog)
+static void usage(char *prog)
 {
        fprintf(stderr, "usage: %s <filename> [-s <filename>]\n", prog);
        exit(1);
index 0988f54..dfcc75a 100644 (file)
@@ -48,7 +48,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);
index 5790034..e0878de 100644 (file)
@@ -44,7 +44,7 @@ char cmdname[512];
 int o_abort;
 int o_quiet;
 
-void usage(char *name)
+static void usage(char *name)
 {
        fprintf(stderr, "usage: %s [opts] <dirname> <seconds> <threads>\n",
                name);
@@ -60,7 +60,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;
 
@@ -74,7 +74,7 @@ int push_kid(pid_t kid)
        return 0;
 }
 
-void kill_kids(void)
+static void kill_kids(void)
 {
        while (head) {
                kill(head->kid, SIGTERM);
@@ -83,13 +83,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;
 
@@ -137,14 +137,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;
index 0c9eaf2..1ee7634 100644 (file)
@@ -36,7 +36,7 @@
 #include <string.h>
 #include <stdbool.h>
 
-void usage(char *prog)
+static void usage(char *prog)
 {
        printf("usage: %s [-s] [-b <bytes>] filename\n", prog);
        exit(1);