patch-1.3.22 linux/drivers/block/genhd.c
Next file: linux/drivers/block/ide.c
Previous file: linux/drivers/block/floppy.c
Back to the patch index
Back to the overall index
- Lines: 58
- Date:
Fri Sep 1 09:09:58 1995
- Orig file:
v1.3.21/linux/drivers/block/genhd.c
- Orig date:
Tue Aug 15 20:39:01 1995
diff -u --recursive --new-file v1.3.21/linux/drivers/block/genhd.c linux/drivers/block/genhd.c
@@ -15,6 +15,8 @@
* with information provided by OnTrack. This now works for linux fdisk
* and LILO, as well as loadlin and bootln. Note that disks other than
* /dev/hda *must* have a "DOS" type 0x51 partition in the first slot (hda1).
+ *
+ * Added support for "missing/deleted" extended partitions - [email protected]
*/
#include <linux/config.h>
@@ -98,17 +100,19 @@
bh->b_dirt = 0;
bh->b_uptodate = 0;
bh->b_req = 0;
- if (*(unsigned short *) (bh->b_data+510) == 0xAA55) {
- p = (struct partition *) (0x1BE + bh->b_data);
+ if (*(unsigned short *) (bh->b_data+510) != 0xAA55)
+ goto done;
+ p = (struct partition *) (0x1BE + bh->b_data);
/*
* Process the first entry, which should be the real
* data partition.
*/
- if (p->sys_ind == EXTENDED_PARTITION || !p->nr_sects)
- goto done; /* shouldn't happen */
+ if (p->sys_ind == EXTENDED_PARTITION)
+ goto done; /* shouldn't happen */
+ if (p->sys_ind && p->nr_sects)
add_partition(hd, current_minor, this_sector+p->start_sect, p->nr_sects);
- current_minor++;
- p++;
+ current_minor++;
+ p++;
/*
* Process the second entry, which should be a link
* to the next logical partition. Create a minor
@@ -116,15 +120,13 @@
* table. The minor will be reused for the real
* data partition.
*/
- if (p->sys_ind != EXTENDED_PARTITION ||
- !(hd->part[current_minor].nr_sects = p->nr_sects))
- goto done; /* no more logicals in this partition */
- hd->part[current_minor].start_sect = first_sector + p->start_sect;
- this_sector = first_sector + p->start_sect;
- dev = ((hd->major) << 8) | current_minor;
- brelse(bh);
- } else
- goto done;
+ if (p->sys_ind != EXTENDED_PARTITION ||
+ !(hd->part[current_minor].nr_sects = p->nr_sects))
+ goto done; /* no more logicals in this partition */
+ hd->part[current_minor].start_sect = first_sector + p->start_sect;
+ this_sector = first_sector + p->start_sect;
+ dev = ((hd->major) << 8) | current_minor;
+ brelse(bh);
}
done:
brelse(bh);
FUNET's LINUX-ADM group, [email protected]
TCL-scripts by Sam Shen, [email protected]
with Sam's (original) version of this