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