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