File parted-wipeaix.patch of Package parted

Index: parted-1.9.0/libparted/labels/dos.c
===================================================================
--- parted-1.9.0.orig/libparted/labels/dos.c	2009-07-29 11:31:18.000000000 +0200
+++ parted-1.9.0/libparted/labels/dos.c	2009-07-29 11:36:43.000000000 +0200
@@ -54,6 +54,8 @@ static const char MBR_BOOT_CODE[] = {
 #define MSDOS_MAGIC		0xAA55
 #define PARTITION_MAGIC_MAGIC	0xf6f6
 
+#define AIXIPLRECID		0xc9c2d4c1 /* Value is EBCIDIC 'IBMA' */
+
 #define PARTITION_EMPTY		0x00
 #define PARTITION_FAT12		0x01
 #define PARTITION_FAT16_SM	0x04
@@ -193,6 +195,10 @@ msdos_probe (const PedDevice *dev)
 	if (PED_LE16_TO_CPU (part_table->magic) != MSDOS_MAGIC)
 		goto probe_fail;
 
+	/* Is this an AIX IPL label? Then just go away. */
+	if (PED_BE32_TO_CPU (*(unsigned int*)(part_table->boot_code)) == AIXIPLRECID)
+	    goto probe_fail;
+
 	/* If this is a FAT fs, fail here.  Checking for the FAT signature
 	 * has some false positives; instead, do what the Linux kernel does
 	 * and ensure that each partition has a boot indicator that is
@@ -1142,7 +1148,10 @@ msdos_write (const PedDisk* disk)
 
 	ped_device_read (disk->dev, &table, 0, 1);
 
-	if (!table.boot_code[0]) {
+	/* either no bootrecord at all, or AIX IPL signature ... */
+	if ((!table.boot_code[0]) ||
+	    (PED_BE32_TO_CPU (*(unsigned int*)(table.boot_code)) == AIXIPLRECID)
+	) {
 		memset (table.boot_code, 0, 512);
 		memcpy (table.boot_code, MBR_BOOT_CODE, sizeof (MBR_BOOT_CODE));
 	}
openSUSE Build Service is sponsored by