Skip to content

Commit

Permalink
block/partition/msdos: detect AIX formatted disks even without 55aa
Browse files Browse the repository at this point in the history
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 <[email protected]>
Cc: Andreas Mohr <[email protected]>
Cc: OGAWA Hirofumi <[email protected]>
Cc: Jens Axboe <[email protected]>
Cc: Olaf Hering <[email protected]>
Signed-off-by: Andrew Morton <[email protected]>
Signed-off-by: Linus Torvalds <[email protected]>
  • Loading branch information
phdm authored and torvalds committed Feb 28, 2013
1 parent 3c94ce6 commit 86ee8ba
Showing 1 changed file with 8 additions and 3 deletions.
11 changes: 8 additions & 3 deletions block/partitions/msdos.c
Original file line number Diff line number Diff line change
Expand Up @@ -455,14 +455,19 @@ int msdos_partition(struct parsed_partitions *state)
data = read_part_sector(state, 0, &sect);
if (!data)
return -1;
if (!msdos_magic_present(data + 510)) {

/*
* 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 (aix_magic_present(state, data)) {
if (!msdos_magic_present(data + 510)) {
put_dev_sector(sect);
strlcat(state->pp_buf, " [AIX]", PAGE_SIZE);
return 0;
}

Expand Down

0 comments on commit 86ee8ba

Please sign in to comment.