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;
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;
}
/*
* 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;
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"
/*
* 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':
/* 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;
return 0;
}
-int get_stat(int fd, struct stat *st)
+static int get_stat(int fd, struct stat *st)
{
int rc = 0;
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;
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;
return rc;
}
-int create_hole(int fd)
+static int create_hole(int fd)
{
int rc;
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;
}
-int test_prealloc_nonsparse(int fd)
+static int test_prealloc_nonsparse(int fd)
{
int rc, mode;
loff_t offset, expected_new_size;
return rc;
}
-int test_prealloc_sparse(int fd)
+static int test_prealloc_sparse(int fd)
{
int rc, mode;
loff_t offset, expected_new_size;
#define MAX_HANDLE_SZ 128
-void usage(char *prog)
+static void usage(char *prog)
{
fprintf(stderr, "usage: %s <filepath> <mount2>\n",
prog);
}
/* 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;
/* 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;
#include <pwd.h>
#include <grp.h>
-void
+static void
usage(char *argv0, int help)
{
char *progname = strrchr(argv0, '/');
/* 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;
#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);
return filename;
}
-double now(void)
+static double now(void)
{
struct timeval tv;
gettimeofday(&tv, NULL);
#define S_SHIFT 12
#endif
-int usage(char *prog)
+static int usage(char *prog)
{
fprintf(stderr, "usage: %s <basename>\n", prog);
exit(1);
#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;
printf("%d: done\n", pid); \
}
-void catch_alarm()
+static void catch_alarm(int i)
{
fprintf(stderr, "lock timeout\n");
exit(124);
/**
* helper functions
*/
-int t_fcntl(int fd, int cmd, ...)
+static int t_fcntl(int fd, int cmd, ...)
{
va_list ap;
long arg;
return rc;
}
-int t_unlink(const char *path)
+static int t_unlink(const char *path)
{
int rc;
*
* 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;
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;
return &ti->rc;
}
-void *t2_thread2(void *arg)
+static void *t2_thread2(void *arg)
{
struct thread_info *ti = arg;
struct flock *lock = ti->lock;
return &ti->rc;
}
-int t2(int argc, char *argv[])
+static int t2(int argc, char *argv[])
{
struct flock lock = {
.l_type = F_RDLCK,
* 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;
return rc;
}
-int t4(int argc, char *argv[])
+static int t4(int argc, char *argv[])
{
struct flock lock = {
.l_type = F_WRLCK,
" 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,
/** ==============================================================
* program entry
*/
-void usage(void)
+static void usage(void)
{
fprintf(stderr,
"usage: flocks_test test# [corresponding arguments]\n");
FILE *fsxlogf;
int badoff = -1;
-void
+static void
vwarnc(code, fmt, ap)
int code;
const char *fmt;
fprintf(stderr, "%s\n", strerror(code));
}
-void
+static void
__attribute__((format(__printf__, 1, 2)))
warn(const char *fmt, ...)
{
va_end(ap);
}
-void
+static void
__attribute__((format(__printf__, 1, 2)))
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;
logptr = 0;
}
-const char *
+static const char *
fill_tf_buf(const struct test_file *tf)
{
static int max_tf_len;
return tf_buf;
}
-void
+static void
logdump(void)
{
int i, count, down;
}
}
-void
+static void
save_buffer(char *buffer, off_t bufferlength, int fd)
{
off_t ret;
}
}
-void
+static void
report_failure(int status)
{
logdump();
#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;
}
}
-struct test_file *
+static struct test_file *
get_tf(void)
{
unsigned int index = 0;
return &test_files[index % num_test_files];
}
-void
+static void
assign_fd_policy(char *policy)
{
if (!strcmp(policy, "random")) {
}
}
-int
+static int
get_fd(void)
{
struct test_file *tf = get_tf();
return c ? c++ : path;
}
-void
+static void
open_test_files(char **argv, int argc)
{
struct test_file *tf;
prt("fd %d: %s\n", i, tf->path);
}
-void
+static void
close_test_files(void)
{
int i;
}
}
-void
+static void
check_size(void)
{
struct stat statbuf;
}
}
-void
+static void
check_trunc_hack(void)
{
struct stat statbuf;
}
}
-void
+static void
output_line(struct test_file *tf, int op, unsigned int offset,
unsigned int size)
{
(int)size < 0 ? -(int)size : size);
}
-void
+static void
mirror_output_line(struct test_file *tf, int op, int mirrors, int id)
{
if (!(!quiet &&
}
}
-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;
}
}
-void
+static void
doflush(unsigned int offset, unsigned int size)
{
unsigned int pg_offset;
output_debug(offset, size, "flush done");
}
-void
+static void
doread(unsigned int offset, unsigned int size)
{
off_t ret;
check_buffers(offset, size);
}
-void
+static void
check_eofpage(char *s, unsigned int offset, char *p, int size)
{
long last_page, should_be_zero;
}
}
-void
+static void
domapread(unsigned int offset, unsigned int size)
{
unsigned int pg_offset;
check_buffers(offset, size);
}
-void
+static void
gendata(char *original_buf, char *good_buf, unsigned int offset,
unsigned int size)
{
}
}
-void
+static void
dowrite(unsigned int offset, unsigned int size)
{
off_t ret;
}
}
-void
+static void
domapwrite(unsigned int offset, unsigned int size)
{
unsigned int pg_offset;
output_debug(offset, map_size, "munmap done");
}
-void
+static void
dotruncate(unsigned int size)
{
int oldsize = file_size;
output_debug(size, 0, "truncate done");
}
-void
+static void
do_punch_hole(unsigned int offset, unsigned int length)
{
int max_offset = 0;
memset(good_buf + max_offset, '\0', max_len);
}
-void
+static void
do_zero_range(unsigned int offset, unsigned int length)
{
unsigned int end_offset;
* 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;
output_debug(offset, length, "fallocate done");
}
-void
+static void
writefileimage()
{
ssize_t iret;
}
}
-void
+static void
docloseopen(void)
{
int direct = 0;
return rc < 0 ? rc : count;
}
-void
+static void
do_mirror_ops(int op)
{
int mirror_count;
(len) = (size) - (off); \
} while (0)
-void
+static void
test(void)
{
unsigned long offset;
check_size();
}
-void
+static void
segv(int sig)
{
if (jmpbuf_good) {
report_failure(9999);
}
-void
+static void
cleanup(sig)
int sig;
{
exit(sig);
}
-void
+static void
usage(void)
{
fprintf(stdout,
exit(90);
}
-int
+static int
getnum(char *s, char **e)
{
int ret = -1;
return (ret);
}
-int
+static int
test_fallocate(int mode)
{
int ret = 0;
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;
}
/* strsep() for argvs */
-char **arg_sep(char ***pargs, const char *delim)
+static char **arg_sep(char ***pargs, const char *delim)
{
char **begin, **end;
#include <string.h>
#include <errno.h>
-void usage(char *prog)
+static void usage(char *prog)
{
printf("Usage: %s <pathname> <xattr name>\n", prog);
}
#include <string.h>
#include <errno.h>
-void usage(char *prog)
+static void usage(char *prog)
{
printf("Usage: %s <pathname>\n", prog);
}
* 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;
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;
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;
#define BUFSIZE (1024 * 1024)
-void error(char *fmt, ...)
+static void error(char *fmt, ...)
{
va_list ap;
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;
/* 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;
}
/* Re-register */
-int test2(void)
+static int test2(void)
{
int rc;
struct hsm_copytool_private *ctdata1;
}
/* Bad parameters to llapi_hsm_copytool_register(). */
-int test3(void)
+static int test3(void)
{
int rc;
struct hsm_copytool_private *ctdata;
}
/* Bad parameters to llapi_hsm_copytool_unregister(). */
-int test4(void)
+static int test4(void)
{
int rc;
}
/* Test llapi_hsm_copytool_recv in non blocking mode */
-int test5(void)
+static int test5(void)
{
int rc;
int i;
}
/* 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;
}
/* Test polling (without actual traffic) */
-int test7(void)
+static int test7(void)
{
int rc;
struct hsm_copytool_private *ctdata;
}
/* Test llapi_hsm_state_get. */
-void test50(void)
+static void test50(void)
{
struct hsm_user_state hus;
int rc;
}
/* Test llapi_hsm_state_set. */
-void test51(void)
+static void test51(void)
{
int rc;
int fd;
}
/* Test llapi_hsm_current_action */
-void test52(void)
+static void test52(void)
{
int rc;
int fd;
/* 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)
{
}
/* Simple archive. No progress. */
-void test100(void)
+static void test100(void)
{
const size_t length = 100;
"length=%llu", (unsigned long long)hca.hca_location.length);
}
-void test101(void)
+static void test101(void)
{
const size_t length = 1000;
"length=%llu", (unsigned long long)hca.hca_location.length);
}
-void test102(void)
+static void test102(void)
{
const size_t length = 1000;
"length=%llu", (unsigned long long)hca.hca_location.length);
}
-void test103(void)
+static void test103(void)
{
const size_t length = 1000;
"length=%llu", (unsigned long long)hca.hca_location.length);
}
-void test104(void)
+static void test104(void)
{
const size_t length = 1000;
"length=%llu", (unsigned long long)hca.hca_location.length);
}
-void test105(void)
+static void test105(void)
{
const size_t length = 1000;
"length=%llu", (unsigned long long)hca.hca_location.length);
}
-void test106(void)
+static void test106(void)
{
const size_t length = 1000;
"length=%llu", (unsigned long long)hca.hca_location.length);
}
-void test107(void)
+static void test107(void)
{
const size_t length = 1000;
"length=%llu", (unsigned long long)hca.hca_location.length);
}
-void test108(void)
+static void test108(void)
{
const size_t length = 1000;
"length=%llu", (unsigned long long)hca.hca_location.length);
}
-void test109(void)
+static void test109(void)
{
const size_t length = 1000;
}
}
-void test110(void)
+static void test110(void)
{
const size_t length = 1000;
}
}
-void test111(void)
+static void test111(void)
{
const size_t length = 1000;
}
}
-void test112(void)
+static void test112(void)
{
const size_t length = 1000;
}
}
-void test113(void)
+static void test113(void)
{
const size_t length = 1000;
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",
#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;
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;
}
#define T1_DESC "Read test0 file by path and verify attributes"
-void test1(void)
+static void test1(void)
{
char path[PATH_MAX];
}
#define T2_DESC "Read test0 file by FD and verify attributes"
-void test2(void)
+static void test2(void)
{
int fd;
int rc;
}
#define T3_DESC "Read test0 file by FID and verify attributes"
-void test3(void)
+static void test3(void)
{
int rc;
struct llapi_layout *layout;
#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;
#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];
}
#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);
#define T7FILE "t7"
#define T7_DESC "llapi_layout_get_by_path EACCES handling"
-void test7(void)
+static void test7(void)
{
int fd;
int rc;
* 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;
/* 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;
/* 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;
/* 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;
/* 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;
#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;
/* 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();
#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;
/* 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;
/* 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;
/* 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;
}
#define T19_DESC "Maximum length pool name is NULL-terminated"
-void test19(void)
+static void test19(void)
{
struct llapi_layout *layout;
char *name = "0123456789abcde";
#define T20FILE "t20"
#define T20_DESC "LLAPI_LAYOUT_DEFAULT is honored"
-void test20(void)
+static void test20(void)
{
int rc;
int fd;
}
#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];
#define T22FILE "t22"
#define T22_DESC "llapi_layout_file_create applied mode correctly"
-void test22(void)
+static void test22(void)
{
int rc;
int fd;
}
#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];
* 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;
* 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;
#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;
#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;
* 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;
#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;
#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];
#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];
#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;
#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;
#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];
#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;
/* 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;
}
#define TEST1_THR_NBR 20
-void *test1_thr(void *arg)
+static void *test1_thr(void *arg)
{
char *fidstr = arg;
char path[PATH_MAX];
}
/* 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;
#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"
#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");
"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;
" 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;
{"", -1}
};
-int get_flags(char *data, int *rflags)
+static int get_flags(char *data, int *rflags)
{
char *cloned_flags;
char *tmp;
{"", -1}
};
-void Usage_and_abort(void)
+static void Usage_and_abort(void)
{
fprintf(stderr, "Usage: openfile -f flags [ -m mode ] filename\n");
fprintf(stderr,
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"
"\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);
" -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);
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"
#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");
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;
#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;
}
}
-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];
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];
}
}
-void usage(const char *argv0)
+static void usage(const char *argv0)
{
fprintf(stderr, "USAGE: %s [-rd] {filename}\n", basename(argv0));
exit(2);
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"
/* 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;
#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);
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;
#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",
#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);
#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);
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);
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);
struct kid_list_t *head;
-int push_kid(pid_t kid)
+static int push_kid(pid_t kid)
{
struct kid_list_t *new;
return 0;
}
-void kill_kids(void)
+static void kill_kids(void)
{
while (head) {
kill(head->kid, SIGTERM);
}
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;
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;
#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);