linux-btrfs.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH 0/4] btrfs-progs: tests: fix warnings during make test
@ 2023-06-23  7:58 Anand Jain
  2023-06-23  7:58 ` [PATCH 1/4] btrfs-progs: tests/fssum.c: fix missing prototype warning Anand Jain
                   ` (4 more replies)
  0 siblings, 5 replies; 6+ messages in thread
From: Anand Jain @ 2023-06-23  7:58 UTC (permalink / raw)
  To: linux-btrfs

This set of patches addresses the warnings when running the following commands:

  $ rm fssum fsstress
  $ make test

Ensure cleaner test suite for btrfs-progs.

Anand Jain (4):
  btrfs-progs: tests/fssum.c: fix missing prototype warning
  btrfs-progs: tests/fsstress.c: move do_mmap under HAVE_SYS_MMAN_H
  btrfs-progs: tests/fsstress.c: move do_fallocate under
    HAVE_LINUX_FALLOC_H
  btrfs-progs: tests/fsstress.c: move delete_subvol_children under
    HAVE_BTRFSUTIL_H

 tests/fsstress.c | 10 ++++++----
 tests/fssum.c    | 46 +++++++++++++++++++++++-----------------------
 2 files changed, 29 insertions(+), 27 deletions(-)

-- 
2.39.2


^ permalink raw reply	[flat|nested] 6+ messages in thread

* [PATCH 1/4] btrfs-progs: tests/fssum.c: fix missing prototype warning
  2023-06-23  7:58 [PATCH 0/4] btrfs-progs: tests: fix warnings during make test Anand Jain
@ 2023-06-23  7:58 ` Anand Jain
  2023-06-23  7:59 ` [PATCH 2/4] btrfs-progs: tests/fsstress.c: move do_mmap under HAVE_SYS_MMAN_H Anand Jain
                   ` (3 subsequent siblings)
  4 siblings, 0 replies; 6+ messages in thread
From: Anand Jain @ 2023-06-23  7:58 UTC (permalink / raw)
  To: linux-btrfs

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>
---
 tests/fssum.c | 46 +++++++++++++++++++++++-----------------------
 1 file changed, 23 insertions(+), 23 deletions(-)

diff --git a/tests/fssum.c b/tests/fssum.c
index e35c027424cd..bca33c7714cd 100644
--- a/tests/fssum.c
+++ b/tests/fssum.c
@@ -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;
-- 
2.39.2


^ permalink raw reply related	[flat|nested] 6+ messages in thread

* [PATCH 2/4] btrfs-progs: tests/fsstress.c: move do_mmap under HAVE_SYS_MMAN_H
  2023-06-23  7:58 [PATCH 0/4] btrfs-progs: tests: fix warnings during make test Anand Jain
  2023-06-23  7:58 ` [PATCH 1/4] btrfs-progs: tests/fssum.c: fix missing prototype warning Anand Jain
@ 2023-06-23  7:59 ` Anand Jain
  2023-06-23  7:59 ` [PATCH 3/4] btrfs-progs: tests/fsstress.c: move do_fallocate under HAVE_LINUX_FALLOC_H Anand Jain
                   ` (2 subsequent siblings)
  4 siblings, 0 replies; 6+ messages in thread
From: Anand Jain @ 2023-06-23  7:59 UTC (permalink / raw)
  To: linux-btrfs

Move the entire 'do_mmap' function under the 'HAVE_SYS_MMAN_H' define
and fix the following warnings. This function is called only when
'HAVE_SYS_MMAN_H' is defined.

tests/fsstress.c:4363:1: warning: ‘do_mmap’ defined but not used [-Wunused-function]
 4363 | do_mmap(opnum_t opno, long r, int prot)

Signed-off-by: Anand Jain <anand.jain@oracle.com>
---
 tests/fsstress.c | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

diff --git a/tests/fsstress.c b/tests/fsstress.c
index f7d3a83a4e2e..692d7cfacaf4 100644
--- a/tests/fsstress.c
+++ b/tests/fsstress.c
@@ -4359,10 +4359,10 @@ struct print_flags mmap_flags[] = {
 	({translate_flags(flags, "|", mmap_flags);})
 #endif
 
+#ifdef HAVE_SYS_MMAN_H
 static void
 do_mmap(opnum_t opno, long r, int prot)
 {
-#ifdef HAVE_SYS_MMAN_H
 	char		*addr;
 	int		e;
 	pathname_t	f;
@@ -4454,8 +4454,8 @@ do_mmap(opnum_t opno, long r, int prot)
 
 	free_pathname(&f);
 	close(fd);
-#endif
 }
+#endif
 
 void
 mread_f(opnum_t opno, long r)
-- 
2.39.2


^ permalink raw reply related	[flat|nested] 6+ messages in thread

* [PATCH 3/4] btrfs-progs: tests/fsstress.c: move do_fallocate under HAVE_LINUX_FALLOC_H
  2023-06-23  7:58 [PATCH 0/4] btrfs-progs: tests: fix warnings during make test Anand Jain
  2023-06-23  7:58 ` [PATCH 1/4] btrfs-progs: tests/fssum.c: fix missing prototype warning Anand Jain
  2023-06-23  7:59 ` [PATCH 2/4] btrfs-progs: tests/fsstress.c: move do_mmap under HAVE_SYS_MMAN_H Anand Jain
@ 2023-06-23  7:59 ` Anand Jain
  2023-06-23  7:59 ` [PATCH 4/4] btrfs-progs: tests/fsstress.c: move delete_subvol_children under HAVE_BTRFSUTIL_H Anand Jain
  2023-06-28 19:45 ` [PATCH 0/4] btrfs-progs: tests: fix warnings during make test David Sterba
  4 siblings, 0 replies; 6+ messages in thread
From: Anand Jain @ 2023-06-23  7:59 UTC (permalink / raw)
  To: linux-btrfs

Move the entire 'do_fallocate' function under the 'HAVE_LINUX_FALLOC_H'
define and fix the following warnings. This function is called only when
'HAVE_LINUX_FALLOC_H' is defined.

tests/fsstress.c:3814:1: warning: ‘do_fallocate’ defined but not used [-Wunused-function]
 3814 | do_fallocate(opnum_t opno, long r, int mode)

Signed-off-by: Anand Jain <anand.jain@oracle.com>
---
 tests/fsstress.c | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

diff --git a/tests/fsstress.c b/tests/fsstress.c
index 692d7cfacaf4..5fd347ccf1d4 100644
--- a/tests/fsstress.c
+++ b/tests/fsstress.c
@@ -3810,10 +3810,10 @@ struct print_flags falloc_flags [] = {
 	({translate_flags(mode, "|", falloc_flags);})
 #endif
 
+#ifdef HAVE_LINUX_FALLOC_H
 static void
 do_fallocate(opnum_t opno, long r, int mode)
 {
-#ifdef HAVE_LINUX_FALLOC_H
 	int		e;
 	pathname_t	f;
 	int		fd;
@@ -3870,8 +3870,8 @@ do_fallocate(opnum_t opno, long r, int mode)
 		       f.path, st, (long long)off, (long long)len, e);
 	free_pathname(&f);
 	close(fd);
-#endif
 }
+#endif
 
 void
 fallocate_f(opnum_t opno, long r)
-- 
2.39.2


^ permalink raw reply related	[flat|nested] 6+ messages in thread

* [PATCH 4/4] btrfs-progs: tests/fsstress.c: move delete_subvol_children under HAVE_BTRFSUTIL_H
  2023-06-23  7:58 [PATCH 0/4] btrfs-progs: tests: fix warnings during make test Anand Jain
                   ` (2 preceding siblings ...)
  2023-06-23  7:59 ` [PATCH 3/4] btrfs-progs: tests/fsstress.c: move do_fallocate under HAVE_LINUX_FALLOC_H Anand Jain
@ 2023-06-23  7:59 ` Anand Jain
  2023-06-28 19:45 ` [PATCH 0/4] btrfs-progs: tests: fix warnings during make test David Sterba
  4 siblings, 0 replies; 6+ messages in thread
From: Anand Jain @ 2023-06-23  7:59 UTC (permalink / raw)
  To: linux-btrfs

Bring the  'delete_subvol_children' function under the HAVE_BTRFSUTIL_H
define and fix the following warnings. This function is called only when
'HAVE_BTRFSUTILS_H' is defined.

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>
---
 tests/fsstress.c | 2 ++
 1 file changed, 2 insertions(+)

diff --git a/tests/fsstress.c b/tests/fsstress.c
index 5fd347ccf1d4..3b8cde847aa1 100644
--- a/tests/fsstress.c
+++ b/tests/fsstress.c
@@ -1179,6 +1179,7 @@ del_from_flist(int ft, int slot)
 		ftp->nfiles--;
 }
 
+#ifdef HAVE_BTRFSUTIL_H
 static void
 delete_subvol_children(int parid)
 {
@@ -1198,6 +1199,7 @@ again:
 		}
 	}
 }
+#endif
 
 static fent_t *
 dirid_to_fent(int dirid)
-- 
2.39.2


^ permalink raw reply related	[flat|nested] 6+ messages in thread

* Re: [PATCH 0/4] btrfs-progs: tests: fix warnings during make test
  2023-06-23  7:58 [PATCH 0/4] btrfs-progs: tests: fix warnings during make test Anand Jain
                   ` (3 preceding siblings ...)
  2023-06-23  7:59 ` [PATCH 4/4] btrfs-progs: tests/fsstress.c: move delete_subvol_children under HAVE_BTRFSUTIL_H Anand Jain
@ 2023-06-28 19:45 ` David Sterba
  4 siblings, 0 replies; 6+ messages in thread
From: David Sterba @ 2023-06-28 19:45 UTC (permalink / raw)
  To: Anand Jain; +Cc: linux-btrfs

On Fri, Jun 23, 2023 at 03:58:58PM +0800, Anand Jain wrote:
> This set of patches addresses the warnings when running the following commands:
> 
>   $ rm fssum fsstress
>   $ make test
> 
> Ensure cleaner test suite for btrfs-progs.
> 
> Anand Jain (4):
>   btrfs-progs: tests/fssum.c: fix missing prototype warning
>   btrfs-progs: tests/fsstress.c: move do_mmap under HAVE_SYS_MMAN_H
>   btrfs-progs: tests/fsstress.c: move do_fallocate under
>     HAVE_LINUX_FALLOC_H
>   btrfs-progs: tests/fsstress.c: move delete_subvol_children under
>     HAVE_BTRFSUTIL_H

Added to devel, thanks.

^ permalink raw reply	[flat|nested] 6+ messages in thread

end of thread, other threads:[~2023-06-28 19:52 UTC | newest]

Thread overview: 6+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2023-06-23  7:58 [PATCH 0/4] btrfs-progs: tests: fix warnings during make test Anand Jain
2023-06-23  7:58 ` [PATCH 1/4] btrfs-progs: tests/fssum.c: fix missing prototype warning Anand Jain
2023-06-23  7:59 ` [PATCH 2/4] btrfs-progs: tests/fsstress.c: move do_mmap under HAVE_SYS_MMAN_H Anand Jain
2023-06-23  7:59 ` [PATCH 3/4] btrfs-progs: tests/fsstress.c: move do_fallocate under HAVE_LINUX_FALLOC_H Anand Jain
2023-06-23  7:59 ` [PATCH 4/4] btrfs-progs: tests/fsstress.c: move delete_subvol_children under HAVE_BTRFSUTIL_H Anand Jain
2023-06-28 19:45 ` [PATCH 0/4] btrfs-progs: tests: fix warnings during make test David Sterba

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).