patch-2.1.126 linux/drivers/scsi/sd_ioctl.c

Next file: linux/drivers/scsi/u14-34f.c
Previous file: linux/drivers/scsi/sd.h
Back to the patch index
Back to the overall index

diff -u --recursive --new-file v2.1.125/linux/drivers/scsi/sd_ioctl.c linux/drivers/scsi/sd_ioctl.c
@@ -13,6 +13,7 @@
 
 #include <asm/uaccess.h>
 
+#define MAJOR_NR	SCSI_DISK0_MAJOR
 #include <linux/blk.h>
 #include "scsi.h"
 #include <scsi/scsi_ioctl.h>
@@ -29,7 +30,7 @@
     int diskinfo[4];
     struct hd_geometry *loc = (struct hd_geometry *) arg;
     
-    SDev = rscsi_disks[MINOR(dev) >> 4].device;
+    SDev = rscsi_disks[DEVICE_NR(dev)].device;
     /*
      * If we are in the middle of error recovery, don't let anyone
      * else try and use this device.  Also, if error recovery fails, it
@@ -47,34 +48,34 @@
 	error = verify_area(VERIFY_WRITE, loc, sizeof(*loc));
 	if (error)
 	    return error;
-	host = rscsi_disks[MINOR(dev) >> 4].device->host;
+	host = rscsi_disks[DEVICE_NR(dev)].device->host;
 
 /* default to most commonly used values */
 
         diskinfo[0] = 0x40;
         diskinfo[1] = 0x20;
-        diskinfo[2] = rscsi_disks[MINOR(dev) >> 4].capacity >> 11;
+        diskinfo[2] = rscsi_disks[DEVICE_NR(dev)].capacity >> 11;
 
 /* override with calculated, extended default, or driver values */
 
 	if(host->hostt->bios_param != NULL)
-	    host->hostt->bios_param(&rscsi_disks[MINOR(dev) >> 4],
+	    host->hostt->bios_param(&rscsi_disks[DEVICE_NR(dev)],
 				    dev,
 				    &diskinfo[0]);
-        else scsicam_bios_param(&rscsi_disks[MINOR(dev) >> 4],
+        else scsicam_bios_param(&rscsi_disks[DEVICE_NR(dev)],
 				dev, &diskinfo[0]);
 
 	put_user(diskinfo[0], &loc->heads);
 	put_user(diskinfo[1], &loc->sectors);
 	put_user(diskinfo[2], &loc->cylinders);
-	put_user(sd[MINOR(inode->i_rdev)].start_sect, &loc->start);
+	put_user(sd[SD_PARTITION(inode->i_rdev)].start_sect, &loc->start);
 	return 0;
     case BLKGETSIZE:   /* Return device size */
 	if (!arg)  return -EINVAL;
 	error = verify_area(VERIFY_WRITE, (long *) arg, sizeof(long));
 	if (error)
 	    return error;
-	put_user(sd[MINOR(inode->i_rdev)].nr_sects,
+	put_user(sd[SD_PARTITION(inode->i_rdev)].nr_sects,
 		 (long *) arg);
 	return 0;
 
@@ -110,7 +111,7 @@
     RO_IOCTLS(dev, arg);
 
     default:
-	return scsi_ioctl(rscsi_disks[MINOR(dev) >> 4].device , cmd, (void *) arg);
+	return scsi_ioctl(rscsi_disks[DEVICE_NR(dev)].device , cmd, (void *) arg);
     }
 }
 

FUNET's LINUX-ADM group, linux-adm@nic.funet.fi
TCL-scripts by Sam Shen, slshen@lbl.gov