aboutsummaryrefslogtreecommitdiffstats
path: root/xenolinux-2.4.21-pre4-sparse/arch/xeno/drivers/block/xl_block.c
diff options
context:
space:
mode:
authorkaf24@scramble.cl.cam.ac.uk <kaf24@scramble.cl.cam.ac.uk>2003-03-20 14:50:05 +0000
committerkaf24@scramble.cl.cam.ac.uk <kaf24@scramble.cl.cam.ac.uk>2003-03-20 14:50:05 +0000
commitd5b8623c74fabe4fadd1401dc05d286de840a054 (patch)
treea22911a9fe5114bc4d457bece08ad560d209d291 /xenolinux-2.4.21-pre4-sparse/arch/xeno/drivers/block/xl_block.c
parent2687309e0987e504e4129251667eb3a67aad365b (diff)
downloadxen-d5b8623c74fabe4fadd1401dc05d286de840a054.tar.gz
xen-d5b8623c74fabe4fadd1401dc05d286de840a054.tar.bz2
xen-d5b8623c74fabe4fadd1401dc05d286de840a054.zip
bitkeeper revision 1.148.1.1 (3e79d51dkKmlnq2cVH-XRz9_lkZeXg)
Many files: Allow up to 31 partitions per XL IDE or SCSI device. But can now only have 8 of each type of device.
Diffstat (limited to 'xenolinux-2.4.21-pre4-sparse/arch/xeno/drivers/block/xl_block.c')
-rw-r--r--xenolinux-2.4.21-pre4-sparse/arch/xeno/drivers/block/xl_block.c21
1 files changed, 9 insertions, 12 deletions
diff --git a/xenolinux-2.4.21-pre4-sparse/arch/xeno/drivers/block/xl_block.c b/xenolinux-2.4.21-pre4-sparse/arch/xeno/drivers/block/xl_block.c
index 6fd44f1cc1..1c8022375a 100644
--- a/xenolinux-2.4.21-pre4-sparse/arch/xeno/drivers/block/xl_block.c
+++ b/xenolinux-2.4.21-pre4-sparse/arch/xeno/drivers/block/xl_block.c
@@ -15,8 +15,6 @@ typedef unsigned char byte; /* from linux/ide.h */
#define XLBLK_RESPONSE_IRQ _EVENT_BLK_RESP
#define DEBUG_IRQ _EVENT_DEBUG
-#define PARTN_SHIFT 4
-
static blk_ring_t *blk_ring;
static unsigned int resp_cons; /* Response consumer for comms ring. */
static unsigned int req_prod; /* Private request producer. */
@@ -54,22 +52,20 @@ static inline unsigned short xldev_to_physdev(kdev_t xldev)
switch ( MAJOR(xldev) )
{
case XLIDE_MAJOR:
- physdev = XENDEV_IDE;
+ physdev = XENDEV_IDE + (MINOR(xldev) >> XLIDE_PARTN_SHIFT);
break;
case XLSCSI_MAJOR:
- physdev = XENDEV_SCSI;
+ physdev = XENDEV_SCSI + (MINOR(xldev) >> XLSCSI_PARTN_SHIFT);
break;
case XLVIRT_MAJOR:
- physdev = XENDEV_VIRTUAL;
+ physdev = XENDEV_VIRTUAL + (MINOR(xldev) >> XLVIRT_PARTN_SHIFT);
break;
}
if ( physdev == 0 ) BUG();
- physdev += (MINOR(xldev) >> PARTN_SHIFT);
-
return physdev;
}
@@ -102,7 +98,8 @@ static inline struct gendisk *xldev_to_gendisk(kdev_t xldev)
static inline xl_disk_t *xldev_to_xldisk(kdev_t xldev)
{
struct gendisk *gd = xldev_to_gendisk(xldev);
- return (xl_disk_t *)gd->real_devices + (MINOR(xldev) >> PARTN_SHIFT);
+ return (xl_disk_t *)gd->real_devices +
+ (MINOR(xldev) >> PARTN_SHIFT(xldev));
}
@@ -233,7 +230,7 @@ int xenolinux_block_revalidate(kdev_t dev)
struct gendisk *gd = xldev_to_gendisk(dev);
xl_disk_t *disk = xldev_to_xldisk(dev);
unsigned long flags;
- int i;
+ int i, partn_shift = PARTN_SHIFT(dev);
spin_lock_irqsave(&io_request_lock, flags);
if ( disk->usage > 1 )
@@ -243,15 +240,15 @@ int xenolinux_block_revalidate(kdev_t dev)
}
spin_unlock_irqrestore(&io_request_lock, flags);
- for ( i = 0; i < (1 << PARTN_SHIFT); i++ )
+ for ( i = 0; i < (1 << partn_shift); i++ )
{
invalidate_device(dev + i, 1);
gd->part[dev + i].start_sect = 0;
gd->part[dev + i].nr_sects = 0;
}
- grok_partitions(gd, MINOR(dev) >> PARTN_SHIFT,
- 1 << PARTN_SHIFT, disk->capacity);
+ grok_partitions(gd, MINOR(dev) >> partn_shift,
+ 1 << partn_shift, disk->capacity);
return 0;
}