Gitweb:     
http://git.kernel.org/git/?p=linux/kernel/git/torvalds/linux-2.6.git;a=commit;h=89636af25d75d8672aea05d258be357d0dc4bd70
Commit:     89636af25d75d8672aea05d258be357d0dc4bd70
Parent:     4bf9fdf7f21f118e2c5052ec8e46faf00eb5a4ea
Author:     Bartlomiej Zolnierkiewicz <[EMAIL PROTECTED]>
AuthorDate: Fri Jul 20 01:11:59 2007 +0200
Committer:  Bartlomiej Zolnierkiewicz <[EMAIL PROTECTED]>
CommitDate: Fri Jul 20 01:11:59 2007 +0200

    ide: add support for SCSI ioctls to ide-floppy
    
    Now that ide-floppy supports SG_IO we can add support for SCSI ioctls
    (except deprecated SCSI_IOCTL_SEND_COMMAND and legacy CDROM_SEND_PACKET
    ones - we can add them later iff really needed).
    
    While at it remove handling of CDROMEJECT and CDROMCLOSETRAY ioctls from
    generic_ide_ioctl():
    
    - This prevents ide-{disk,tape,scsi} device drivers from obtaining
      REQ_TYPE_BLOCK_PC type requests which are currently unsupported by
      these drivers and which are potentially harmful (as reported by Andrew).
    
    - There is no functionality loss since aforementioned ioctls will now be
      handled by idefloppy_ioctl()->scsi_cmd_ioctl() (for devices using
      ide-floppy driver) and by idecd_ioctl->cdrom_ioctl()->scsi_cmd_ioctl()
      (for devices using ide-cd driver).
    
    Cc: Jens Axboe <[EMAIL PROTECTED]>
    Cc: FUJITA Tomonori <[EMAIL PROTECTED]>
    Cc: James Bottomley <[EMAIL PROTECTED]>
    Cc: Jeff Garzik <[EMAIL PROTECTED]>
    Cc: Andrew Morton <[EMAIL PROTECTED]>
    Signed-off-by: Bartlomiej Zolnierkiewicz <[EMAIL PROTECTED]>
---
 drivers/ide/ide-floppy.c |   18 +++++++++++++++++-
 drivers/ide/ide.c        |    4 ----
 2 files changed, 17 insertions(+), 5 deletions(-)

diff --git a/drivers/ide/ide-floppy.c b/drivers/ide/ide-floppy.c
index a21f585..ae8e1a6 100644
--- a/drivers/ide/ide-floppy.c
+++ b/drivers/ide/ide-floppy.c
@@ -99,6 +99,8 @@
 #include <linux/bitops.h>
 #include <linux/mutex.h>
 
+#include <scsi/scsi_ioctl.h>
+
 #include <asm/byteorder.h>
 #include <asm/irq.h>
 #include <asm/uaccess.h>
@@ -2099,7 +2101,21 @@ static int idefloppy_ioctl(struct inode *inode, struct 
file *file,
        case IDEFLOPPY_IOCTL_FORMAT_GET_PROGRESS:
                return idefloppy_get_format_progress(drive, argp);
        }
-       return generic_ide_ioctl(drive, file, bdev, cmd, arg);
+
+       /*
+        * skip SCSI_IOCTL_SEND_COMMAND (deprecated)
+        * and CDROM_SEND_PACKET (legacy) ioctls
+        */
+       if (cmd != CDROM_SEND_PACKET && cmd != SCSI_IOCTL_SEND_COMMAND)
+               err = scsi_cmd_ioctl(file, bdev->bd_disk->queue,
+                                       bdev->bd_disk, cmd, argp);
+       else
+               err = -ENOTTY;
+
+       if (err == -ENOTTY)
+               err = generic_ide_ioctl(drive, file, bdev, cmd, arg);
+
+       return err;
 }
 
 static int idefloppy_media_changed(struct gendisk *disk)
diff --git a/drivers/ide/ide.c b/drivers/ide/ide.c
index c438cc3..5e88a06 100644
--- a/drivers/ide/ide.c
+++ b/drivers/ide/ide.c
@@ -1097,10 +1097,6 @@ int generic_ide_ioctl(ide_drive_t *drive, struct file 
*file, struct block_device
                        return 0;
                }
 
-               case CDROMEJECT:
-               case CDROMCLOSETRAY:
-                       return scsi_cmd_ioctl(file, bdev->bd_disk->queue, 
bdev->bd_disk, cmd, p);
-
                case HDIO_GET_BUSSTATE:
                        if (!capable(CAP_SYS_ADMIN))
                                return -EACCES;
-
To unsubscribe from this list: send the line "unsubscribe git-commits-head" in
the body of a message to [EMAIL PROTECTED]
More majordomo info at  http://vger.kernel.org/majordomo-info.html

Reply via email to