patch-2.2.18 linux/drivers/block/genhd.c
Next file: linux/drivers/block/hd.c
Previous file: linux/drivers/block/gayle.c
Back to the patch index
Back to the overall index
- Lines: 276
- Date:
Wed Nov 8 23:08:16 2000
- Orig file:
v2.2.17/drivers/block/genhd.c
- Orig date:
Sat Sep 9 18:42:34 2000
diff -u --new-file --recursive --exclude-from /usr/src/exclude v2.2.17/drivers/block/genhd.c linux/drivers/block/genhd.c
@@ -29,6 +29,10 @@
#include <linux/blk.h>
#include <linux/init.h>
+#ifdef CONFIG_ARCH_S390
+#include <asm/dasd.h>
+#endif /* CONFIG_ARCH_S390 */
+
#include <asm/system.h>
#include <asm/byteorder.h>
@@ -67,7 +71,7 @@
extern int net_dev_init(void);
#ifdef CONFIG_PPC
-extern void note_bootable_part(kdev_t dev, int part);
+extern void note_bootable_part(kdev_t dev, int part, int goodness);
#endif
static char *raid_name (struct gendisk *hd, int minor, int major_base,
@@ -84,6 +88,10 @@
return buf;
}
+#ifdef CONFIG_ARCH_S390
+int (*genhd_dasd_name)(char*,int,int,struct gendisk*) = NULL;
+#endif
+
/*
* disk_name() is used by genhd.c and md.c.
* It formats the devicename of the indicated disk
@@ -96,6 +104,14 @@
const char *maj = hd->major_name;
int unit = (minor >> hd->minor_shift) + 'a';
+#ifdef CONFIG_ARCH_S390
+ if ( strncmp ( hd->major_name,"dasd",4) == 0 ){
+ part = minor & ((1 << hd->minor_shift) - 1);
+ if ( genhd_dasd_name )
+ genhd_dasd_name(buf,minor>>hd->minor_shift,part,hd);
+ return buf;
+ }
+#endif
/*
* IDE devices use multiple major numbers, but the drives
* are named as: {hda,hdb}, {hdc,hdd}, {hde,hdf}, {hdg,hdh}..
@@ -131,6 +147,10 @@
return buf;
}
}
+ if (hd->major >= COMPAQ_CISS_MAJOR && hd->major <=
+ COMPAQ_CISS_MAJOR+7) {
+ return raid_name (hd, minor, COMPAQ_CISS_MAJOR, buf);
+ }
if (hd->major >= COMPAQ_SMART2_MAJOR && hd->major <=
COMPAQ_SMART2_MAJOR+7) {
return raid_name (hd, minor, COMPAQ_SMART2_MAJOR, buf);
@@ -1175,7 +1195,8 @@
goodness++;
if (strcasecmp(part->type, "Apple_UNIX_SVR2") == 0
- || strcasecmp(part->type, "Linux_PPC") == 0) {
+ || (strnicmp(part->type, "Linux", 5) == 0
+ && strcasecmp(part->type, "Linux_swap") != 0)) {
int i, l;
goodness++;
@@ -1204,7 +1225,7 @@
}
#ifdef CONFIG_PPC
if (found_root_goodness)
- note_bootable_part(dev, found_root);
+ note_bootable_part(dev, found_root, found_root_goodness);
#endif
brelse(bh);
printk("\n");
@@ -1398,10 +1419,11 @@
#endif /* CONFIG_ULTRIX_PARTITION */
#ifdef CONFIG_ARCH_S390
+#include <linux/malloc.h>
+#include <linux/hdreg.h>
+#include <linux/ioctl.h>
#include <asm/ebcdic.h>
-#include "../s390/block/dasd_types.h"
-
-dasd_information_t **dasd_information = NULL;
+#include <asm/uaccess.h>
typedef enum {
ibm_partition_none = 0,
@@ -1438,14 +1460,45 @@
ibm_partition_t partition_type;
char type[5] = {0,};
char name[7] = {0,};
- int di = MINOR(dev) >> hd->minor_shift;
- if ( ! get_ptable_blocksize(dev) )
+ struct hd_geometry geo;
+ mm_segment_t old_fs;
+ int blocksize;
+ struct file *filp = NULL;
+ struct inode *inode = NULL;
+ int offset, size;
+ int rc;
+
+ blocksize = hardsect_size[MAJOR(dev)][MINOR(dev)];
+ if ( blocksize <= 0 ) {
return 0;
- if ( ! dasd_information )
+ }
+ set_blocksize(dev, blocksize); /* OUCH !! */
+
+ /* find out offset of volume label (partn table) */
+ filp = (struct file *)kmalloc (sizeof(struct file),GFP_KERNEL);
+ if ( filp == NULL ) {
+ printk (KERN_WARNING __FILE__ " ibm_partition: kmalloc failed for filp\n");
+ return 0;
+ }
+ memset(filp,0,sizeof(struct file));
+ filp ->f_mode = 1; /* read only */
+ inode = get_empty_inode();
+ inode -> i_rdev = dev;
+ rc = blkdev_open(inode,filp);
+ if ( rc ) {
+ return 0;
+ }
+ old_fs=get_fs();
+ set_fs(KERNEL_DS);
+ rc = filp->f_op->ioctl (inode, filp, HDIO_GETGEO, (unsigned long)(&geo));
+ set_fs(old_fs);
+ if ( rc ) {
return 0;
- if ( ( bh = bread( dev,
- dasd_information[di]->sizes.label_block,
- dasd_information[di]->sizes.bp_sector ) ) != NULL ) {
+ }
+ blkdev_release(inode);
+
+ size = hd -> sizes[MINOR(dev)]<<1;
+ if ( ( bh = bread( dev, geo.start, blocksize) ) != NULL ) {
strncpy ( type,bh -> b_data, 4);
strncpy ( name,bh -> b_data + 4, 6);
} else {
@@ -1455,50 +1508,45 @@
EBCASC(name,6);
}
switch ( partition_type = get_partition_type(type) ) {
- case ibm_partition_lnx1:
+ case ibm_partition_lnx1:
+ offset = (geo.start + 1);
printk ( "(LNX1)/%6s:",name);
- add_partition( hd, MINOR(dev) + 1,
- (dasd_information[di]->sizes.label_block + 1) <<
- dasd_information[di]->sizes.s2b_shift,
- (dasd_information [di]->sizes.blocks -
- dasd_information[di]->sizes.label_block - 1) <<
- dasd_information[di]->sizes.s2b_shift,0 );
break;
case ibm_partition_vol1:
+ offset = 0;
+ size = 0;
printk ( "(VOL1)/%6s:",name);
break;
case ibm_partition_cms1:
printk ( "(CMS1)/%6s:",name);
if (* (((long *)bh->b_data) + 13) == 0) {
/* disk holds a CMS filesystem */
- add_partition( hd, MINOR(dev) + 1,
- (dasd_information [di]->sizes.label_block + 1) <<
- dasd_information [di]->sizes.s2b_shift,
- (dasd_information [di]->sizes.blocks -
- dasd_information [di]->sizes.label_block) <<
- dasd_information [di]->sizes.s2b_shift,0 );
+ offset = (geo.start + 1);
printk ("(CMS)");
} else {
- /* disk is reserved minidisk */
- long *label=(long*)bh->b_data;
- int offset = label[13];
- int size = (label[7]-1-label[13])*(label[3]>>9);
- add_partition( hd, MINOR(dev) + 1,
- offset << dasd_information [di]->sizes.s2b_shift,
- size<<dasd_information [di]->sizes.s2b_shift,0 );
+ /* disk is reserved minidisk */
+ // mdisk_setup_data.size[i] =
+ // (label[7] - 1 - label[13]) *
+ // (label[3] >> 9) >> 1;
+ long *label=(long*)bh->b_data;
+ blocksize = label[3];
+ offset = label[13];
+ size = (label[7]-1)*(blocksize>>9);
printk ("(MDSK)");
}
break;
case ibm_partition_none:
printk ( "(nonl)/ :");
- add_partition( hd, MINOR(dev) + 1,
- (dasd_information [di]->sizes.label_block + 1) <<
- dasd_information [di]->sizes.s2b_shift,
- (dasd_information [di]->sizes.blocks -
- dasd_information [di]->sizes.label_block - 1) <<
- dasd_information [di]->sizes.s2b_shift,0 );
+ offset = (geo.start+1);
break;
- }
+ default:
+ offset = 0;
+ size = 0;
+
+ }
+ add_partition( hd, MINOR(dev), 0,size,0);
+ add_partition( hd, MINOR(dev) + 1, offset * (blocksize >> 9),
+ size-offset*(blocksize>>9) ,0 );
printk ( "\n" );
bforget(bh);
return 1;
@@ -1512,7 +1560,7 @@
char buf[MAX_DISKNAME_LEN];
if (first_time)
- printk("Partition check:\n");
+ printk(KERN_INFO "Partition check:\n");
first_time = 0;
first_sector = hd->part[MINOR(dev)].start_sect;
@@ -1525,7 +1573,7 @@
return;
}
- printk(" %s:", disk_name(hd, MINOR(dev), buf));
+ printk(KERN_INFO " %s:", disk_name(hd, MINOR(dev), buf));
#ifdef CONFIG_MSDOS_PARTITION
if (msdos_partition(hd, dev, first_sector))
return;
@@ -1605,14 +1653,18 @@
dev->part[i].start_sect = 0;
dev->part[i].nr_sects = 0;
}
- dev->init(dev);
+ if ( dev->init != NULL )
+ 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 we really have a device check partition table */
+ if ( blksize_size[dev->major] == NULL ||
+ blksize_size[dev->major][current_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++)
+ 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;
}
@@ -1622,6 +1674,9 @@
{
extern void console_map_init(void);
extern void cpqarray_init(void);
+#ifdef CONFIG_BLK_CPQ_CISS_DA
+ extern int cciss_init(void);
+#endif
#ifdef CONFIG_PARPORT
extern int parport_init(void);
#endif
@@ -1654,6 +1709,9 @@
#endif
#ifdef CONFIG_BLK_CPQ_DA
cpqarray_init();
+#endif
+#ifdef CONFIG_BLK_CPQ_CISS_DA
+ cciss_init();
#endif
#ifdef CONFIG_NET
net_dev_init();
FUNET's LINUX-ADM group, linux-adm@nic.funet.fi
TCL-scripts by Sam Shen (who was at: slshen@lbl.gov)