btrfs-progs: tests: fix missing prototype warnings in fssum.c

Annoying warnings when running 'make test' from the file tests/fssum.c.
gcc version 8.5.0. Fix the it by declaring the corresponding functions as static.

$ rm fssum
$ make TEST=001\* test-misc
::
tests/fssum.c:86:1: warning: no previous prototype for ‘getln’ [-Wmissing-prototypes]
   86 | getln(char *buf, int size, FILE *fp)
      | ^~~~~
tests/fssum.c:103:1: warning: no previous prototype for ‘parse_flag’ [-Wmissing-prototypes]
  103 | parse_flag(int c)
      | ^~~~~~~~~~
tests/fssum.c:123:1: warning: no previous prototype for ‘parse_flags’ [-Wmissing-prototypes]
  123 | parse_flags(char *p)
      | ^~~~~~~~~~~
tests/fssum.c:130:1: warning: no previous prototype for ‘usage’ [-Wmissing-prototypes]
  130 | usage(void)
      | ^~~~~
tests/fssum.c:163:1: warning: no previous prototype for ‘alloc’ [-Wmissing-prototypes]
  163 | alloc(size_t sz)
      | ^~~~~
tests/fssum.c:176:1: warning: no previous prototype for ‘sum_init’ [-Wmissing-prototypes]
  176 | sum_init(sum_t *cs)
      | ^~~~~~~~
tests/fssum.c:182:1: warning: no previous prototype for ‘sum_fini’ [-Wmissing-prototypes]
  182 | sum_fini(sum_t *cs)
      | ^~~~~~~~
tests/fssum.c:188:1: warning: no previous prototype for ‘sum_add’ [-Wmissing-prototypes]
  188 | sum_add(sum_t *cs, void *buf, int size)
      | ^~~~~~~
tests/fssum.c:194:1: warning: no previous prototype for ‘sum_add_sum’ [-Wmissing-prototypes]
  194 | sum_add_sum(sum_t *dst, sum_t *src)
      | ^~~~~~~~~~~
tests/fssum.c:200:1: warning: no previous prototype for ‘sum_add_u64’ [-Wmissing-prototypes]
  200 | sum_add_u64(sum_t *dst, uint64_t val)
      | ^~~~~~~~~~~
tests/fssum.c:207:1: warning: no previous prototype for ‘sum_add_time’ [-Wmissing-prototypes]
  207 | sum_add_time(sum_t *dst, time_t t)
      | ^~~~~~~~~~~~
tests/fssum.c:213:1: warning: no previous prototype for ‘sum_to_string’ [-Wmissing-prototypes]
  213 | sum_to_string(sum_t *dst)
      | ^~~~~~~~~~~~~
tests/fssum.c:225:1: warning: no previous prototype for ‘namecmp’ [-Wmissing-prototypes]
  225 | namecmp(const void *aa, const void *bb)
      | ^~~~~~~
tests/fssum.c:234:1: warning: no previous prototype for ‘sum_xattrs’ [-Wmissing-prototypes]
  234 | sum_xattrs(int fd, sum_t *dst)
      | ^~~~~~~~~~
tests/fssum.c:325:1: warning: no previous prototype for ‘sum_file_data_permissive’ [-Wmissing-prototypes]
  325 | sum_file_data_permissive(int fd, sum_t *dst)
      | ^~~~~~~~~~~~~~~~~~~~~~~~
tests/fssum.c:341:1: warning: no previous prototype for ‘sum_file_data_strict’ [-Wmissing-prototypes]
  341 | sum_file_data_strict(int fd, sum_t *dst)
      | ^~~~~~~~~~~~~~~~~~~~
tests/fssum.c:369:1: warning: no previous prototype for ‘escape’ [-Wmissing-prototypes]
  369 | escape(char *in)
      | ^~~~~~
tests/fssum.c:389:1: warning: no previous prototype for ‘excess_file’ [-Wmissing-prototypes]
  389 | excess_file(const char *fn)
      | ^~~~~~~~~~~
tests/fssum.c:395:1: warning: no previous prototype for ‘missing_file’ [-Wmissing-prototypes]
  395 | missing_file(const char *fn)
      | ^~~~~~~~~~~~
tests/fssum.c:401:1: warning: no previous prototype for ‘pathcmp’ [-Wmissing-prototypes]
  401 | pathcmp(const char *a, const char *b)
      | ^~~~~~~
tests/fssum.c:419:1: warning: no previous prototype for ‘check_match’ [-Wmissing-prototypes]
  419 | check_match(char *fn, char *local_m, char *remote_m,
      | ^~~~~~~~~~~
tests/fssum.c:438:1: warning: no previous prototype for ‘check_manifest’ [-Wmissing-prototypes]
  438 | check_manifest(char *fn, char *m, char *c, int last_call)
      | ^~~~~~~~~~~~~~
tests/fssum.c:509:1: warning: no previous prototype for ‘sum’ [-Wmissing-prototypes]
  509 | sum(int dirfd, int level, sum_t *dircs, char *path_prefix, char *path_in)
      | ^~~
    [LD]     fsstress
tests/fsstress.c:4363:1: warning: ‘do_mmap’ defined but not used [-Wunused-function]
 4363 | do_mmap(opnum_t opno, long r, int prot)
      | ^~~~~~~
tests/fsstress.c:3814:1: warning: ‘do_fallocate’ defined but not used [-Wunused-function]
 3814 | do_fallocate(opnum_t opno, long r, int mode)
      | ^~~~~~~~~~~~
tests/fsstress.c:1183:1: warning: ‘delete_subvol_children’ defined but not used [-Wunused-function]
 1183 | delete_subvol_children(int parid)

Signed-off-by: Anand Jain <anand.jain@oracle.com>
Signed-off-by: David Sterba <dsterba@suse.com>
This commit is contained in:
Anand Jain 2023-06-23 15:58:59 +08:00 committed by David Sterba
parent a0137082de
commit 3b8a552fd7

View File

@ -82,7 +82,7 @@ char line[65536];
int flags[NUM_FLAGS] = {1, 1, 1, 1, 1, 0, 1, 1, 0, 0};
char *
static char *
getln(char *buf, int size, FILE *fp)
{
char *p;
@ -99,7 +99,7 @@ getln(char *buf, int size, FILE *fp)
return p;
}
void
static void
parse_flag(int c)
{
int i;
@ -119,14 +119,14 @@ parse_flag(int c)
exit(-1);
}
void
static void
parse_flags(char *p)
{
while (*p)
parse_flag(*p++);
}
void
static void
usage(void)
{
fprintf(stderr, "usage: fssum <options> <path>\n");
@ -159,7 +159,7 @@ usage(void)
static char buf[65536];
void *
static void *
alloc(size_t sz)
{
void *p = malloc(sz);
@ -172,44 +172,44 @@ alloc(size_t sz)
return p;
}
void
static void
sum_init(sum_t *cs)
{
SHA256Reset(&cs->sha);
}
void
static void
sum_fini(sum_t *cs)
{
SHA256Result(&cs->sha, cs->out);
}
void
static void
sum_add(sum_t *cs, void *buf, int size)
{
SHA256Input(&cs->sha, buf, size);
}
void
static void
sum_add_sum(sum_t *dst, sum_t *src)
{
sum_add(dst, src->out, sizeof(src->out));
}
void
static void
sum_add_u64(sum_t *dst, uint64_t val)
{
uint64_t v = cpu_to_le64(val);
sum_add(dst, &v, sizeof(v));
}
void
static void
sum_add_time(sum_t *dst, time_t t)
{
sum_add_u64(dst, t);
}
char *
static char *
sum_to_string(sum_t *dst)
{
int i;
@ -221,7 +221,7 @@ sum_to_string(sum_t *dst)
return s;
}
int
static int
namecmp(const void *aa, const void *bb)
{
char * const *a = aa;
@ -230,7 +230,7 @@ namecmp(const void *aa, const void *bb)
return strcmp(*a, *b);
}
int
static int
sum_xattrs(int fd, sum_t *dst)
{
ssize_t buflen;
@ -321,7 +321,7 @@ out:
return ret;
}
int
static int
sum_file_data_permissive(int fd, sum_t *dst)
{
int ret;
@ -337,7 +337,7 @@ sum_file_data_permissive(int fd, sum_t *dst)
return 0;
}
int
static int
sum_file_data_strict(int fd, sum_t *dst)
{
int ret;
@ -365,7 +365,7 @@ sum_file_data_strict(int fd, sum_t *dst)
}
}
char *
static char *
escape(char *in)
{
char *out = alloc(strlen(in) * 3 + 1);
@ -385,19 +385,19 @@ escape(char *in)
return out;
}
void
static void
excess_file(const char *fn)
{
printf("only in local fs: %s\n", fn);
}
void
static void
missing_file(const char *fn)
{
printf("only in remote fs: %s\n", fn);
}
int
static int
pathcmp(const char *a, const char *b)
{
int len_a = strlen(a);
@ -415,7 +415,7 @@ pathcmp(const char *a, const char *b)
return strcmp(a, b);
}
void
static void
check_match(char *fn, char *local_m, char *remote_m,
char *local_c, char *remote_c)
{
@ -434,7 +434,7 @@ check_match(char *fn, char *local_m, char *remote_m,
char *prev_fn;
char *prev_m;
char *prev_c;
void
static void
check_manifest(char *fn, char *m, char *c, int last_call)
{
char *rem_m;
@ -505,7 +505,7 @@ malformed:
excess_file(fn);
}
void
static void
sum(int dirfd, int level, sum_t *dircs, char *path_prefix, char *path_in)
{
DIR *d;