All of lore.kernel.org
 help / color / mirror / Atom feed
* [LTP] [PATCH 0/3, v3] ltp: eliminate more build warnings
@ 2011-04-12 14:06 Alex Elder
  2011-04-12 14:06 ` [LTP] [PATCH 1/3] ltp: fix warnings in "growfiles.c" Alex Elder
  2011-04-15 13:57 ` [LTP] [PATCH 0/3, v3] ltp: eliminate more build warnings Cyril Hrubis
  0 siblings, 2 replies; 5+ messages in thread
From: Alex Elder @ 2011-04-12 14:06 UTC (permalink / raw)
  To: ltp-list

Updated all whitespace and "I/O" spelling issues requested by
Garrett Cooper.  Please commit.

					-Alex


------------------------------------------------------------------------------
Forrester Wave Report - Recovery time is now measured in hours and minutes
not days. Key insights are discussed in the 2010 Forrester Wave Report as
part of an in-depth evaluation of disaster recovery service providers.
Forrester found the best-in-class provider in terms of services and vision.
Read this report now!  http://p.sf.net/sfu/ibm-webcastpromo
_______________________________________________
Ltp-list mailing list
Ltp-list@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/ltp-list

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

* [LTP] [PATCH 1/3] ltp: fix warnings in "growfiles.c"
  2011-04-12 14:06 [LTP] [PATCH 0/3, v3] ltp: eliminate more build warnings Alex Elder
@ 2011-04-12 14:06 ` Alex Elder
  2011-04-12 14:06   ` [LTP] [PATCH 2/3] ltp: fix warnings in "aio-stress.c" Alex Elder
  2011-04-12 14:06   ` [LTP] [PATCH 3/3] ltp: fix warnings in "fsstress.c" Alex Elder
  2011-04-15 13:57 ` [LTP] [PATCH 0/3, v3] ltp: eliminate more build warnings Cyril Hrubis
  1 sibling, 2 replies; 5+ messages in thread
From: Alex Elder @ 2011-04-12 14:06 UTC (permalink / raw)
  To: ltp-list

[-- Attachment #1: Type: text/plain, Size: 817 bytes --]


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.

Updated to address Garrett Cooper's concerns that variables named
"tmp" are used for a number of purposes in this file.  In one case
I renamed the variable "off_tmp" (its type is off_t) (but did not
change corresponding printed text).  The other cases the "tmp"
variable was more appropriately type int.  Also adjusted some
whitespace, as requested.

Signed-off-by: Alex Elder <aelder@sgi.com>
---
 testcases/kernel/fs/doio/growfiles.c |  117 ++++++++++++++++++++-------------
 1 files changed, 71 insertions(+), 46 deletions(-)


[-- Warning: decoded text below may be mangled, UTF-8 assumed --]
[-- Attachment #2: 0001-ltp-fix-warnings-in-growfiles.c.patch --]
[-- Type: text/x-patch; name="0001-ltp-fix-warnings-in-growfiles.c.patch", Size: 12039 bytes --]

diff --git a/testcases/kernel/fs/doio/growfiles.c b/testcases/kernel/fs/doio/growfiles.c
index 2bb21bd..2a31d30 100644
--- a/testcases/kernel/fs/doio/growfiles.c
+++ b/testcases/kernel/fs/doio/growfiles.c
@@ -372,7 +372,7 @@ int stop = 0;			/* loop stopper if set */
 unsigned long curr_size = 0;			/* BUG:14136 (keep track of file size) */
 const unsigned long ext2_limit = 2147483647;	/* BUG:14136 (2GB ext2 filesize limit) */
 
-off_t tmp;
+int tmp;
 char chr;
 int ret;
 int pre_alloc_space = 0;
@@ -1141,10 +1141,10 @@ no whole file checking will be performed!\n", Progname, TagName, getpid());
 	     * get different intervals.
 	     */
 	    tmp=unlink_inter;
-	    unlink_inter=random_range(tmp, unlink_inter_ran, 1, NULL);
+	    unlink_inter = (int)random_range(tmp, unlink_inter_ran, 1, NULL);
 
 	    if (Debug > 2)
-		printf("%s: %d DEBUG3 Unlink interval is %d (random %ld - %d)\n",
+		printf("%s: %d DEBUG3 Unlink interval is %d (random %d - %d)\n",
 		    Progname, Pid, unlink_inter, tmp, unlink_inter_ran);
 	}
 
@@ -1853,7 +1853,7 @@ growfile(int fd, char *file, int grow_incr, char *buf,
    off_t fsize;		/* current size of file */
    int size_grew;	/* size the file grew */
    struct stat stbuf;
-   off_t tmp = 0;
+   off_t off_tmp = 0;
 
         /*
          * Do a stat on the open file.
@@ -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)
@@ -2061,7 +2065,7 @@ growfile(int fd, char *file, int grow_incr, char *buf,
 /*****
 		ret=write(fd, buf, grow_incr);
 
-		tmp=tell(fd);
+		off_tmp = tell(fd);
 
 		lkfile(fd, LOCK_UN, LKLVL0);
 
@@ -2083,10 +2087,10 @@ growfile(int fd, char *file, int grow_incr, char *buf,
 			/* If it is a fifo then just pretend the file
 			 * offset is where we think it should be.
 			 */
-			tmp = Woffset + grow_incr;
+			off_tmp = Woffset + grow_incr;
 		}
 		else{
-			if ((tmp=lseek(fd,0,SEEK_CUR)) < 0) { /* get offset after the write */
+			if ((off_tmp = lseek(fd,0,SEEK_CUR)) < 0) { /* get offset after the write */
 				fprintf(stderr, "%s%s: %s/%d: tell(2) failed: %d  %s\n",
 					Progname, TagName, __FILE__, __LINE__, errno, strerror(errno) );
 				return -1;
@@ -2100,18 +2104,18 @@ growfile(int fd, char *file, int grow_incr, char *buf,
 			 * tell() told us.  Fudge it here.
 			 */
 			if ((io_type & LIO_IO_ASYNC_TYPES) || (io_type & LIO_RANDOM)) {
-				if (tmp != Woffset + grow_incr) {
+				if (off_tmp != Woffset + grow_incr) {
 					if (Debug > 5) {
 						printf("%s: %d DEBUG6 %s/%d: posix fudge, forcing tmp (%"PRId64") to match Woffset+grow_incr (%"PRId64")\n",
-						       Progname, Pid, __FILE__, __LINE__, (int64_t)tmp, (int64_t)Woffset+grow_incr);
+						       Progname, Pid, __FILE__, __LINE__, (int64_t)off_tmp, (int64_t)Woffset+grow_incr);
 					}
-					tmp = Woffset + grow_incr;
+					off_tmp = Woffset + grow_incr;
 				}
 			}
 #endif /* sgi __linux__ */
 #endif
 		}
-		*curr_size_ptr=tmp;	/* BUG:14136 */
+		*curr_size_ptr = off_tmp;	/* BUG:14136 */
 
 		lkfile(fd, LOCK_UN, LKLVL0);
 
@@ -2129,7 +2133,7 @@ growfile(int fd, char *file, int grow_incr, char *buf,
 		 * Check for a condition where the file was truncated just before
 		 * the write.
 		 */
-		if (tmp != Woffset + grow_incr) {
+		if (off_tmp != Woffset + grow_incr) {
 		    /*
 		     * The offset after the write was not as expected.
 		     * This could be caused by the following:
@@ -2140,16 +2144,24 @@ 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)off_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)(off_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)off_tmp, grow_incr, (long)Woffset);
 		    }
-		    Woffset=tmp-grow_incr;
+		    Woffset = off_tmp - grow_incr;
 		    if (Woffset < 0)
 			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 */
 }

[-- Attachment #3: Type: text/plain, Size: 434 bytes --]

------------------------------------------------------------------------------
Forrester Wave Report - Recovery time is now measured in hours and minutes
not days. Key insights are discussed in the 2010 Forrester Wave Report as
part of an in-depth evaluation of disaster recovery service providers.
Forrester found the best-in-class provider in terms of services and vision.
Read this report now!  http://p.sf.net/sfu/ibm-webcastpromo

[-- Attachment #4: Type: text/plain, Size: 155 bytes --]

_______________________________________________
Ltp-list mailing list
Ltp-list@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/ltp-list

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

* [LTP] [PATCH 2/3] ltp: fix warnings in "aio-stress.c"
  2011-04-12 14:06 ` [LTP] [PATCH 1/3] ltp: fix warnings in "growfiles.c" Alex Elder
@ 2011-04-12 14:06   ` Alex Elder
  2011-04-12 14:06   ` [LTP] [PATCH 3/3] ltp: fix warnings in "fsstress.c" Alex Elder
  1 sibling, 0 replies; 5+ messages in thread
From: Alex Elder @ 2011-04-12 14:06 UTC (permalink / raw)
  To: ltp-list

[-- Attachment #1: Type: text/plain, Size: 902 bytes --]


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.

Updated to address comments made by Garrett Cooper in review.
However, both "file_size" and "context_offset" variables represent
file offsets, and therefore should remain type off_t (rather than
size_t, which was recommended).  Some printf() formats were adjusted
to use %ld/(long) for printing off_t values.  Also updated some
whitespace, and now use "I/O" consistently, as requested.

Signed-off-by: Alex Elder <aelder@sgi.com>
---
 testcases/kernel/io/ltp-aiodio/aio-stress.c |   40 +++++++++++++++-----------
 1 files changed, 23 insertions(+), 17 deletions(-)


[-- Warning: decoded text below may be mangled, UTF-8 assumed --]
[-- Attachment #2: 0002-ltp-fix-warnings-in-aio-stress.c.patch --]
[-- Type: text/x-patch; name="0002-ltp-fix-warnings-in-aio-stress.c.patch", Size: 4891 bytes --]

diff --git a/testcases/kernel/io/ltp-aiodio/aio-stress.c b/testcases/kernel/io/ltp-aiodio/aio-stress.c
index e77f5be..c660cfe 100644
--- a/testcases/kernel/io/ltp-aiodio/aio-stress.c
+++ b/testcases/kernel/io/ltp-aiodio/aio-stress.c
@@ -161,16 +161,16 @@ struct io_oper {
     /* read,write, random, etc */
     int rw;
 
-    /* number of ios that will get sent to aio */
+    /* number of I/O that will get sent to aio */
     int total_ios;
 
-    /* number of ios we've already sent */
+    /* number of I/O we've already sent */
     int started_ios;
 
     /* last offset used in an io operation */
     off_t last_offset;
 
-    /* stonewalled = 1 when we got cut off before submitting all our ios */
+    /* stonewalled = 1 when we got cut off before submitting all our I/O */
     int stonewalled;
 
     /* list management */
@@ -217,7 +217,7 @@ struct thread_info {
     /* list of io units available for io */
     struct io_unit *free_ious;
 
-    /* number of io units in the ios array */
+    /* number of io units in the I/O array */
     int num_global_ios;
 
     /* number of io units in flight */
@@ -745,7 +745,7 @@ resubmit:
     calc_latency(&start_time, &stop_time, &t->io_submit_latency);
 
     if (ret != num_ios) {
-	/* some ios got through */
+	/* some I/O got through */
 	if (ret > 0) {
 	    update_iou_counters(my_iocbs, ret, &stop_time);
 	    my_iocbs += ret;
@@ -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);
     }
@@ -1270,8 +1270,10 @@ void print_usage(void) {
     printf("\t-s size in MB of the test file(s), default 1024MB\n");
     printf("\t-r record size in KB used for each io, default 64KB\n");
     printf("\t-d number of pending aio requests for each file, default 64\n");
-    printf("\t-i number of ios per file sent before switching\n\t   to the next file, default 8\n");
-    printf("\t-I total number of ayncs IOs the program will run, default is run until Cntl-C\n");
+    printf("\t-i number of I/O per file sent before switching\n"
+	    "\t   to the next file, default 8\n");
+    printf("\t-I total number of ayncs I/O the program will run, "
+	    "default is run until Cntl-C\n");
     printf("\t-O Use O_DIRECT (not available in 2.4 kernels),\n");
     printf("\t-S Use O_SYNC for writes\n");
     printf("\t-o add an operation to the list: write=0, read=1,\n");
@@ -1391,7 +1393,7 @@ int main(int ac, char **av)
     }
 
     /*
-     * make sure we don't try to submit more ios than we have allocated
+     * make sure we don't try to submit more I/O than we have allocated
      * memory for
      */
     if (depth < io_iter) {
@@ -1426,7 +1428,7 @@ int main(int ac, char **av)
         max_io_submit = num_files * io_iter * num_contexts;
 
     /*
-     * make sure we don't try to submit more ios than max_io_submit allows
+     * make sure we don't try to submit more I/O than max_io_submit allows
      */
     if (max_io_submit < io_iter) {
         io_iter = max_io_submit;
@@ -1446,17 +1448,21 @@ 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);
+        fprintf(stderr, "file size %ld too small for %d contexts\n",
+	        (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 %ldMB, record size %ldKB, depth %d, "
+	    "I/O per iteration %d\n",
+	    (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 %ldMB "
+	    "verification %s\n", num_threads, num_files, num_contexts,
+	    (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 +1514,4 @@ int main(int ac, char **av)
 	exit(1);
     }
     return status;
-}
\ No newline at end of file
+}

[-- Attachment #3: Type: text/plain, Size: 434 bytes --]

------------------------------------------------------------------------------
Forrester Wave Report - Recovery time is now measured in hours and minutes
not days. Key insights are discussed in the 2010 Forrester Wave Report as
part of an in-depth evaluation of disaster recovery service providers.
Forrester found the best-in-class provider in terms of services and vision.
Read this report now!  http://p.sf.net/sfu/ibm-webcastpromo

[-- Attachment #4: Type: text/plain, Size: 155 bytes --]

_______________________________________________
Ltp-list mailing list
Ltp-list@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/ltp-list

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

* [LTP] [PATCH 3/3] ltp: fix warnings in "fsstress.c"
  2011-04-12 14:06 ` [LTP] [PATCH 1/3] ltp: fix warnings in "growfiles.c" Alex Elder
  2011-04-12 14:06   ` [LTP] [PATCH 2/3] ltp: fix warnings in "aio-stress.c" Alex Elder
@ 2011-04-12 14:06   ` Alex Elder
  1 sibling, 0 replies; 5+ messages in thread
From: Alex Elder @ 2011-04-12 14:06 UTC (permalink / raw)
  To: ltp-list

[-- Attachment #1: Type: text/plain, Size: 1027 bytes --]


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.

Updated to address the concern raised by Garrett Cooper about the
use of types that are not identical to what's used in the XFS
ioctl() interface in the kernel.  Also added memset() calls so we're
sure no garbage resides in data structures passed between user space
and the kernel.  Also updated some whitespace, as requested.

Signed-off-by: Alex Elder <aelder@sgi.com>
---
 testcases/kernel/fs/fsstress/fsstress.c |   81 ++++++++++++++++++-------------
 1 files changed, 48 insertions(+), 33 deletions(-)


[-- Warning: decoded text below may be mangled, UTF-8 assumed --]
[-- Attachment #2: 0003-ltp-fix-warnings-in-fsstress.c.patch --]
[-- Type: text/x-patch; name="0003-ltp-fix-warnings-in-fsstress.c.patch", Size: 7013 bytes --]

diff --git a/testcases/kernel/fs/fsstress/fsstress.c b/testcases/kernel/fs/fsstress/fsstress.c
index 9b93bca..9987484 100644
--- a/testcases/kernel/fs/fsstress/fsstress.c
+++ b/testcases/kernel/fs/fsstress/fsstress.c
@@ -419,6 +419,7 @@ int main(int argc, char **argv)
 		}
 #ifndef NO_XFS
 		if (!no_xfs) {
+		memset(&geom, 0, sizeof(geom));
 		i = ioctl(fd, XFS_IOC_FSGEOMETRY, &geom);
 		if (i >= 0 && geom.rtblocks)
 			rtpct = MIN(MAX(geom.rtblocks * 100 /
@@ -447,6 +448,7 @@ int main(int argc, char **argv)
 				errtag += (random() % (XFS_ERRTAG_MAX - errtag));
 			}
 			printf("Injecting failure on tag #%d\n", errtag);
+			memset(&err_inj, 0, sizeof(err_inj));
 			err_inj.errtag = errtag;
 			err_inj.fd = fd;
 			srval = ioctl(fd, XFS_IOC_ERROR_INJECTION, &err_inj);
@@ -476,6 +478,7 @@ int main(int argc, char **argv)
 		}
 #ifndef NO_XFS
 		if (errtag != 0) {
+			memset(&err_inj, 0, sizeof(err_inj));
 			err_inj.errtag = 0;
 			err_inj.fd = fd;
 			if ((srval = ioctl(fd, XFS_IOC_ERROR_CLEARALL, &err_inj)) != 0) {
@@ -1396,9 +1399,9 @@ allocsp_f(int opno, long r)
 	int		e;
 	pathname_t	f;
 	int		fd;
-	struct flock64	fl;
-	__int64_t	lr;
-	off64_t		off;
+	struct xfs_flock64 fl;
+	__s64		lr;
+	__s64		off;
 	struct stat64	stb;
 	int		v;
 
@@ -1427,9 +1430,10 @@ allocsp_f(int opno, long r)
 		close(fd);
 		return;
 	}
-	lr = ((__int64_t)random() << 32) + random();
-	off = (off64_t)(lr % MIN(stb.st_size + (1024 * 1024), MAXFSIZE));
+	lr = ((__s64)random() << 32) + random();
+	off = lr % MIN(stb.st_size + (1024 * 1024), MAXFSIZE);
 	off %= maxfsize;
+	memset(&fl, 0, sizeof(fl));
 	fl.l_whence = SEEK_SET;
 	fl.l_start = off;
 	fl.l_len = 0;
@@ -1547,10 +1551,10 @@ attr_set_f(int opno, long r)
 void
 bulkstat_f(int opno, long r)
 {
-	int		count;
+	__s32		count;
 	int		fd;
-	__uint64_t	last;
-	int		nent;
+	__u64		last;
+	__s32		nent;
 	xfs_bstat_t	*t;
 	__int64_t	total;
 	xfs_fsop_bulkreq_t bsr;
@@ -1561,6 +1565,7 @@ bulkstat_f(int opno, long r)
 	fd = open(".", O_RDONLY);
 	total = 0;
 
+	memset(&bsr, 0, sizeof(bsr));
 	bsr.lastip=&last;
 	bsr.icount=nent;
 	bsr.ubuffer=t;
@@ -1571,7 +1576,7 @@ bulkstat_f(int opno, long r)
 	free(t);
 	if (verbose)
 		printf("%d/%d: bulkstat nent %d total %lld\n",
-			procid, opno, nent, (long long)total);
+			procid, opno, (int)nent, (long long)total);
 	close(fd);
 }
 
@@ -1582,7 +1587,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;
@@ -1617,6 +1622,7 @@ bulkstat1_f(int opno, long r)
 	}
 	fd = open(".", O_RDONLY);
 
+	memset(&bsr, 0, sizeof(bsr));
 	bsr.lastip=&ino;
 	bsr.icount=1;
 	bsr.ubuffer=&t;
@@ -1625,7 +1631,8 @@ 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);
 }
 
@@ -1698,6 +1705,7 @@ creat_f(int opno, long r)
 	if (fd >= 0) {
 #ifndef NO_XFS
 		struct fsxattr	a;
+		memset(&a, 0, sizeof(a));
 		if (extsize && ioctl(fd, XFS_IOC_FSGETXATTR, &a) >= 0) {
 			a.fsx_xflags |= XFS_XFLAG_REALTIME;
 			a.fsx_extsize =
@@ -1799,6 +1807,7 @@ dread_f(int opno, long r)
 		return;
 	}
 
+	memset(&diob, 0, sizeof(diob));
 	if (no_xfs) {
 		diob.d_miniosz = stb.st_blksize;
 		diob.d_maxiosz = stb.st_blksize * 256;  /* good number ? */
@@ -1889,6 +1898,7 @@ dwrite_f(int opno, long r)
 		close(fd);
 		return;
 	}
+	memset(&diob, 0, sizeof(diob));
 	if (no_xfs) {
 		diob.d_miniosz = stb.st_blksize;
 		diob.d_maxiosz = stb.st_blksize * 256;  /* good number ? */
@@ -1976,9 +1986,9 @@ freesp_f(int opno, long r)
 	int		e;
 	pathname_t	f;
 	int		fd;
-	struct flock64	fl;
-	__int64_t	lr;
-	off64_t		off;
+	struct xfs_flock64 fl;
+	__s64		lr;
+	__s64		off;
 	struct stat64	stb;
 	int		v;
 
@@ -2007,9 +2017,10 @@ freesp_f(int opno, long r)
 		close(fd);
 		return;
 	}
-	lr = ((__int64_t)random() << 32) + random();
-	off = (off64_t)(lr % MIN(stb.st_size + (1024 * 1024), MAXFSIZE));
+	lr = ((__s64)random() << 32) + random();
+	off = lr % MIN(stb.st_size + (1024 * 1024), MAXFSIZE);
 	off %= maxfsize;
+	memset(&fl, 0, sizeof(fl));
 	fl.l_whence = SEEK_SET;
 	fl.l_start = off;
 	fl.l_len = 0;
@@ -2349,9 +2360,9 @@ resvsp_f(int opno, long r)
 	int		e;
 	pathname_t	f;
 	int		fd;
-	struct flock64	fl;
-	__int64_t	lr;
-	off64_t		off;
+	struct xfs_flock64 fl;
+	__s64		lr;
+	__s64		off;
 	struct stat64	stb;
 	int		v;
 
@@ -2380,16 +2391,18 @@ resvsp_f(int opno, long r)
 		close(fd);
 		return;
 	}
-	lr = ((__int64_t)random() << 32) + random();
-	off = (off64_t)(lr % MIN(stb.st_size + (1024 * 1024), MAXFSIZE));
+	lr = ((__s64)random() << 32) + random();
+	off = lr % MIN(stb.st_size + (1024 * 1024), MAXFSIZE);
 	off %= maxfsize;
+	memset(&fl, 0, sizeof(fl));
 	fl.l_whence = SEEK_SET;
 	fl.l_start = off;
-	fl.l_len = (off64_t)(random() % (1024 * 1024));
+	fl.l_len = (__s64)(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);
 }
@@ -2524,7 +2537,7 @@ truncate_f(int opno, long r)
 		return;
 	}
 	lr = ((__int64_t)random() << 32) + random();
-	off = (off64_t)(lr % MIN(stb.st_size + (1024 * 1024), MAXFSIZE));
+	off = lr % MIN(stb.st_size + (1024 * 1024), MAXFSIZE);
 	off %= maxfsize;
 	e = truncate64_path(&f, off) < 0 ? errno : 0;
 	check_cwd();
@@ -2566,9 +2579,9 @@ unresvsp_f(int opno, long r)
 	int		e;
 	pathname_t	f;
 	int		fd;
-	struct flock64	fl;
-	__int64_t	lr;
-	off64_t		off;
+	struct xfs_flock64 fl;
+	__s64		lr;
+	__s64		off;
 	struct stat64	stb;
 	int		v;
 
@@ -2597,16 +2610,18 @@ unresvsp_f(int opno, long r)
 		close(fd);
 		return;
 	}
-	lr = ((__int64_t)random() << 32) + random();
-	off = (off64_t)(lr % MIN(stb.st_size + (1024 * 1024), MAXFSIZE));
+	lr = ((__s64)random() << 32) + random();
+	off = lr % MIN(stb.st_size + (1024 * 1024), MAXFSIZE);
 	off %= maxfsize;
+	memset(&fl, 0, sizeof(fl));
 	fl.l_whence = SEEK_SET;
 	fl.l_start = off;
-	fl.l_len = (off64_t)(random() % (1 << 20));
+	fl.l_len = (__s64)(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);
 }

[-- Attachment #3: Type: text/plain, Size: 434 bytes --]

------------------------------------------------------------------------------
Forrester Wave Report - Recovery time is now measured in hours and minutes
not days. Key insights are discussed in the 2010 Forrester Wave Report as
part of an in-depth evaluation of disaster recovery service providers.
Forrester found the best-in-class provider in terms of services and vision.
Read this report now!  http://p.sf.net/sfu/ibm-webcastpromo

[-- Attachment #4: Type: text/plain, Size: 155 bytes --]

_______________________________________________
Ltp-list mailing list
Ltp-list@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/ltp-list

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

* Re: [LTP] [PATCH 0/3, v3] ltp: eliminate more build warnings
  2011-04-12 14:06 [LTP] [PATCH 0/3, v3] ltp: eliminate more build warnings Alex Elder
  2011-04-12 14:06 ` [LTP] [PATCH 1/3] ltp: fix warnings in "growfiles.c" Alex Elder
@ 2011-04-15 13:57 ` Cyril Hrubis
  1 sibling, 0 replies; 5+ messages in thread
From: Cyril Hrubis @ 2011-04-15 13:57 UTC (permalink / raw)
  To: Alex Elder; +Cc: ltp-list

Hi!
Commited, thanks.

-- 
Cyril Hrubis
chrubis@suse.cz

------------------------------------------------------------------------------
Benefiting from Server Virtualization: Beyond Initial Workload 
Consolidation -- Increasing the use of server virtualization is a top
priority.Virtualization can reduce costs, simplify management, and improve 
application availability and disaster protection. Learn more about boosting 
the value of server virtualization. http://p.sf.net/sfu/vmware-sfdev2dev
_______________________________________________
Ltp-list mailing list
Ltp-list@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/ltp-list

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

end of thread, other threads:[~2011-04-15 13:32 UTC | newest]

Thread overview: 5+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2011-04-12 14:06 [LTP] [PATCH 0/3, v3] ltp: eliminate more build warnings Alex Elder
2011-04-12 14:06 ` [LTP] [PATCH 1/3] ltp: fix warnings in "growfiles.c" Alex Elder
2011-04-12 14:06   ` [LTP] [PATCH 2/3] ltp: fix warnings in "aio-stress.c" Alex Elder
2011-04-12 14:06   ` [LTP] [PATCH 3/3] ltp: fix warnings in "fsstress.c" Alex Elder
2011-04-15 13:57 ` [LTP] [PATCH 0/3, v3] ltp: eliminate more build warnings Cyril Hrubis

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.