patch-2.3.3 linux/drivers/block/genhd.c
Next file: linux/drivers/block/hd.c
Previous file: linux/drivers/block/floppy.c
Back to the patch index
Back to the overall index
- Lines: 115
- Date:
Sat May 15 23:43:04 1999
- Orig file:
v2.3.2/linux/drivers/block/genhd.c
- Orig date:
Fri May 14 18:55:13 1999
diff -u --recursive --new-file v2.3.2/linux/drivers/block/genhd.c linux/drivers/block/genhd.c
@@ -66,10 +66,10 @@
#endif
/*
- * disk_name() is used by genhd.c and md.c.
- * It formats the devicename of the indicated disk
- * into the supplied buffer, and returns a pointer
- * to that same buffer (for convenience).
+ * disk_name() is used by genhd.c and blkpg.c.
+ * It formats the devicename of the indicated disk into
+ * the supplied buffer (of size at least 32), and returns
+ * a pointer to that same buffer (for convenience).
*/
char *disk_name (struct gendisk *hd, int minor, char *buf)
{
@@ -121,7 +121,7 @@
static void add_partition (struct gendisk *hd, int minor, int start, int size)
{
- char buf[8];
+ char buf[32];
hd->part[minor].start_sect = start;
hd->part[minor].nr_sects = size;
printk(" %s", disk_name(hd, minor, buf));
@@ -134,12 +134,12 @@
SYS_IND(p) == LINUX_EXTENDED_PARTITION);
}
-static int sector_partition_scale(kdev_t dev)
+int get_hardsect_size(kdev_t dev)
{
- if (hardsect_size[MAJOR(dev)] != NULL)
- return (hardsect_size[MAJOR(dev)][MINOR(dev)]/512);
- else
- return (1);
+ if (hardsect_size[MAJOR(dev)] != NULL)
+ return hardsect_size[MAJOR(dev)][MINOR(dev)];
+ else
+ return 512;
}
static unsigned int get_ptable_blocksize(kdev_t dev)
@@ -209,7 +209,7 @@
struct partition *p;
unsigned long first_sector, first_size, this_sector, this_size;
int mask = (1 << hd->minor_shift) - 1;
- int sector_size = sector_partition_scale(dev);
+ int sector_size = get_hardsect_size(dev) / 512;
int i;
first_sector = hd->part[MINOR(dev)].start_sect;
@@ -453,7 +453,7 @@
struct partition *p;
unsigned char *data;
int mask = (1 << hd->minor_shift) - 1;
- int sector_size = sector_partition_scale(dev);
+ int sector_size = get_hardsect_size(dev) / 512;
#ifdef CONFIG_BSD_DISKLABEL
/* no bsd disklabel as a default */
kdev_t bsd_kdev = 0;
@@ -883,10 +883,7 @@
int blocksize;
old_blocksize = get_ptable_blocksize(dev);
- if (hardsect_size[MAJOR(dev)] != NULL)
- blocksize = hardsect_size[MAJOR(dev)][MINOR(dev)];
- else
- blocksize = 512;
+ blocksize = get_hardsect_size(dev);
set_blocksize(dev,blocksize);
res = 0;
@@ -1223,7 +1220,7 @@
{
static int first_time = 1;
unsigned long first_sector;
- char buf[8];
+ char buf[32];
if (first_time)
printk("Partition check:\n");
@@ -1307,28 +1304,21 @@
int end_minor = dev->max_nr * dev->max_p;
blk_size[dev->major] = NULL;
- for (i = 0 ; i < end_minor; i++) {
+ for (i = 0; i < end_minor; i++) {
dev->part[i].start_sect = 0;
dev->part[i].nr_sects = 0;
+ dev->sizes[i] = 0;
}
dev->init(dev);
- for (drive = 0 ; drive < dev->nr_real ; drive++) {
- int first_minor = drive << dev->minor_shift;
- current_minor = 1 + first_minor;
- check_partition(dev, MKDEV(dev->major, first_minor));
- }
- if (dev->sizes != NULL) { /* optional safeguard in ll_rw_blk.c */
- for (i = 0; i < end_minor; i++)
- dev->sizes[i] = dev->part[i].nr_sects >> (BLOCK_SIZE_BITS - 9);
- blk_size[dev->major] = dev->sizes;
- }
+ for (drive = 0; drive < dev->nr_real; drive++)
+ resetup_one_dev(dev, drive);
}
__initfunc(void device_setup(void))
{
extern void console_map_init(void);
#ifdef CONFIG_PARPORT
- extern int parport_init(void);
+ extern int parport_init(void) __init;
#endif
#ifdef CONFIG_MD_BOOT
extern void md_setup_drive(void) __init;
FUNET's LINUX-ADM group, linux-adm@nic.funet.fi
TCL-scripts by Sam Shen (who was at: slshen@lbl.gov)