Skip to contentSkip to conversation

ltp: eliminate more build warnings

PATCH Superseded Alex Elder 2 participants 9 messages Apr 8, 2011 – Apr 9, 2011 Library code

v1 of 3 Superseded Latest is v3 →

lore
Share & tools
lore

Alex Elder

author
#0 lore raw

cover ltp: eliminate more build warnings

This series eliminates a few more warnings I get when I build a few files in the LTP tree.

-Alex

------------------------------------------------------------------------------
Xperia(TM) PLAY
It's a major breakthrough. An authentic gaming smartphone on the nation's most reliable network. And it wants your games.
http://p.sf.net/sfu/verizon-sfdev
_______________________________________________
Ltp-list mailing list [email protected]
https://lists.sourceforge.net/lists/listinfo/ltp-list

author
#1 lore raw

PATCH 1/4 ltp: kill remaining warnings in "lib/tlibio.c"

There remain a few warnings when I build "lib/tlibio.c":
- _GNU_SOURCE is defined on the command line, then defined unconditionally in this file. Fix by making the definition in the file conditional on whether it's already defined.
- The function random_bit() has a full, standard declaration in "include/random_range.h", so just include that file rather than doing an incomplete declaration in lio_random_methods().

---
 lib/tlibio.c |    6 ++++--
 1 files changed, 4 insertions(+), 2 deletions(-)
lib/tlibio.c +4 -2
index 15b536b..634aca8 100644
@@ -79,7 +79,9 @@
  */
 
 #ifdef __linux__
+#ifndef _GNU_SOURCE
 #define _GNU_SOURCE
+#endif /* !_GNU_SOURCE */
 #define _LARGEFILE64_SOURCE
 #endif
 #include "config.h"
@@ -113,6 +115,7 @@
 #include <stdlib.h> /* atoi, abs */
 
 #include "tlibio.h"		/* defines LIO* marcos */
+#include "random_range.h"
 
 #ifndef PATH_MAX
 #define PATH_MAX	MAXPATHLEN
@@ -470,7 +473,6 @@ int
 lio_random_methods(long curr_mask)
 {
     int mask=0;
-    long random_bit();
 
     /* remove random select, io type, and wait method bits from curr_mask */
     mask = curr_mask & (~(LIO_IO_TYPES | LIO_WAIT_TYPES | LIO_RANDOM));
@@ -2079,4 +2081,4 @@ char **argv;
 
     exit(exit_status);
 }
-#endif
\ No newline at end of file
+#endif
Signature · 13 lines
1.7.4


------------------------------------------------------------------------------
Xperia(TM) PLAY
It's a major breakthrough. An authentic gaming
smartphone on the nation's most reliable network.
And it wants your games.
http://p.sf.net/sfu/verizon-sfdev
_______________________________________________
Ltp-list mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/ltp-list
#2 lore raw

Re: [LTP] [PATCH 1/4] ltp: kill remaining warnings in "lib/tlibio.c"

Quoted 7 lines · Alex Elder

There remain a few warnings when I build "lib/tlibio.c":
- _GNU_SOURCE is defined on the command line, then defined unconditionally in this file.  Fix by making the definition in the file conditional on whether it's already defined.
- The function random_bit() has a full, standard declaration in "include/random_range.h", so just include that file rather than doing an incomplete declaration in lio_random_methods().

Committed, but please note the item about contributing patches via
the mailing list next time as is stated in the "CONTRIBUTING TO THE PROJECT" section under doc/style-guide.txt ; it makes our lives a lot easier and increases throughput reviewing and committing patches. Thanks,
-Garrett

------------------------------------------------------------------------------
Xperia(TM) PLAY
It's a major breakthrough. An authentic gaming
smartphone on the nation's most reliable network.
And it wants your games.
http://p.sf.net/sfu/verizon-sfdev
_______________________________________________
Ltp-list mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/ltp-list

author
#3 lore raw

PATCH 2/4 ltp: kill warnings related to formatting off_t in "growfiles.c"

In reply to Alex Elder

In "testcases/kernel/fs/doio/growfiles.c" there are a number of variables of type off_t which are formatted using a "%ld" conversion specification. When I build on an i386 system I get warnings, because evidently off_t is not defined as a long in this environment.

Since off_t is a 32-bit signed type, it should be safe to just explicitly cast the off_t arguments to (long) in these cases.

---
 testcases/kernel/fs/doio/growfiles.c |   93 +++++++++++++++++++++------------
 1 files changed, 59 insertions(+), 34 deletions(-)
testcases/kernel/fs/doio/growfiles.c +59 -34
index 2bb21bd..ad7128f 100644
@@ -1145,7 +1145,7 @@ no whole file checking will be performed!\n", Progname, TagName, getpid());
 
 	    if (Debug > 2)
 		printf("%s: %d DEBUG3 Unlink interval is %d (random %ld - %d)\n",
-		    Progname, Pid, unlink_inter, tmp, unlink_inter_ran);
+		    Progname, Pid, unlink_inter, (long) tmp, unlink_inter_ran);
 	}
 
 	/*
@@ -1909,8 +1909,8 @@ growfile(int fd, char *file, int grow_incr, char *buf,
 	if (Mode & MODE_GROW_BY_LSEEK) {
                 Woffset=fsize;
 		if (Debug > 2) {
-		    printf("%s: %d DEBUG3 %s/%d: Current size of file is %ld\n", Progname,
-			Pid, __FILE__, __LINE__, Woffset);
+		    printf("%s: %d DEBUG3 %s/%d: Current size of file is %ld\n",
+			    Progname, Pid, __FILE__, __LINE__, (long) Woffset);
 		    printf("%s: %d DEBUG3 %s/%d: lseeking to %d byte with SEEK_END\n", Progname,
 			Pid, __FILE__, __LINE__, grow_incr-1);
 		}
@@ -2006,14 +2006,17 @@ growfile(int fd, char *file, int grow_incr, char *buf,
                    }
 
 		   if ((Woffset=lseek(fd, noffset, SEEK_SET)) == -1) {
-                        fprintf(stderr, "%s%s: %d %s/%d: lseek(%d, %ld, SEEK_SET) l2 failed: %s\n",
-                                Progname, TagName, Pid, __FILE__, __LINE__, fd, noffset, strerror(errno));
+                        fprintf(stderr, "%s%s: %d %s/%d: lseek(%d, %ld, "
+				"SEEK_SET) l2 failed: %s\n",
+                                Progname, TagName, Pid, __FILE__, __LINE__,
+				fd, (long) noffset, strerror(errno));
                         return -1;
 		   }
                    else if (Debug > 2)
-                        printf("%s: %d DEBUG3 %s/%d: lseeked to random offset %ld (fsz:%d)\n",
-                            Progname, Pid, __FILE__, __LINE__, Woffset,
-			    (int)stbuf.st_size);
+                        printf("%s: %d DEBUG3 %s/%d: lseeked to "
+				"random offset %ld (fsz:%d)\n",
+                            Progname, Pid, __FILE__, __LINE__,
+			    (long) Woffset, (int)stbuf.st_size);
 
                 }
 
@@ -2027,8 +2030,9 @@ growfile(int fd, char *file, int grow_incr, char *buf,
 			return -1;
 		    }
                     else if (Debug > 2)
-                        printf("%s: %d DEBUG3 %s/%d: lseeked to end of file, offset %ld\n",
-                            Progname, Pid, __FILE__, __LINE__, Woffset);
+                        printf("%s: %d DEBUG3 %s/%d: lseeked to "
+				"end of file, offset %ld\n",
+                            Progname, Pid, __FILE__, __LINE__, (long) Woffset);
 		}
 
 		if (Pattern == PATTERN_OFFSET)
@@ -2140,14 +2144,22 @@ growfile(int fd, char *file, int grow_incr, char *buf,
 		     * The pattern written to the file will be considered corrupted.
 		     */
 		    if (Debug > 0 && lockfile) {
-		        printf("%s%s: %d DEBUG1 %s/%d: offset after write(%ld) not as exp(%ld+%d=%ld)\n",
-			    Progname, TagName, Pid, __FILE__, __LINE__, tmp, Woffset, grow_incr, Woffset+grow_incr);
-			printf("%s%s: %d DEBUG1 %s/%d: %d Assuming file changed by another process, resetting offset:%ld (expect pattern mismatch)\n",
-				Progname, TagName, Pid, __FILE__, __LINE__, Iter_cnt, tmp-grow_incr);
+		        printf("%s%s: %d DEBUG1 %s/%d: offset after "
+				"write(%ld) not as exp(%ld+%d=%ld)\n",
+			    Progname, TagName, Pid, __FILE__, __LINE__,
+			    (long) tmp, (long) Woffset, grow_incr,
+			    (long) (Woffset + grow_incr));
+			printf("%s%s: %d DEBUG1 %s/%d: %d Assuming file "
+				"changed by another process, resetting "
+				"offset:%ld (expect pattern mismatch)\n",
+				Progname, TagName, Pid, __FILE__, __LINE__,
+				Iter_cnt, (long) (tmp - grow_incr));
 		    }
 		    if (Debug > 4) {
-			printf("%s: %d DEBUG5 %s/%d: about to chop Woffset.  tmp=%ld, grow_incr=%d, Woffset was %ld\n",
-			       Progname, Pid, __FILE__, __LINE__, tmp, grow_incr, Woffset);
+			printf("%s: %d DEBUG5 %s/%d: about to chop Woffset.  "
+				"tmp=%ld, grow_incr=%d, Woffset was %ld\n",
+			       Progname, Pid, __FILE__, __LINE__,
+			       (long) tmp, grow_incr, (long) Woffset);
 		    }
 		    Woffset=tmp-grow_incr;
 		    if (Woffset < 0)
@@ -2169,11 +2181,15 @@ growfile(int fd, char *file, int grow_incr, char *buf,
 	     }
 
 	     else if (size_grew > 0)
-		printf("%s: %d DEBUG2 %s/%d: %d wrote %d bytes(off:%ld), grew file by %d bytes\n",
-                        Progname, Pid, __FILE__, __LINE__, Iter_cnt, Grow_incr, Woffset, size_grew);
+		printf("%s: %d DEBUG2 %s/%d: %d wrote %d bytes(off:%ld), "
+			"grew file by %d bytes\n",
+                        Progname, Pid, __FILE__, __LINE__, Iter_cnt,
+			Grow_incr, (long) Woffset, size_grew);
 	     else
-		printf("%s: %d DEBUG2 %s/%d: %d wrote %d bytes(off:%ld), did not grow file\n",
-                        Progname, Pid, __FILE__, __LINE__, Iter_cnt, Grow_incr, Woffset);
+		printf("%s: %d DEBUG2 %s/%d: %d wrote %d bytes(off:%ld), "
+			"did not grow file\n",
+                        Progname, Pid, __FILE__, __LINE__, Iter_cnt,
+			Grow_incr, (long) Woffset);
 	}
 
     	bytes_consumed += size_grew;
@@ -2333,8 +2349,9 @@ check_write(int fd, int cf_inter, char *filename, int mode)
 
     if (Grow_incr <= 0) {
         if (Debug > 3)
-	    printf("%s: %d DEBUG4 %s/%d: No write validation,  Grow_incr = %d, offset = %ld\n",
-	        Progname, Pid, __FILE__, __LINE__, Grow_incr, Woffset);
+	    printf("%s: %d DEBUG4 %s/%d: No write validation,  "
+		    "Grow_incr = %d, offset = %ld\n",
+	        Progname, Pid, __FILE__, __LINE__, Grow_incr, (long) Woffset);
       return 0;	/* no check */
     }
 
@@ -2354,8 +2371,10 @@ check_write(int fd, int cf_inter, char *filename, int mode)
 	 * The contents of our last write is totally gone, no check.
 	 */
 	if (Debug > 1)
-	    printf("%s%s: %d DEBUG2 %s/%d: %d File size (%d) smaller than where last wrote (%ld)- no write validation\n",
-		Progname, TagName, Pid, __FILE__, __LINE__, Iter_cnt, fsize, Woffset);
+	    printf("%s%s: %d DEBUG2 %s/%d: %d File size (%d) smaller than "
+		    "where last wrote (%ld)- no write validation\n",
+		Progname, TagName, Pid, __FILE__, __LINE__,
+		Iter_cnt, fsize, (long) Woffset);
         lkfile(fd, LOCK_UN, LKLVL0);
       return 0;	/* no validation, but not an error */
 
@@ -2371,25 +2390,29 @@ check_write(int fd, int cf_inter, char *filename, int mode)
 
 	if (Debug > 1)  {
 
-	    printf("%s%s: %d DEBUG2 %s/%d: %d fsz:%d, lost(%d)of wrt(off:%ld, sz:%d), adj=%d\n",
-	    Progname, TagName, Pid, __FILE__, __LINE__, Iter_cnt, fsize, tmp-Grow_incr, Woffset, tmp, Grow_incr);
+	    printf("%s%s: %d DEBUG2 %s/%d: %d fsz:%d, lost(%d)of "
+		    "wrt(off:%ld, sz:%d), adj=%d\n", Progname,
+		    TagName, Pid, __FILE__, __LINE__, Iter_cnt, fsize,
+		    tmp - Grow_incr, (long) Woffset, tmp, Grow_incr);
 	}
 
     }
 
     if (Debug > 2)
-        printf("%s: %d DEBUG3 %s/%d: about to do write validation, offset = %ld, size = %d\n",
-	    Progname, Pid, __FILE__, __LINE__, Woffset, Grow_incr);
+        printf("%s: %d DEBUG3 %s/%d: about to do write validation, "
+		"offset = %ld, size = %d\n",
+	    Progname, Pid, __FILE__, __LINE__, (long) Woffset, Grow_incr);
 
     if (! (mode & MODE_FIFO)) {
 
         if (lseek(fd, Woffset, 0) == -1) {
             fprintf(stderr, "%s%s: %d %s/%d: lseek(fd, %ld, 0) failed: %s\n",
-	        Progname, TagName, Pid, __FILE__, __LINE__, Woffset, strerror(errno));
+	        Progname, TagName, Pid, __FILE__, __LINE__,
+		(long) Woffset, strerror(errno));
         }
         if (Debug > 3)
 	    printf("%s: %d DEBUG4 %s/%d: lseeked to offset:%ld\n",
-	        Progname, Pid, __FILE__, __LINE__, Woffset);
+	        Progname, Pid, __FILE__, __LINE__, (long) Woffset);
     }
 
     /*
@@ -2476,9 +2499,10 @@ check_write(int fd, int cf_inter, char *filename, int mode)
 		Progname, TagName, Pid, __FILE__, __LINE__, Iter_cnt, errmsg, filename);
 
 	if (Debug > 0)
-	    printf("%s%s: %d DEBUG1 %s/%d: **fd:%d, lk:%d, offset:%ld, sz:%d open flags:%#o %s\n",
+	    printf("%s%s: %d DEBUG1 %s/%d: **fd:%d, lk:%d, "
+		    "offset:%ld, sz:%d open flags:%#o %s\n",
 		Progname, TagName, Pid, __FILE__, __LINE__, fd, lockfile,
-		Woffset, Grow_incr, Fileinfo.openflags,
+		(long) Woffset, Grow_incr, Fileinfo.openflags,
 		openflags2symbols(Fileinfo.openflags, ",", 0));
 
 	fflush(stderr);
@@ -2486,8 +2510,9 @@ check_write(int fd, int cf_inter, char *filename, int mode)
     }
 
     if (Debug > 6)
-        printf("%s: %d DEBUG7 %s/%d: No corruption detected on write validation , offset = %ld, size = %d\n",
-            Progname, Pid, __FILE__, __LINE__, Woffset, Grow_incr);
+        printf("%s: %d DEBUG7 %s/%d: No corruption detected on "
+		"write validation , offset = %ld, size = %d\n",
+            Progname, Pid, __FILE__, __LINE__, (long) Woffset, Grow_incr);
 
   return 0;	/* all is well */
 }
Signature · 13 lines
1.7.4


------------------------------------------------------------------------------
Xperia(TM) PLAY
It's a major breakthrough. An authentic gaming
smartphone on the nation's most reliable network.
And it wants your games.
http://p.sf.net/sfu/verizon-sfdev
_______________________________________________
Ltp-list mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/ltp-list
#4 lore raw

Re: [LTP] [PATCH 2/4] ltp: kill warnings related to formatting off_t in "growfiles.c"

Quoted 8 lines · Alex Elder

In "testcases/kernel/fs/doio/growfiles.c" there are a number of variables of type off_t which are formatted using a "%ld" conversion specification.  When I build on an i386 system I get warnings, because evidently off_t is not defined as a long in this environment.

Since off_t is a 32-bit signed type, it should be safe to just explicitly cast the off_t arguments to (long) in these cases.

Ugh. tmp is abused way too much in this application for off_t //
size_t-ish cases (which is incredibly contradictory because off_t is signed and size_t is unsigned according to POSIX and definition in Linux). This really should be sorted out according to the function being called/tested.
Thanks,
-Garrett

------------------------------------------------------------------------------
Xperia(TM) PLAY
It's a major breakthrough. An authentic gaming
smartphone on the nation's most reliable network.
And it wants your games.
http://p.sf.net/sfu/verizon-sfdev
_______________________________________________
Ltp-list mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/ltp-list

author
#5 lore raw

PATCH 3/4 ltp: kill warnings related to formatting off_t in "aio-stress.c"

In reply to Alex Elder

In "testcases/kernel/io/ltp-aiodio/aio-stress.c" there are a number of warnings that show up due to mismatches between fprintf() conversion specifications and the variables being formatted.

Fix most of these by casting the variables to the right type; in one case a "%td" is used to signify a ptrdiff_t variable.

---
 testcases/kernel/io/ltp-aiodio/aio-stress.c |   18 +++++++++++-------
 1 files changed, 11 insertions(+), 7 deletions(-)
testcases/kernel/io/ltp-aiodio/aio-stress.c +11 -7
index e77f5be..cd0b211 100644
@@ -1165,7 +1165,7 @@ restart:
 
     if (t->stage_mb_trans && t->num_files > 0) {
         double seconds = time_since_now(&stage_time);
-	fprintf(stderr, "thread %d %s totals (%.2f MB/s) %.2f MB in %.2fs\n",
+	fprintf(stderr, "thread %td %s totals (%.2f MB/s) %.2f MB in %.2fs\n",
 	        t - global_thread_info, this_stage, t->stage_mb_trans/seconds,
 		t->stage_mb_trans, seconds);
     }
@@ -1447,16 +1447,20 @@ int main(int ac, char **av)
 
     if (file_size < num_contexts * context_offset) {
         fprintf(stderr, "file size %Lu too small for %d contexts\n",
-	        file_size, num_contexts);
+	        (unsigned long long) file_size, num_contexts);
 	exit(1);
     }
 
-    fprintf(stderr, "file size %LuMB, record size %luKB, depth %d, ios per iteration %d\n", file_size / (1024 * 1024), rec_len / 1024, depth, io_iter);
+    fprintf(stderr, "file size %LuMB, record size %luKB, depth %d, "
+	    "ios per iteration %d\n",
+	    (unsigned long long) (file_size / (1024 * 1024)),
+	    rec_len / 1024, depth, io_iter);
     fprintf(stderr, "max io_submit %d, buffer alignment set to %luKB\n",
             max_io_submit, (page_size_mask + 1)/1024);
-    fprintf(stderr, "threads %d files %d contexts %d context offset %LuMB verification %s\n",
-            num_threads, num_files, num_contexts,
-	    context_offset / (1024 * 1024), verify ? "on" : "off");
+    fprintf(stderr, "threads %d files %d contexts %d context offset %LuMB "
+	    "verification %s\n", num_threads, num_files, num_contexts,
+	    (unsigned long long) context_offset / (1024 * 1024),
+	    verify ? "on" : "off");
     /* open all the files and do any required setup for them */
     for (i = optind ; i < ac ; i++) {
 	int thread_index;
@@ -1508,4 +1512,4 @@ int main(int ac, char **av)
 	exit(1);
     }
     return status;
-}
\ No newline at end of file
+}
Signature · 13 lines
1.7.4


------------------------------------------------------------------------------
Xperia(TM) PLAY
It's a major breakthrough. An authentic gaming
smartphone on the nation's most reliable network.
And it wants your games.
http://p.sf.net/sfu/verizon-sfdev
_______________________________________________
Ltp-list mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/ltp-list
#6 lore raw

Re: [LTP] [PATCH 3/4] ltp: kill warnings related to formatting off_t in "aio-stress.c"

Quoted 26 lines · Alex Elder

In "testcases/kernel/io/ltp-aiodio/aio-stress.c" there are a number of warnings that show up due to mismatches between fprintf() conversion specifications and the variables being formatted.

Fix most of these by casting the variables to the right type; in one case a "%td" is used to signify a ptrdiff_t variable.

---
 testcases/kernel/io/ltp-aiodio/aio-stress.c |   18 +++++++++++-------

 1 files changed, 11 insertions(+), 7 deletions(-)
testcases/kernel/io/ltp-aiodio/aio-stress.c +1 -1
index e77f5be..cd0b211 100644
@@ -1165,7 +1165,7 @@ restart:
 
     if (t->stage_mb_trans && t->num_files > 0) {
         double seconds = time_since_now(&stage_time);
-       fprintf(stderr, "thread %d %s totals (%.2f MB/s) %.2f MB in %.2fs\n",
+       fprintf(stderr, "thread %td %s totals (%.2f MB/s) %.2f MB in %.2fs\n",
                t - global_thread_info, this_stage, t->stage_mb_trans/seconds,
                t->stage_mb_trans, seconds);
     }

testcases/kernel/io/ltp-aiodio/aio-stress.c int main(int ac, char **av) · line 1450

Quoted 5 lines
testcases/kernel/io/ltp-aiodio/aio-stress.c +1 -1
@@ -1447,16 +1447,20 @@ int main(int ac, char **av)
 
     if (file_size < num_contexts * context_offset) {
         fprintf(stderr, "file size %Lu too small for %d contexts\n",
-               file_size, num_contexts);
+               (unsigned long long) file_size, num_contexts);

file_size should really be size_t and the format qualifier should be %zu.

testcases/kernel/io/ltp-aiodio/aio-stress.c int main(int ac, char **av) · line 1455

Quoted 6 lines
testcases/kernel/io/ltp-aiodio/aio-stress.c +2 -1
        exit(1);
     }
 
-    fprintf(stderr, "file size %LuMB, record size %luKB, depth %d, ios per iteration %d\n", file_size / (1024 * 1024), rec_len / 1024, depth, io_iter);
+    fprintf(stderr, "file size %LuMB, record size %luKB, depth %d, "
+           "ios per iteration %d\n",

ios is a product made by Cisco. "I/O per iteration" makes more sense here.

testcases/kernel/io/ltp-aiodio/aio-stress.c int main(int ac, char **av) · line 1457

Quoted 2 lines
testcases/kernel/io/ltp-aiodio/aio-stress.c +2 -0
+           (unsigned long long) (file_size / (1024 * 1024)),
+           rec_len / 1024, depth, io_iter);

Same as above.

testcases/kernel/io/ltp-aiodio/aio-stress.c int main(int ac, char **av) · line 1462

Quoted 8 lines
testcases/kernel/io/ltp-aiodio/aio-stress.c +3 -3
     fprintf(stderr, "max io_submit %d, buffer alignment set to %luKB\n",
             max_io_submit, (page_size_mask + 1)/1024);
-    fprintf(stderr, "threads %d files %d contexts %d context offset %LuMB verification %s\n",
-            num_threads, num_files, num_contexts,
-           context_offset / (1024 * 1024), verify ? "on" : "off");
+    fprintf(stderr, "threads %d files %d contexts %d context offset %LuMB "
+           "verification %s\n", num_threads, num_files, num_contexts,
+           (unsigned long long) context_offset / (1024 * 1024),

context_offset should be size_t too.

testcases/kernel/io/ltp-aiodio/aio-stress.c int main(int ac, char **av) · line 1463

Quoted 1 line
testcases/kernel/io/ltp-aiodio/aio-stress.c +1 -0
+           verify ? "on" : "off");

Thanks,
-Garrett

------------------------------------------------------------------------------
Xperia(TM) PLAY
It's a major breakthrough. An authentic gaming
smartphone on the nation's most reliable network.
And it wants your games.
http://p.sf.net/sfu/verizon-sfdev
_______________________________________________
Ltp-list mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/ltp-list

author
#7 lore raw

PATCH 4/4 ltp: kill off warnings in "fsstress.c"

In reply to Alex Elder

Fix remaining warnings in "testcases/kernel/fs/fsstress/fsstress.c". Three of them are due to mismatches between fprintf() conversion specifications and the variables being formatted. Fix these by casting the variables to the right type.

Two others are due to the use of a __uint64_t local variable to represent a value of type __u64 (which evidently can be defined differently in some environments). Fix these by using the exact matching type in the cases that produce the warning messages.

---
 testcases/kernel/fs/fsstress/fsstress.c |   16 +++++++++-------
 1 files changed, 9 insertions(+), 7 deletions(-)
testcases/kernel/fs/fsstress/fsstress.c +9 -7
index 9b93bca..4a81d99 100644
@@ -1549,7 +1549,7 @@ bulkstat_f(int opno, long r)
 {
 	int		count;
 	int		fd;
-	__uint64_t	last;
+	__u64		last;
 	int		nent;
 	xfs_bstat_t	*t;
 	__int64_t	total;
@@ -1582,7 +1582,7 @@ bulkstat1_f(int opno, long r)
 	pathname_t	f;
 	int		fd;
 	int		good;
-	__uint64_t	ino;
+	__u64		ino;
 	struct stat64	s;
 	xfs_bstat_t	t;
 	int		v;
@@ -1625,7 +1625,7 @@ bulkstat1_f(int opno, long r)
 	e = ioctl(fd, XFS_IOC_FSBULKSTAT_SINGLE, &bsr) < 0 ? errno : 0;
 	if (v)
 		printf("%d/%d: bulkstat1 %s ino %lld %d\n",
-			procid, opno, good?"real":"random", (int64_t)ino, e);
+			procid, opno, good?"real":"random", (long long)ino, e);
 	close(fd);
 }
 
@@ -2388,8 +2388,9 @@ resvsp_f(int opno, long r)
 	fl.l_len = (off64_t)(random() % (1024 * 1024));
 	e = ioctl(fd, XFS_IOC_RESVSP64, &fl) < 0 ? errno : 0;
 	if (v)
-		printf("%d/%d: ioctl(XFS_IOC_RESVSP64) %s %lld %ld %d\n",
-			procid, opno, f.path, (long long)off, fl.l_len, e);
+		printf("%d/%d: ioctl(XFS_IOC_RESVSP64) %s %lld %lld %d\n",
+			procid, opno, f.path, (long long) off,
+			(long long) fl.l_len, e);
 	free_pathname(&f);
 	close(fd);
 }
@@ -2605,8 +2606,9 @@ unresvsp_f(int opno, long r)
 	fl.l_len = (off64_t)(random() % (1 << 20));
 	e = ioctl(fd, XFS_IOC_UNRESVSP64, &fl) < 0 ? errno : 0;
 	if (v)
-		printf("%d/%d: ioctl(XFS_IOC_UNRESVSP64) %s %lld %ld %d\n",
-			procid, opno, f.path, (long long)off, fl.l_len, e);
+		printf("%d/%d: ioctl(XFS_IOC_UNRESVSP64) %s %lld %lld %d\n",
+			procid, opno, f.path, (long long) off,
+			(long long) fl.l_len, e);
 	free_pathname(&f);
 	close(fd);
 }
Signature · 13 lines
1.7.4


------------------------------------------------------------------------------
Xperia(TM) PLAY
It's a major breakthrough. An authentic gaming
smartphone on the nation's most reliable network.
And it wants your games.
http://p.sf.net/sfu/verizon-sfdev
_______________________________________________
Ltp-list mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/ltp-list
#8 lore raw

Re: [LTP] [PATCH 4/4] ltp: kill off warnings in "fsstress.c"

Quoted 9 lines · Alex Elder

Fix remaining warnings in "testcases/kernel/fs/fsstress/fsstress.c". Three of them are due to mismatches between fprintf() conversion specifications and the variables being formatted.  Fix these by casting the variables to the right type.

Two others are due to the use of a __uint64_t local variable to represent a value of type __u64 (which evidently can be defined differently in some environments).  Fix these by using the exact matching type in the cases that produce the warning messages.

I see different typedef'ed types when going over the xfs_ioctl.c
source. Could you please either use the kernel datatype (highly recommended), or a POSIX equivalent if you can't use the kernel datatype? I would really like the former because having to fix this in 2-4 years because someone changes the field size and the test doesn't get updated properly is incredibly annoying.
Thanks,
-Garrett

------------------------------------------------------------------------------
Xperia(TM) PLAY
It's a major breakthrough. An authentic gaming
smartphone on the nation's most reliable network.
And it wants your games.
http://p.sf.net/sfu/verizon-sfdev
_______________________________________________
Ltp-list mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/ltp-list