]> xenbits.xensource.com Git - people/royger/linux-2.6.18-xen.git/commitdiff
xen/blkfront: forward unknown IOCTLs to scsi_cmd_ioctl() for /dev/sdX
authorKeir Fraser <keir.fraser@citrix.com>
Wed, 22 Sep 2010 07:56:26 +0000 (08:56 +0100)
committerKeir Fraser <keir.fraser@citrix.com>
Wed, 22 Sep 2010 07:56:26 +0000 (08:56 +0100)
Certain utilities (here: parted) expect certain SCSI IOCTLs (here:
SCSI_IOCTL_GET_IDLUN) to not fail on /dev/sdX devices. Rather than
handling them one-by-one, just forward control to scsi_cmd_ioctl().

Signed-off-by: Jan Beulich <jbeulich@novell.com>
drivers/xen/blkfront/blkfront.c

index d36f11876085440b91e344093f6889ca8f9c87ac..fdf43b7534c93f9c35201ef2f3f6ef8b544fb94c 100644 (file)
@@ -532,6 +532,7 @@ int blkif_release(struct inode *inode, struct file *filep)
 int blkif_ioctl(struct inode *inode, struct file *filep,
                unsigned command, unsigned long argument)
 {
+       struct blkfront_info *info = inode->i_bdev->bd_disk->private_data;
        int i;
 
        DPRINTK_IOCTL("command: 0x%x, argument: 0x%lx, dev: 0x%04x\n",
@@ -567,14 +568,23 @@ int blkif_ioctl(struct inode *inode, struct file *filep,
                return 0;
 
        case CDROM_GET_CAPABILITY: {
-               struct blkfront_info *info =
-                       inode->i_bdev->bd_disk->private_data;
                struct gendisk *gd = info->gd;
                if (gd->flags & GENHD_FL_CD)
                        return 0;
                return -EINVAL;
        }
        default:
+               if (info->mi && info->gd) {
+                       switch (info->mi->major) {
+                       case SCSI_DISK0_MAJOR:
+                       case SCSI_DISK1_MAJOR ... SCSI_DISK7_MAJOR:
+                       case SCSI_DISK8_MAJOR ... SCSI_DISK15_MAJOR:
+                       case SCSI_CDROM_MAJOR:
+                               return scsi_cmd_ioctl(filep, info->gd, command,
+                                                     (void __user *)argument);
+                       }
+               }
+
                /*printk(KERN_ALERT "ioctl %08x not supported by Xen blkdev\n",
                  command);*/
                return -EINVAL; /* same return as native Linux */