svn commit: r315638 - user/pho/stress2/misc

Peter Holm pho at FreeBSD.org
Mon Mar 20 14:17:02 UTC 2017


Author: pho
Date: Mon Mar 20 14:17:00 2017
New Revision: 315638
URL: https://svnweb.freebsd.org/changeset/base/315638

Log:
  Cast st_ino and st_nlink to uintmax_t for 64 bit inode changes.

Modified:
  user/pho/stress2/misc/rename6.sh
  user/pho/stress2/misc/rename8.sh
  user/pho/stress2/misc/rename9.sh
  user/pho/stress2/misc/tmpfs8.sh

Modified: user/pho/stress2/misc/rename6.sh
==============================================================================
--- user/pho/stress2/misc/rename6.sh	Mon Mar 20 13:11:30 2017	(r315637)
+++ user/pho/stress2/misc/rename6.sh	Mon Mar 20 14:17:00 2017	(r315638)
@@ -133,10 +133,12 @@ main(void)
 		if (stat(logfile, &sb1) == 0 && stat(new, &sb2) == 0 &&
 		    bcmp(&sb1, &sb2, sizeof(sb1)) == 0) {
 			fprintf(stderr, "At loop #%d\n", i);
-			fprintf(stderr, "%-15s: ino = %d, nlink = %d, size = %jd\n",
-			    logfile, sb1.st_ino, sb1.st_nlink, sb1.st_blocks);
-			fprintf(stderr, "%-15s: ino = %d, nlink = %d, size = %jd\n",
-			    new    , sb2.st_ino, sb2.st_nlink, sb2.st_blocks);
+			fprintf(stderr, "%-15s: ino = %ju, nlink = %ju,"
+			   " size = %jd\n", logfile, (uintmax_t)sb1.st_ino,
+			   (uintmax_t)sb1.st_nlink, sb1.st_blocks);
+			fprintf(stderr, "%-15s: ino = %ju, nlink = %ju, "
+			    "size = %jd\n", new    , (uintmax_t)sb2.st_ino,
+			    (uintmax_t)sb2.st_nlink, sb2.st_blocks);
 		}
 		unlink(new);
 	}

Modified: user/pho/stress2/misc/rename8.sh
==============================================================================
--- user/pho/stress2/misc/rename8.sh	Mon Mar 20 13:11:30 2017	(r315637)
+++ user/pho/stress2/misc/rename8.sh	Mon Mar 20 14:17:00 2017	(r315638)
@@ -157,8 +157,9 @@ main(int ac, char **av)
 			err(1, "stat(%s)", file1);
 		if (sb.st_ino != sb2.st_ino ||
 		    sb.st_ino == always_ino) {
-			printf("FAIL. Bad stat: always: %d file1: %d (should be %d)\n",
-			    always_ino, sb.st_ino, sb2.st_ino);
+			printf("FAIL. Bad stat: always: %ju file1: %ju (should be %ju)\n",
+			    (uintmax_t)always_ino, (uintmax_t)sb.st_ino,
+			    (uintmax_t)sb2.st_ino);
 			r = EXIT_FAILURE;
 			break;
 		}

Modified: user/pho/stress2/misc/rename9.sh
==============================================================================
--- user/pho/stress2/misc/rename9.sh	Mon Mar 20 13:11:30 2017	(r315637)
+++ user/pho/stress2/misc/rename9.sh	Mon Mar 20 14:17:00 2017	(r315638)
@@ -116,12 +116,14 @@ main(void)
 		bzero(&fa, sizeof(fa));
 		bzero(&ta, sizeof(ta));
 
-		if ((fd = open(fromFile, O_RDWR | O_CREAT | O_TRUNC, 0644)) == -1)
+		if ((fd = open(fromFile, O_RDWR | O_CREAT | O_TRUNC, 0644))
+		    == -1)
 			err(1, "creat(%s)", fromFile);
 		close(fd);
 
 		sprintf(toFile, "toFile.log.%05d", i);
-		if ((fd = open(toFile, O_RDWR | O_CREAT | O_TRUNC, 0644)) == -1)
+		if ((fd = open(toFile, O_RDWR | O_CREAT | O_TRUNC, 0644))
+		    == -1)
 			err(1, "creat(%s)", toFile);
 		write(fd, "xxx", 3);
 		close(fd);
@@ -135,22 +137,27 @@ main(void)
 			err(1, "stat(%s)", toFile);
 
 		if (tb.st_ino == ta.st_ino) {
-			fprintf(stderr, "FAIL: old and new \"To\" inode number is identical\n");
+			fprintf(stderr, "FAIL: old and new \"To\" inode "
+			    "number is identical\n");
 			fprintf(stderr, "stat() before the rename():\n");
 			fprintf(stderr,
-			    "%-16s: ino = %4d, nlink = %d, size = %jd\n",
-			    fromFile, fb.st_ino, fb.st_nlink, fb.st_blocks);
+			    "%-16s: ino = %4ju, nlink = %ju, size = %jd\n",
+			    fromFile, (uintmax_t)fb.st_ino, (uintmax_t)fb.st_nlink,
+			    fb.st_blocks);
 			fprintf(stderr,
-			    "%-16s: ino = %4d, nlink = %d, size = %jd\n",
-			    toFile, tb.st_ino, tb.st_nlink, tb.st_blocks);
+			    "%-16s: ino = %4ju, nlink = %ju, size = %jd\n",
+			    toFile, (uintmax_t)tb.st_ino, (uintmax_t)tb.st_nlink,
+			    tb.st_blocks);
 			fprintf(stderr, "\nstat() after the rename():\n");
 			if (fa.st_ino != 0)
 				fprintf(stderr,
-				    "%-16s: ino = %4d, nlink = %d, size = %jd\n",
-				    fromFile, fa.st_ino, fa.st_nlink, fa.st_blocks);
+				    "%-16s: ino = %4ju, nlink = %ju, size = "
+				    "%jd\n", fromFile, (uintmax_t)fa.st_ino,
+				    (uintmax_t)fa.st_nlink, fa.st_blocks);
 			fprintf(stderr,
-			    "%-16s: ino = %4d, nlink = %d, size = %jd\n",
-			    toFile, ta.st_ino, ta.st_nlink, ta.st_blocks);
+			    "%-16s: ino = %4ju, nlink = %ju, size = %jd\n",
+			    toFile, (uintmax_t)ta.st_ino, (uintmax_t)ta.st_nlink,
+			    ta.st_blocks);
 			kill(spid, SIGINT);
 			exit(1);
 		}

Modified: user/pho/stress2/misc/tmpfs8.sh
==============================================================================
--- user/pho/stress2/misc/tmpfs8.sh	Mon Mar 20 13:11:30 2017	(r315637)
+++ user/pho/stress2/misc/tmpfs8.sh	Mon Mar 20 14:17:00 2017	(r315638)
@@ -140,10 +140,12 @@ main(void)
 		if (r1 == 0 && r2 == 0 &&
 		    bcmp(&sb1, &sb2, sizeof(sb1)) == 0) {
 			fprintf(stderr, "FAIL 1\n");
-			fprintf(stderr, "%-15s: ino = %4d, nlink = %d, size = %jd\n",
-			    logfile, sb1.st_ino, sb1.st_nlink, sb1.st_blocks);
-			fprintf(stderr, "%-15s: ino = %4d, nlink = %d, size = %jd\n",
-			    new    , sb2.st_ino, sb2.st_nlink, sb2.st_blocks);
+			fprintf(stderr, "%-15s: ino = %4ju, nlink = %ju, "
+			    "size  = %jd\n", logfile, (uintmax_t)sb1.st_ino,
+			   (uintmax_t)sb1.st_nlink, sb1.st_blocks);
+			fprintf(stderr, "%-15s: ino = %4ju, nlink = %ju, "
+			    "size = %jd\n", new    , (uintmax_t)sb2.st_ino,
+			    (uintmax_t)sb2.st_nlink, sb2.st_blocks);
 		}
 		if (bcmp(&sb2, &sb3, sizeof(sb2)) == 0) {
 			fprintf(stderr, "Old to file is lingering\n");
@@ -152,16 +154,20 @@ main(void)
 			fprintf(stderr, "FAIL 2\n");
 			if (r1 == 0)
 				fprintf(stderr,
-				    "sb1: %-15s: ino = %4d, nlink = %d, size = %jd\n",
-				    logfile, sb1.st_ino, sb1.st_nlink, sb1.st_blocks);
+				    "sb1: %-15s: ino = %4ju, nlink = %ju, "
+				    "size = %jd\n", logfile,
+				    (uintmax_t)sb1.st_ino,
+				    (uintmax_t)sb1.st_nlink, sb1.st_blocks);
 			if (r2 == 0)
 				fprintf(stderr,
-				    "sb2: %-15s: ino = %4d, nlink = %d, size = %jd\n",
-				    new, sb2.st_ino, sb2.st_nlink, sb2.st_blocks);
+				    "sb2: %-15s: ino = %4ju, nlink = %ju, "
+				    "size = %jd\n", new, (uintmax_t)sb2.st_ino,
+				    (uintmax_t)sb2.st_nlink, sb2.st_blocks);
 			if (r3 == 0)
 				fprintf(stderr,
-				    "sb3: %-15s: ino = %4d, nlink = %d, size = %jd\n",
-				    new    , sb3.st_ino, sb3.st_nlink, sb3.st_blocks);
+				    "sb3: %-15s: ino = %4ju, nlink = %ju, "
+				    "size = %jd\n", new, (uintmax_t)sb3.st_ino,
+				    (uintmax_t)sb3.st_nlink, sb3.st_blocks);
 			exit(1);
 		}
 		unlink(new);


More information about the svn-src-user mailing list