X-Git-Url: http://git.onelab.eu/?a=blobdiff_plain;f=fs%2Fpartitions%2Fmsdos.c;fp=fs%2Fpartitions%2Fmsdos.c;h=8c7af1777819e2b2d5cdeabc49ef87298ca89c19;hb=97bf2856c6014879bd04983a3e9dfcdac1e7fe85;hp=9935d254186ef10276781815193995895b3dab8b;hpb=76828883507a47dae78837ab5dec5a5b4513c667;p=linux-2.6.git diff --git a/fs/partitions/msdos.c b/fs/partitions/msdos.c index 9935d2541..8c7af1777 100644 --- a/fs/partitions/msdos.c +++ b/fs/partitions/msdos.c @@ -19,7 +19,6 @@ * Re-organised Feb 1998 Russell King */ -#include #include "check.h" #include "msdos.h" @@ -33,13 +32,11 @@ #include #define SYS_IND(p) (get_unaligned(&p->sys_ind)) -#define NR_SECTS(p) ({ __typeof__(p->nr_sects) __a = \ - get_unaligned(&p->nr_sects); \ +#define NR_SECTS(p) ({ __le32 __a = get_unaligned(&p->nr_sects); \ le32_to_cpu(__a); \ }) -#define START_SECT(p) ({ __typeof__(p->start_sect) __a = \ - get_unaligned(&p->start_sect); \ +#define START_SECT(p) ({ __le32 __a = get_unaligned(&p->start_sect); \ le32_to_cpu(__a); \ }) @@ -59,6 +56,31 @@ msdos_magic_present(unsigned char *p) return (p[0] == MSDOS_LABEL_MAGIC1 && p[1] == MSDOS_LABEL_MAGIC2); } +/* Value is EBCDIC 'IBMA' */ +#define AIX_LABEL_MAGIC1 0xC9 +#define AIX_LABEL_MAGIC2 0xC2 +#define AIX_LABEL_MAGIC3 0xD4 +#define AIX_LABEL_MAGIC4 0xC1 +static int aix_magic_present(unsigned char *p, struct block_device *bdev) +{ + Sector sect; + unsigned char *d; + int 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; + d = read_dev_sector(bdev, 7, §); + if (d) { + if (d[0] == '_' && d[1] == 'L' && d[2] == 'V' && d[3] == 'M') + ret = 1; + put_dev_sector(sect); + }; + return ret; +} + /* * Create devices for each logical partition in an extended partition. * The logical partitions form a linked list, with each entry being @@ -394,6 +416,12 @@ int msdos_partition(struct parsed_partitions *state, struct block_device *bdev) return 0; } + if (aix_magic_present(data, bdev)) { + put_dev_sector(sect); + printk( " [AIX]"); + return 0; + } + /* * Now that the 55aa signature is present, this is probably * either the boot sector of a FAT filesystem or a DOS-type