Blame SOURCES/bz1063842-2-gfs2_utils_Ensure_sb_uuid_uses_are_guarded.patch

903fa7
commit 75a68102d55a1c361725ed01864c98fee6f77199
903fa7
Author: Andrew Price <anprice@redhat.com>
903fa7
Date:   Thu Feb 6 13:16:18 2014 +0000
903fa7
903fa7
    gfs2-utils: Ensure sb_uuid uses are guarded
903fa7
    
903fa7
    Guard uses of sb_uuid with #ifdef GFS2_HAS_UUID
903fa7
    
903fa7
    Tweak print_results() in mkfs.gfs2 to accept the gfs2_sb which we
903fa7
    conditionally print the uuid from, instead of the gfs2_sbd.
903fa7
    
903fa7
    Resolves: rhbz#1063842
903fa7
    
903fa7
    Signed-off-by: Andrew Price <anprice@redhat.com>
903fa7
903fa7
diff --git a/gfs2/edit/hexedit.c b/gfs2/edit/hexedit.c
903fa7
index 36f6600..0708445 100644
903fa7
--- a/gfs2/edit/hexedit.c
903fa7
+++ b/gfs2/edit/hexedit.c
903fa7
@@ -104,10 +104,12 @@ static int gfs2_sb_printval(struct gfs2_sb *lsb, const char *strfield)
903fa7
 	checkprints(strfield, lsb, sb_locktable);
903fa7
 	checkprint(strfield, lsb, __pad3.no_addr);
903fa7
 	checkprint(strfield, lsb, __pad4.no_addr);
903fa7
+#ifdef GFS2_HAS_UUID
903fa7
 	if (strcmp(strfield, "sb_uuid") == 0) {
903fa7
 		printf("%s\n", str_uuid(lsb->sb_uuid));
903fa7
 		return 0;
903fa7
 	}
903fa7
+#endif
903fa7
 
903fa7
 	return -1;
903fa7
 }
903fa7
@@ -135,8 +137,9 @@ static int gfs2_sb_assigns(struct gfs2_sb *lsb, const char *strfield,
903fa7
 {
903fa7
 	checkassigns(strfield, lsb, sb_lockproto, val);
903fa7
 	checkassigns(strfield, lsb, sb_locktable, val);
903fa7
+#ifdef GFS2_HAS_UUID
903fa7
 	checkassigns(strfield, lsb, sb_uuid, val);
903fa7
-
903fa7
+#endif
903fa7
 	return -1;
903fa7
 }
903fa7
 
903fa7
diff --git a/gfs2/mkfs/main_mkfs.c b/gfs2/mkfs/main_mkfs.c
903fa7
index 8bd396a..32da585 100644
903fa7
--- a/gfs2/mkfs/main_mkfs.c
903fa7
+++ b/gfs2/mkfs/main_mkfs.c
903fa7
@@ -555,24 +555,25 @@ static void opts_check(struct mkfs_opts *opts)
903fa7
 	}
903fa7
 }
903fa7
 
903fa7
-static void print_results(struct gfs2_sbd *sdp, uint64_t real_device_size,
903fa7
-                          struct mkfs_opts *opts, unsigned char uuid[16])
903fa7
+static void print_results(struct gfs2_sb *sb, struct mkfs_dev *dev, struct mkfs_opts *opts,
903fa7
+                          uint64_t rgrps, uint64_t fssize)
903fa7
 {
903fa7
 	printf("%-27s%s\n", _("Device:"), opts->device);
903fa7
-	printf("%-27s%u\n", _("Block size:"), sdp->bsize);
903fa7
-	printf("%-27s%.2f %s (%llu %s)\n", _("Device size:"),
903fa7
+	printf("%-27s%u\n", _("Block size:"), sb->sb_bsize);
903fa7
+	printf("%-27s%.2f %s (%"PRIu64" %s)\n", _("Device size:"),
903fa7
 	       /* Translators: "GB" here means "gigabytes" */
903fa7
-	       real_device_size / ((float)(1 << 30)), _("GB"),
903fa7
-	       (unsigned long long)real_device_size / sdp->bsize, _("blocks"));
903fa7
-	printf("%-27s%.2f %s (%llu %s)\n", _("Filesystem size:"),
903fa7
-	       sdp->fssize / ((float)(1 << 30)) * sdp->bsize, _("GB"),
903fa7
-	       (unsigned long long)sdp->fssize, _("blocks"));
903fa7
-	printf("%-27s%u\n", _("Journals:"), sdp->md.journals);
903fa7
-	printf("%-27s%llu\n", _("Resource groups:"), (unsigned long long)sdp->rgrps);
903fa7
+	       (dev->size / ((float)(1 << 30))), _("GB"),
903fa7
+	       (dev->size / sb->sb_bsize), _("blocks"));
903fa7
+	printf("%-27s%.2f %s (%"PRIu64" %s)\n", _("Filesystem size:"),
903fa7
+	       (fssize / ((float)(1 << 30)) * sb->sb_bsize), _("GB"), fssize, _("blocks"));
903fa7
+	printf("%-27s%u\n", _("Journals:"), opts->journals);
903fa7
+	printf("%-27s%"PRIu64"\n", _("Resource groups:"), rgrps);
903fa7
 	printf("%-27s\"%s\"\n", _("Locking protocol:"), opts->lockproto);
903fa7
 	printf("%-27s\"%s\"\n", _("Lock table:"), opts->locktable);
903fa7
+#ifdef GFS2_HAS_UUID
903fa7
 	/* Translators: "UUID" = universally unique identifier. */
903fa7
-	printf("%-27s%s\n", _("UUID:"), str_uuid(uuid));
903fa7
+	printf("%-27s%s\n", _("UUID:"), str_uuid(sb->sb_uuid));
903fa7
+#endif
903fa7
 }
903fa7
 
903fa7
 static void warn_of_destruction(const char *path)
903fa7
@@ -909,5 +910,5 @@ void main_mkfs(int argc, char *argv[])
903fa7
 	}
903fa7
 
903fa7
 	if (!opts.quiet)
903fa7
-		print_results(&sbd, dev.size, &opts, sb.sb_uuid);
903fa7
+		print_results(&sb, &dev, &opts, sbd.rgrps, sbd.fssize);
903fa7
 }
903fa7
diff --git a/gfs2/tune/super.c b/gfs2/tune/super.c
903fa7
index cc34990..cbd0026 100644
903fa7
--- a/gfs2/tune/super.c
903fa7
+++ b/gfs2/tune/super.c
903fa7
@@ -124,8 +124,9 @@ static int is_gfs2(const struct tunegfs2 *tfs)
903fa7
 int print_super(const struct tunegfs2 *tfs)
903fa7
 {
903fa7
 	printf(_("File system volume name: %s\n"), tfs->sb->sb_locktable);
903fa7
-	if (is_gfs2(tfs))
903fa7
-		printf(_("File system UUID: %s\n"), uuid2str(tfs->sb->sb_uuid));
903fa7
+#ifdef GFS2_HAS_UUID
903fa7
+	printf(_("File system UUID: %s\n"), uuid2str(tfs->sb->sb_uuid));
903fa7
+#endif
903fa7
 	printf( _("File system magic number: 0x%X\n"), be32_to_cpu(tfs->sb->sb_header.mh_magic));
903fa7
 	printf(_("Block size: %d\n"), be32_to_cpu(tfs->sb->sb_bsize));
903fa7
 	printf(_("Block shift: %d\n"), be32_to_cpu(tfs->sb->sb_bsize_shift));