Skip to content

Commit f8401e9

Browse files
author
Fox Snowpatch
committed
1 parent 85ff933 commit f8401e9

2 files changed

Lines changed: 8 additions & 3 deletions

File tree

block/partitions/mac.c

Lines changed: 6 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -96,9 +96,12 @@ int mac_partition(struct parsed_partitions *state)
9696
part = (struct mac_partition *) (data + pos%512);
9797
if (be16_to_cpu(part->signature) != MAC_PARTITION_MAGIC)
9898
break;
99+
if ((be32_to_cpu(part->status) & (MAC_STATUS_VALID | MAC_STATUS_ALLOCATED)) !=
100+
(MAC_STATUS_VALID | MAC_STATUS_ALLOCATED))
101+
continue;
99102
put_partition(state, slot,
100-
be32_to_cpu(part->start_block) * (secsize/512),
101-
be32_to_cpu(part->block_count) * (secsize/512));
103+
be32_to_cpu(part->start_block) * (secsize/512),
104+
be32_to_cpu(part->block_count) * (secsize/512));
102105

103106
if (!strncasecmp(part->type, "Linux_RAID", 10))
104107
state->parts[slot].flags = ADDPART_FLAG_RAID;
@@ -112,7 +115,7 @@ int mac_partition(struct parsed_partitions *state)
112115

113116
mac_fix_string(part->processor, 16);
114117
mac_fix_string(part->name, 32);
115-
mac_fix_string(part->type, 32);
118+
mac_fix_string(part->type, 32);
116119

117120
if ((be32_to_cpu(part->status) & MAC_STATUS_BOOTABLE)
118121
&& strcasecmp(part->processor, "powerpc") == 0)

block/partitions/mac.h

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -30,6 +30,8 @@ struct mac_partition {
3030
/* there is more stuff after this that we don't need */
3131
};
3232

33+
#define MAC_STATUS_VALID 1 /* partition is valid */
34+
#define MAC_STATUS_ALLOCATED 2 /* partition is allocated */
3335
#define MAC_STATUS_BOOTABLE 8 /* partition is bootable */
3436

3537
#define MAC_DRIVER_MAGIC 0x4552

0 commit comments

Comments
 (0)