Skip to contentSkip to conversation

just another printf cleanup

PATCH New Cyril Hrubis 1 participant 1 message Oct 9, 2009

lore
Share & tools
lore
#0 lore raw

PATCH 1/1 just another printf cleanup

Hi,
attached patch fixes some more printf formating issues as well as some coding style errors.

Signed-off-by [email protected]
Signature · 2 lines
Cyril Hrubis
[email protected]
testcases/kernel/fs/proc/proc01.c +15 -15
Index: ltp/testcases/kernel/fs/proc/proc01.c
===================================================================
@@ -27,14 +27,14 @@
 
 #include "config.h"
 
-#include <errno.h>		/* for errno */
-#include <stdio.h>		/* for NULL */
-#include <stdlib.h>		/* for malloc() */
-#include <string.h>		/* for string function */
-#include <limits.h>		/* for PATH_MAX */
-#include <sys/types.h>		/* for opendir(), readdir(), closedir(), stat() */
-#include <sys/stat.h>		/* for [l]stat() */
-#include <dirent.h>		/* for opendir(), readdir(), closedir() */
+#include <errno.h>
+#include <stdio.h>
+#include <stdlib.h>
+#include <string.h>
+#include <limits.h>
+#include <sys/types.h>
+#include <sys/stat.h>
+#include <dirent.h>
 #include <unistd.h>
 #include <fcntl.h>
 #include <fnmatch.h>
@@ -67,12 +67,12 @@ size_t buffsize = 1024;
 size_t total_read = 0;
 unsigned int total_obj = 0;
 
-struct mapping
-{
-  char func[MAX_FUNC_NAME];
-  char file[PATH_MAX];
-  int err;
+struct mapping {
+	char func[MAX_FUNC_NAME];
+	char file[PATH_MAX];
+	int err;
 };
+
 typedef struct mapping Mapping;
 
 /* Those are known failures for 2.6.18 baremetal kernel and Xen dom0
@@ -388,7 +388,7 @@ int main(int argc, char *argv[])
 	char *msg;
 	int lc;
 
-	if ((msg = parse_opts(argc, argv, options, help)) != (char *)NULL)
+	if ((msg = parse_opts(argc, argv, options, help)) != NULL)
 		tst_brkm(TBROK, cleanup, "OPTION PARSING ERROR - %s", msg);
 
 	if (opt_buffsize) {
@@ -414,7 +414,7 @@ int main(int argc, char *argv[])
 		TEST(readproc(procpath));
 
 		if (TEST_RETURN != 0) {
-			tst_resm(TFAIL, "readproc() failed with %d errors.",
+			tst_resm(TFAIL, "readproc() failed with %ld errors.",
 				 TEST_RETURN);
 		} else {
 			tst_resm(TPASS, "readproc() completed successfully, "
testcases/kernel/fs/stream/stream03.c +108 -70

299 lines not on this page · raw message

testcases/kernel/mem/mtest06/mmap1.c +1 -4
Index: ltp/testcases/kernel/mem/mtest06/mmap1.c
===================================================================
@@ -92,7 +92,6 @@
 /*	        read must be a success between map and unmap of the region.   */
 /*									      */
 /******************************************************************************/
-/* Include Files.							      */
 #include <stdio.h>
 #include <sys/types.h>
 #include <sys/stat.h>
@@ -114,7 +113,6 @@
 #include "test.h"
 #include "usctest.h"
 
-/* Defines								      */
 #define M_SUCCESS 	0	/* exit code - on success, clone functions    */
 #define MWU_FAIL 	1	/* error code - map_write_unmap()  on error   */
 #define RM_FAIL 	1	/* error code - read_mem()  on error          */
@@ -137,7 +135,6 @@
 
 
 
-/* Global Variables						              */
 int 	   verbose_print = FALSE;/* when called with -v print more info       */
 caddr_t    *map_address;	/* address of the file mapped.	              */
 sigjmp_buf jmpbuf;		/* argument to sigsetjmp and siglongjmp       */
@@ -532,7 +529,7 @@ main(int  argc,		/* number of input para
     if (verbose_print)
         tst_resm(TINFO, "Input parameters are: "
                     "File size:  %d; "
-                    "Scheduled to run:  %ld hours; "
+                    "Scheduled to run:  %lf hours; "
                     "Number of mmap/write/read:  %d",
 			file_size, exec_time, num_iter);
     set_timer(exec_time);
testcases/kernel/mem/shmt/shmt05.c +2 -2
Index: ltp/testcases/kernel/mem/shmt/shmt05.c
===================================================================
@@ -57,7 +57,7 @@ key_t key[2];
 
 int rm_shm(int);
 
-int main()
+int main(void)
 {
 	int shmid, shmid1;
 	char *cp, *cp1;
@@ -97,7 +97,7 @@ int main()
 		if (cp1 != (char *)-1) {
 			perror("shmat");
 			tst_resm(TFAIL,
-				 "Error: shmat: shmid1 = %d, addr= %#x, errno = %d\n",
+				 "Error: shmat: shmid1 = %d, addr= %p, errno = %d\n",
 				 shmid1, cp1, errno);
 		}
 		else{
testcases/kernel/mem/shmt/shmt09.c +3 -3
Index: ltp/testcases/kernel/mem/shmt/shmt09.c
===================================================================
@@ -125,8 +125,8 @@ int main()
 	c2 = (char *)shmat(shmid, vp, 0);
 	if (c2 != (char *)-1) {
 		tst_resm(TFAIL,
-			 "ERROR: shmat: succeeded!: shmid = %d, shmaddr = 0x%08x, "
-			 "att_addr = 0x%08x\n", shmid, c2, vp);
+			 "ERROR: shmat: succeeded!: shmid = %d, shmaddr = %p, "
+			 "att_addr = %p", shmid, c2, vp);
 		rm_shm(shmid);
 		tst_exit();
 	}
@@ -173,7 +173,7 @@ int main()
 #else
 	if ((vp = sbrk(INCREMENT)) != (void *)-1) {
 		tst_resm(TFAIL,
-			 "Error: sbrk succeeded!  ret = 0x%08x, curbrk = 0x%08x, ",
+			 "Error: sbrk succeeded!  ret = %p, curbrk = %p, ",
 			 vp, sbrk(0));
 		rm_shm(shmid);
 		tst_exit();
testcases/kernel/mem/vmtests/data_space.c +3 -3
Index: ltp/testcases/kernel/mem/vmtests/data_space.c
===================================================================
@@ -89,7 +89,7 @@ int usage(prog)
 	char	*prog;
 {
 	tst_resm(TCONF,"Usage: %s <nchild> <size> <chunk_size> <iterations>",prog);
-	tst_resm(TCONF,"DEFAULTS: 10 1024*1024 4096 25", prog);
+	tst_resm(TCONF,"DEFAULTS: 10 1024*1024 4096 25");
 	tst_exit();
 	return 0;
 }
@@ -323,7 +323,7 @@ int dotest(testers, me)
 			{
 				if (memcmp(buf, zero_buf, csize))
 				{
-					tst_resm(TFAIL, "\t%s[%d] bad verify @ %d (0x%x) for val %d count %d, should be 0x%x.\n",
+					tst_resm(TFAIL, "\t%s[%d] bad verify @ %d (%p) for val %d count %d, should be 0x%x.\n",
 						prog, me, chunk, buf, val, count, val - 1);
 					tst_resm(TINFO, "\tPrev "); dumpbuf(buf-csize);
 					dumpbuf(buf);
@@ -338,7 +338,7 @@ int dotest(testers, me)
 				++collide;
 				if (memcmp(buf, val_buf, csize))
 				{
-					tst_resm(TFAIL, "\t%s[%d] bad verify @ %d (0x%x) for val %d count %d.\n",
+					tst_resm(TFAIL, "\t%s[%d] bad verify @ %d (%p) for val %d count %d.\n",
 						prog, me, chunk, buf, val, count);
 					tst_resm(TINFO, "\tPrev "); dumpbuf(buf-csize);
 					dumpbuf(buf);
testcases/kernel/mem/vmtests/stack_space.c +3 -3
Index: ltp/testcases/kernel/mem/vmtests/stack_space.c
===================================================================
@@ -78,7 +78,7 @@ char	*prog;				/* invoked name */
 int usage(char* prog)
 {
 	tst_resm(TCONF,"Usage: %s <nchild> <chunk_size> <iterations>",prog);
-        tst_resm(TCONF,"DEFAULTS: 20 1024 50", prog);
+        tst_resm(TCONF,"DEFAULTS: 20 1024 50");
         tst_exit();
         return 0;
 }
@@ -275,7 +275,7 @@ int dotest(int testers, int me)
 
 			if ((bits[chunk/8] & (1<<(chunk%8))) == 0) {
 				if (memcmp(buf, zero_buf, csize)) {
-					tst_resm(TFAIL,"%s[%d] bad verify @ %d (0x%x) for val %d count %d, should be 0.\n",
+					tst_resm(TFAIL,"%s[%d] bad verify @ %d (%p) for val %d count %d, should be 0.\n",
 						prog, me, chunk, buf, val, count);
 					tst_resm(TINFO,"Prev "); dumpbuf(buf-csize);
 					dumpbuf(buf);
@@ -288,7 +288,7 @@ int dotest(int testers, int me)
 			} else {
 				++collide;
 				if (memcmp(buf, val_buf, csize)) {
-					tst_resm(TFAIL,"%s[%d] bad verify @ %d (0x%x) for val %d count %d.\n",
+					tst_resm(TFAIL,"%s[%d] bad verify @ %d (%p) for val %d count %d.\n",
 						prog, me, chunk, buf, val, count);
 					tst_resm(TINFO,"Prev "); dumpbuf(buf-csize);
 					dumpbuf(buf);
testcases/kernel/sched/nptl/nptl01.c +1 -0
Index: ltp/testcases/kernel/sched/nptl/nptl01.c
===================================================================
@@ -35,6 +35,7 @@
  *	by the test hanging and not completing execution.
  *
  ****************************************************************/
+#define _GNU_SOURCE
 #include <stdio.h>
 #include <stdlib.h>
 #include <string.h>
testcases/kernel/syscalls/close/close08.c +1 -1
Index: ltp/testcases/kernel/syscalls/close/close08.c
===================================================================
@@ -178,7 +178,7 @@ int main(int ac, char **av)
 	     ***************************************************************/
 			if (STD_FUNCTIONAL_TEST) {
 				/* No Verification test, yet... */
-				tst_resm(TPASS, "close(%s) returned %d", fname,
+				tst_resm(TPASS, "close(%s) returned %ld", fname,
 					 TEST_RETURN);
 			}
 		}
testcases/kernel/syscalls/dup/dup01.c +1 -1
Index: ltp/testcases/kernel/syscalls/dup/dup01.c
===================================================================
@@ -178,7 +178,7 @@ int main(int ac, char **av)
 	     ***************************************************************/
 			if (STD_FUNCTIONAL_TEST) {
 				/* No Verification test, yet... */
-				tst_resm(TPASS, "dup(%s) returned %d", Fname,
+				tst_resm(TPASS, "dup(%s) returned %ld", Fname,
 					 TEST_RETURN);
 			}
 
testcases/kernel/syscalls/dup/dup02.c +2 -2
Index: ltp/testcases/kernel/syscalls/dup/dup02.c
===================================================================
@@ -186,13 +186,13 @@ int main(int ac, char **av)
 				}
 			} else {
 				tst_resm(TFAIL,
-					 "dup(%d) returned %d, expected -1, errno:%d (EBADF)",
+					 "dup(%d) returned %ld, expected -1, errno:%d (EBADF)",
 					 Fds[ind], TEST_RETURN, EBADF);
 
 				/* close the new file so loops do not open too many files */
 				if (close(TEST_RETURN) == -1) {
 					tst_brkm(TBROK, cleanup,
-						 "close(%d) Failed, errno=%d : %s",
+						 "close(%ld) Failed, errno=%d : %s",
 						 TEST_RETURN, errno,
 						 strerror(errno));
 				}
testcases/kernel/syscalls/dup/dup03.c +2 -2
Index: ltp/testcases/kernel/syscalls/dup/dup03.c
===================================================================
@@ -176,7 +176,7 @@ int main(int ac, char **av)
 			}
 		} else {
 			tst_resm(TFAIL,
-				 "dup(%d) returned %d, expected -1, errno:%d (EMFILE)",
+				 "dup(%d) returned %ld, expected -1, errno:%d (EMFILE)",
 				 Fd[0], TEST_RETURN, EMFILE);
 
 			/* close the new file so loops do not open too many files */
@@ -252,7 +252,7 @@ void setup()
 	}
 	if (Nfds > maxfds) {
 		tst_brkm(TBROK, cleanup,
-			 "Unable to open enough files to use all file descriptors, tried %d",
+			 "Unable to open enough files to use all file descriptors, tried %ld",
 			 maxfds);
 	}
 }				/* End setup() */
testcases/kernel/syscalls/dup/dup04.c +4 -4
Index: ltp/testcases/kernel/syscalls/dup/dup04.c
===================================================================
@@ -179,7 +179,7 @@ int main(int ac, char **av)
 			if (STD_FUNCTIONAL_TEST) {
 				/* No Verification test, yet... */
 				tst_resm(TPASS,
-					 "dup(%d) read side of syspipe returned %d",
+					 "dup(%d) read side of syspipe returned %ld",
 					 Fd[0], TEST_RETURN);
 
 			} else
@@ -188,7 +188,7 @@ int main(int ac, char **av)
 			/* close the new file so loops do not open too many files */
 			if (close(TEST_RETURN) == -1) {
 				tst_brkm(TBROK, cleanup,
-					 "close(%d) Failed, errno=%d : %s",
+					 "close(%ld) Failed, errno=%d : %s",
 					 TEST_RETURN, errno, strerror(errno));
 			}
 		}
@@ -212,7 +212,7 @@ int main(int ac, char **av)
 			if (STD_FUNCTIONAL_TEST) {
 				/* No Verification test, yet... */
 				tst_resm(TPASS,
-					 "dup(%d) write side of syspipe returned %d",
+					 "dup(%d) write side of syspipe returned %ld",
 					 Fd[1], TEST_RETURN);
 
 			} else
@@ -221,7 +221,7 @@ int main(int ac, char **av)
 			/* close the new file so loops do not open too many files */
 			if (close(TEST_RETURN) == -1) {
 				tst_brkm(TBROK, cleanup,
-					 "close(%d) Failed, errno=%d : %s",
+					 "close(%ld) Failed, errno=%d : %s",
 					 TEST_RETURN, errno, strerror(errno));
 			}
 		}
testcases/kernel/syscalls/dup/dup05.c +1 -1
Index: ltp/testcases/kernel/syscalls/dup/dup05.c
===================================================================
@@ -179,7 +179,7 @@ int main(int ac, char **av)
 	     ***************************************************************/
 			if (STD_FUNCTIONAL_TEST) {
 				/* No Verification test, yet... */
-				tst_resm(TPASS, "dup(%s) returned %d", Fname,
+				tst_resm(TPASS, "dup(%s) returned %ld", Fname,
 					 TEST_RETURN);
 			}
 

------------------------------------------------------------------------------
Come build with us! The BlackBerry(R) Developer Conference in SF, CA is the only developer event you need to attend this year. Jumpstart your developing skills, take BlackBerry mobile applications to market and stay ahead of the curve. Join us from November 9 - 12, 2009. Register now!
http://p.sf.net/sfu/devconference

_______________________________________________
Ltp-list mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/ltp-list