]>
Commit | Line | Data |
---|---|---|
c886eb9d AM |
1 | From 85cec179048914d165e3a11b1d8d8c759725d236 Mon Sep 17 00:00:00 2001 |
2 | From: "Brian C. Lane" <bcl@redhat.com> | |
3 | Date: Fri, 6 May 2016 14:39:09 -0700 | |
4 | Subject: [PATCH 37/38] libparted: Fix probing AIX disks on other arches | |
5 | ||
6 | Not a likely scenario, but make sure the magic check works everywhere. | |
7 | ||
8 | (cherry picked from commit 24cd71c0a7c4b2abdfff04be5a088a44ab5df2fe) | |
9 | --- | |
10 | libparted/labels/aix.c | 18 +++--------------- | |
11 | 1 file changed, 3 insertions(+), 15 deletions(-) | |
12 | ||
13 | diff --git a/libparted/labels/aix.c b/libparted/labels/aix.c | |
14 | index 0fa6fe7..a831d95 100644 | |
15 | --- a/libparted/labels/aix.c | |
16 | +++ b/libparted/labels/aix.c | |
17 | @@ -34,23 +34,11 @@ | |
18 | # define _(String) (String) | |
19 | #endif /* ENABLE_NLS */ | |
20 | ||
21 | -#define AIX_LABEL_MAGIC 0xc9c2d4c1 | |
22 | +#define AIX_LABEL_MAGIC (0xc9c2d4c1UL) | |
23 | #define MAX_TOTAL_PART 16 | |
24 | ||
25 | static PedDiskType aix_disk_type; | |
26 | ||
27 | -static inline int | |
28 | -aix_label_magic_get (const char *label) | |
29 | -{ | |
30 | - return *(unsigned int *)label; | |
31 | -} | |
32 | - | |
33 | -static inline void | |
34 | -aix_label_magic_set (char *label, int magic_val) | |
35 | -{ | |
36 | - *(unsigned int *)label = magic_val; | |
37 | -} | |
38 | - | |
39 | static int | |
40 | aix_probe (const PedDevice *dev) | |
41 | { | |
42 | @@ -59,9 +47,9 @@ aix_probe (const PedDevice *dev) | |
43 | void *label; | |
44 | if (!ptt_read_sector (dev, 0, &label)) | |
45 | return 0; | |
46 | - unsigned int magic = aix_label_magic_get (label); | |
47 | + bool found = PED_BE32_TO_CPU(*(uint32_t *)label) == AIX_LABEL_MAGIC; | |
48 | free (label); | |
49 | - return magic == AIX_LABEL_MAGIC; | |
50 | + return found; | |
51 | } | |
52 | ||
53 | static PedDisk* | |
54 | -- | |
55 | 2.5.5 | |
56 |