summaryrefslogtreecommitdiff
path: root/libparted/labels/aix.c
diff options
context:
space:
mode:
authorBrian C. Lane <bcl@redhat.com>2016-05-06 14:39:09 -0700
committerBrian C. Lane <bcl@redhat.com>2016-05-06 17:05:32 -0700
commit24cd71c0a7c4b2abdfff04be5a088a44ab5df2fe (patch)
tree50e1f20df1e9666062b4cae1fe102c03af4f8b40 /libparted/labels/aix.c
parentc58f816ffbc0bc4eacfb57d492cbe3b7497ede9f (diff)
downloadparted-24cd71c0a7c4b2abdfff04be5a088a44ab5df2fe.tar.gz
libparted: Fix probing AIX disks on other arches
Not a likely scenario, but make sure the magic check works everywhere.
Diffstat (limited to 'libparted/labels/aix.c')
-rw-r--r--libparted/labels/aix.c18
1 files 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*