[PATCH] relax check for AIX in msdos partition table
[linux-drm-fsl-dcu.git] / fs / partitions / msdos.c
index 8c7af1777819e2b2d5cdeabc49ef87298ca89c19..dafd3b6b2dc3301be1c03946bfaf0dfd5e6a9f0f 100644 (file)
@@ -63,15 +63,25 @@ msdos_magic_present(unsigned char *p)
 #define AIX_LABEL_MAGIC4       0xC1
 static int aix_magic_present(unsigned char *p, struct block_device *bdev)
 {
+       struct partition *pt = (struct partition *) (p + 0x1be);
        Sector sect;
        unsigned char *d;
-       int ret = 0;
+       int slot, ret = 0;
 
        if (p[0] != AIX_LABEL_MAGIC1 &&
                p[1] != AIX_LABEL_MAGIC2 &&
                p[2] != AIX_LABEL_MAGIC3 &&
                p[3] != AIX_LABEL_MAGIC4)
                return 0;
+       /* Assume the partition table is valid if Linux partitions exists */
+       for (slot = 1; slot <= 4; slot++, pt++) {
+               if (pt->sys_ind == LINUX_SWAP_PARTITION ||
+                       pt->sys_ind == LINUX_RAID_PARTITION ||
+                       pt->sys_ind == LINUX_DATA_PARTITION ||
+                       pt->sys_ind == LINUX_LVM_PARTITION ||
+                       is_extended_partition(pt))
+                       return 0;
+       }
        d = read_dev_sector(bdev, 7, &sect);
        if (d) {
                if (d[0] == '_' && d[1] == 'L' && d[2] == 'V' && d[3] == 'M')