ia64/xen-unstable

changeset 3124:0ba2b3a250fe

bitkeeper revision 1.1159.194.3 (41a5e729R9jXVAOcrKU-Xq81RscJQQ)

vbd.c, block.h:
Fix mapping from Xen device numbers to Linux device names.
author cl349@arcadians.cl.cam.ac.uk
date Thu Nov 25 14:07:37 2004 +0000 (2004-11-25)
parents 9aca3607909f
children 7827d8db3729
files linux-2.6.9-xen-sparse/drivers/xen/blkfront/block.h linux-2.6.9-xen-sparse/drivers/xen/blkfront/vbd.c
line diff
     1.1 --- a/linux-2.6.9-xen-sparse/drivers/xen/blkfront/block.h	Thu Nov 25 14:05:15 2004 +0000
     1.2 +++ b/linux-2.6.9-xen-sparse/drivers/xen/blkfront/block.h	Thu Nov 25 14:07:37 2004 +0000
     1.3 @@ -64,6 +64,7 @@
     1.4  
     1.5  struct xlbd_type_info {
     1.6  	int partn_shift;
     1.7 +	int partn_per_major;
     1.8  	int devs_per_major;
     1.9  	int hardsect_size;
    1.10  	int max_sectors;
    1.11 @@ -77,8 +78,8 @@ struct xlbd_type_info {
    1.12   */
    1.13  struct xlbd_major_info {
    1.14  	int major;
    1.15 +	int index;
    1.16  	int usage;
    1.17 -	int xd_device;
    1.18  	struct xlbd_type_info *type;
    1.19  };
    1.20  
     2.1 --- a/linux-2.6.9-xen-sparse/drivers/xen/blkfront/vbd.c	Thu Nov 25 14:05:15 2004 +0000
     2.2 +++ b/linux-2.6.9-xen-sparse/drivers/xen/blkfront/vbd.c	Thu Nov 25 14:07:37 2004 +0000
     2.3 @@ -44,6 +44,7 @@
     2.4  
     2.5  static struct xlbd_type_info xlbd_ide_type = {
     2.6  	.partn_shift = 6,
     2.7 +	.partn_per_major = 2,
     2.8  	// XXXcl todo blksize_size[major]  = 1024;
     2.9  	.hardsect_size = 512,
    2.10  	.max_sectors = 128,  /* 'hwif->rqsize' if we knew it */
    2.11 @@ -53,6 +54,7 @@ static struct xlbd_type_info xlbd_ide_ty
    2.12  
    2.13  static struct xlbd_type_info xlbd_scsi_type = {
    2.14  	.partn_shift = 4,
    2.15 +	.partn_per_major = 16,
    2.16  	// XXXcl todo blksize_size[major]  = 1024; /* XXX 512; */
    2.17  	.hardsect_size = 512,
    2.18  	.max_sectors = 128*8, /* XXX 128; */
    2.19 @@ -62,6 +64,7 @@ static struct xlbd_type_info xlbd_scsi_t
    2.20  
    2.21  static struct xlbd_type_info xlbd_vbd_type = {
    2.22  	.partn_shift = 4,
    2.23 +	.partn_per_major = 16,
    2.24  	// XXXcl todo blksize_size[major]  = 512;
    2.25  	.hardsect_size = 512,
    2.26  	.max_sectors = 128,
    2.27 @@ -167,13 +170,17 @@ static struct xlbd_major_info *xlbd_get_
    2.28  	switch (mi_idx) {
    2.29  	case 0 ... (NUM_IDE_MAJORS - 1):
    2.30  		major_info[mi_idx]->type = &xlbd_ide_type;
    2.31 +		major_info[mi_idx]->index = mi_idx;
    2.32  		break;
    2.33  	case NUM_IDE_MAJORS ... (NUM_IDE_MAJORS + NUM_SCSI_MAJORS - 1):
    2.34  		major_info[mi_idx]->type = &xlbd_scsi_type;
    2.35 +		major_info[mi_idx]->index = mi_idx - NUM_IDE_MAJORS;
    2.36  		break;
    2.37  	case (NUM_IDE_MAJORS + NUM_SCSI_MAJORS) ...
    2.38  		(NUM_IDE_MAJORS + NUM_SCSI_MAJORS + NUM_VBD_MAJORS - 1):
    2.39  		major_info[mi_idx]->type = &xlbd_vbd_type;
    2.40 +		major_info[mi_idx]->index = mi_idx -
    2.41 +			(NUM_IDE_MAJORS + NUM_SCSI_MAJORS);
    2.42  		break;
    2.43  	}
    2.44  	major_info[mi_idx]->major = new_major;
    2.45 @@ -222,7 +229,8 @@ static struct gendisk *xlvbd_get_gendisk
    2.46  	gd->fops = &xlvbd_block_fops;
    2.47  	gd->private_data = di;
    2.48  	sprintf(gd->disk_name, "%s%c%d", mi->type->name,
    2.49 -	    'a' + (xd_minor >> mi->type->partn_shift),
    2.50 +	    'a' + mi->index * mi->type->partn_per_major +
    2.51 +		(xd_minor >> mi->type->partn_shift),
    2.52  	    xd_minor & ((1 << mi->type->partn_shift) - 1));
    2.53  	/*  sprintf(gd->devfs_name, "%s%s/disc%d", mi->type->name, , ); XXXdevfs */
    2.54