block/partition/msdos: detect AIX formatted disks even without 55aa

AIX formatted disks do not always have the MSDOS 55aa signature.
This happens e.g. for unbootable AIX disks.

Up to now, such disks were not recognized as AIX disks, because of the
missing 55aa.  Fix that by inverting the two tests.  Let's first
check for the AIX magic strings, and only if that fails check for
the MSDOS magic word.

Signed-off-by: Philippe De Muyter <phdm@macqel.be>
Cc: Andreas Mohr <andi@lisas.de>
Cc: OGAWA Hirofumi <hirofumi@mail.parknet.co.jp>
Cc: Jens Axboe <axboe@kernel.dk>
Cc: Olaf Hering <olh@suse.de>
Signed-off-by: Andrew Morton <akpm@linux-foundation.org>
Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
This commit is contained in:
Philippe De Muyter 2013-02-27 17:05:16 -08:00 committed by Linus Torvalds
parent 3c94ce6f48
commit 86ee8ba64d

View File

@ -455,17 +455,22 @@ int msdos_partition(struct parsed_partitions *state)
data = read_part_sector(state, 0, &sect);
if (!data)
return -1;
if (!msdos_magic_present(data + 510)) {
put_dev_sector(sect);
return 0;
}
/*
* Note order! (some AIX disks, e.g. unbootable kind,
* have no MSDOS 55aa)
*/
if (aix_magic_present(state, data)) {
put_dev_sector(sect);
strlcat(state->pp_buf, " [AIX]", PAGE_SIZE);
return 0;
}
if (!msdos_magic_present(data + 510)) {
put_dev_sector(sect);
return 0;
}
/*
* Now that the 55aa signature is present, this is probably
* either the boot sector of a FAT filesystem or a DOS-type