Blame SOURCES/0037-libparted-Fix-probing-AIX-disks-on-other-arches.patch

0cb0b9
From 85cec179048914d165e3a11b1d8d8c759725d236 Mon Sep 17 00:00:00 2001
0cb0b9
From: "Brian C. Lane" <bcl@redhat.com>
0cb0b9
Date: Fri, 6 May 2016 14:39:09 -0700
0cb0b9
Subject: [PATCH 37/38] libparted: Fix probing AIX disks on other arches
0cb0b9
0cb0b9
Not a likely scenario, but make sure the magic check works everywhere.
0cb0b9
0cb0b9
(cherry picked from commit 24cd71c0a7c4b2abdfff04be5a088a44ab5df2fe)
0cb0b9
---
0cb0b9
 libparted/labels/aix.c | 18 +++---------------
0cb0b9
 1 file changed, 3 insertions(+), 15 deletions(-)
0cb0b9
0cb0b9
diff --git a/libparted/labels/aix.c b/libparted/labels/aix.c
0cb0b9
index 0fa6fe7..a831d95 100644
0cb0b9
--- a/libparted/labels/aix.c
0cb0b9
+++ b/libparted/labels/aix.c
0cb0b9
@@ -34,23 +34,11 @@
0cb0b9
 #  define _(String) (String)
0cb0b9
 #endif /* ENABLE_NLS */
0cb0b9
 
0cb0b9
-#define	AIX_LABEL_MAGIC		0xc9c2d4c1
0cb0b9
+#define	AIX_LABEL_MAGIC		(0xc9c2d4c1UL)
0cb0b9
 #define	MAX_TOTAL_PART		16
0cb0b9
 
0cb0b9
 static PedDiskType aix_disk_type;
0cb0b9
 
0cb0b9
-static inline int
0cb0b9
-aix_label_magic_get (const char *label)
0cb0b9
-{
0cb0b9
-	return *(unsigned int *)label;
0cb0b9
-}
0cb0b9
-
0cb0b9
-static inline void
0cb0b9
-aix_label_magic_set (char *label, int magic_val)
0cb0b9
-{
0cb0b9
-	*(unsigned int *)label = magic_val;
0cb0b9
-}
0cb0b9
-
0cb0b9
 static int
0cb0b9
 aix_probe (const PedDevice *dev)
0cb0b9
 {
0cb0b9
@@ -59,9 +47,9 @@ aix_probe (const PedDevice *dev)
0cb0b9
 	void *label;
0cb0b9
 	if (!ptt_read_sector (dev, 0, &label))
0cb0b9
 		return 0;
0cb0b9
-	unsigned int magic = aix_label_magic_get (label);
0cb0b9
+	bool found = PED_BE32_TO_CPU(*(uint32_t *)label) == AIX_LABEL_MAGIC;
0cb0b9
 	free (label);
0cb0b9
-	return magic == AIX_LABEL_MAGIC;
0cb0b9
+	return found;
0cb0b9
 }
0cb0b9
 
0cb0b9
 static PedDisk*
0cb0b9
-- 
0cb0b9
2.5.5
0cb0b9