--- zzzz-none-000/linux-2.4.17/fs/partitions/check.c 2001-10-12 00:25:10.000000000 +0000 +++ sangam-fb-322/linux-2.4.17/fs/partitions/check.c 2004-11-24 13:22:10.000000000 +0000 @@ -39,9 +39,32 @@ int warn_no_part = 1; /*This is ugly: should make genhd removable media aware*/ static int (*check_part[])(struct gendisk *hd, struct block_device *bdev, unsigned long first_sect, int first_minor) = { -#ifdef CONFIG_ACORN_PARTITION - acorn_partition, + /* + * Probe partition formats with tables at disk address 0 + * that also have an ADFS boot block at 0xdc0. + */ +#ifdef CONFIG_ACORN_PARTITION_ICS + adfspart_check_ICS, +#endif +#ifdef CONFIG_ACORN_PARTITION_POWERTEC + adfspart_check_POWERTEC, +#endif +#ifdef CONFIG_ACORN_PARTITION_EESOX + adfspart_check_EESOX, +#endif + + /* + * Now move on to formats that only have partition info at + * disk address 0xdc0. These should come before MSDOS + * partition tables. + */ +#ifdef CONFIG_ACORN_PARTITION_CUMANA + adfspart_check_CUMANA, +#endif +#ifdef CONFIG_ACORN_PARTITION_ADFS + adfspart_check_ADFS, #endif + #ifdef CONFIG_LDM_PARTITION ldm_partition, /* this must come before msdos */ #endif @@ -75,6 +98,18 @@ NULL }; +static char *raid_name (struct gendisk *hd, unsigned int unit, unsigned int part, + int major_base, char *buf) +{ + int ctlr = hd->major - major_base; + if (part == 0) + sprintf(buf, "%s/c%dd%d", hd->major_name, ctlr, unit); + else + sprintf(buf, "%s/c%dd%dp%d", hd->major_name, ctlr, unit, + part); + return buf; +} + /* * This is ucking fugly but its probably the best thing for 2.4.x * Take it as a clear reminder than we should put the device name @@ -96,10 +131,11 @@ char *disk_name (struct gendisk *hd, int minor, char *buf) { const char *maj = hd->major_name; - unsigned int unit = (minor >> hd->minor_shift); - unsigned int part = (minor & ((1 << hd->minor_shift) -1 )); + unsigned int unit = minor >> hd->minor_shift; + unsigned int part = minor & (( 1 << hd->minor_shift) - 1); + char *p; - if ((unit < hd->nr_real) && hd->part[minor].de) { + if (unit < hd->nr_real && hd->part[minor].de) { int pos; pos = devfs_generate_path (hd->part[minor].de, buf, 64); @@ -145,51 +181,32 @@ } if (hd->major >= SCSI_DISK1_MAJOR && hd->major <= SCSI_DISK7_MAJOR) { unit = unit + (hd->major - SCSI_DISK1_MAJOR + 1) * 16; - if (unit+'a' > 'z') { - unit -= 26; - sprintf(buf, "sd%c%c", 'a' + unit / 26, 'a' + unit % 26); - if (part) - sprintf(buf + 4, "%d", part); - return buf; - } } if (hd->major >= COMPAQ_SMART2_MAJOR && hd->major <= COMPAQ_SMART2_MAJOR+7) { - int ctlr = hd->major - COMPAQ_SMART2_MAJOR; - if (part == 0) - sprintf(buf, "%s/c%dd%d", maj, ctlr, unit); - else - sprintf(buf, "%s/c%dd%dp%d", maj, ctlr, unit, part); - return buf; - } + return raid_name(hd, unit, part, COMPAQ_SMART2_MAJOR, buf); + } if (hd->major >= COMPAQ_CISS_MAJOR && hd->major <= COMPAQ_CISS_MAJOR+7) { - int ctlr = hd->major - COMPAQ_CISS_MAJOR; - if (part == 0) - sprintf(buf, "%s/c%dd%d", maj, ctlr, unit); - else - sprintf(buf, "%s/c%dd%dp%d", maj, ctlr, unit, part); - return buf; + return raid_name(hd, unit, part, COMPAQ_CISS_MAJOR, buf); } if (hd->major >= DAC960_MAJOR && hd->major <= DAC960_MAJOR+7) { - int ctlr = hd->major - DAC960_MAJOR; + return raid_name(hd, unit, part, DAC960_MAJOR, buf); + } + if (hd->major == ATARAID_MAJOR) { + int disk = minor >> hd->minor_shift; + int part = minor & (( 1 << hd->minor_shift) - 1); if (part == 0) - sprintf(buf, "%s/c%dd%d", maj, ctlr, unit); + sprintf(buf, "%s/d%d", maj, disk); else - sprintf(buf, "%s/c%dd%dp%d", maj, ctlr, unit, part); + sprintf(buf, "%s/d%dp%d", maj, disk, part); return buf; } - if (hd->major == ATARAID_MAJOR) { - int disk = minor >> hd->minor_shift; - int part = minor & (( 1 << hd->minor_shift) - 1); - if (part == 0) - sprintf(buf, "%s/d%d", maj, disk); - else - sprintf(buf, "%s/d%dp%d", maj, disk, part); - return buf; - } - if (part) - sprintf(buf, "%s%c%d", maj, unit+'a', part); + p = buf; + if (unit <= 26) + p += sprintf(buf, "%s%c", maj, 'a' + unit); else - sprintf(buf, "%s%c", maj, unit+'a'); + p += sprintf(buf, "%s%c%c", maj, 'a' + unit / 26, 'a' + unit % 26); + if (part) + sprintf(p, "%d", part); return buf; } @@ -199,7 +216,7 @@ void add_gd_partition(struct gendisk *hd, int minor, int start, int size) { #ifndef CONFIG_DEVFS_FS - char buf[40]; + char buf[MAX_DISKNAME_LEN]; #endif hd->part[minor].start_sect = start; @@ -221,7 +238,7 @@ static int first_time = 1; unsigned long first_sector; struct block_device *bdev; - char buf[64]; + char buf[MAX_DISKNAME_LEN]; int i; if (first_time)