[PATCH] switch scsi_cmd_ioctl() to passing fmode_t
authorAl Viro <viro@zeniv.linux.org.uk>
Mon, 27 Aug 2007 19:38:10 +0000 (15:38 -0400)
committerAl Viro <viro@zeniv.linux.org.uk>
Tue, 21 Oct 2008 11:47:14 +0000 (07:47 -0400)
Signed-off-by: Al Viro <viro@zeniv.linux.org.uk>
block/bsg.c
block/scsi_ioctl.c
drivers/block/cciss.c
drivers/block/ub.c
drivers/block/virtio_blk.c
drivers/cdrom/cdrom.c
drivers/ide/ide-floppy_ioctl.c
drivers/scsi/sd.c
drivers/scsi/st.c
include/linux/blkdev.h

index 2d36b127f384fe5cedbef6eefcf3cd26427a7934..e8bd2475682ab4c2d29f8f205e57b62427b7cfe2 100644 (file)
@@ -914,7 +914,7 @@ static long bsg_ioctl(struct file *file, unsigned int cmd, unsigned long arg)
        case SG_EMULATED_HOST:
        case SCSI_IOCTL_SEND_COMMAND: {
                void __user *uarg = (void __user *) arg;
-               return scsi_cmd_ioctl(file, bd->queue, NULL, cmd, uarg);
+               return scsi_cmd_ioctl(bd->queue, NULL, file->f_mode, cmd, uarg);
        }
        case SG_IO: {
                struct request *rq;
index 375e25df8adcf4f880315f397f74204c2fc4bc39..5963cf91a3a0c4f67dc709f9a6b98fdd87235f53 100644 (file)
@@ -517,8 +517,8 @@ static inline int blk_send_start_stop(struct request_queue *q,
        return __blk_send_generic(q, bd_disk, GPCMD_START_STOP_UNIT, data);
 }
 
-int scsi_cmd_ioctl(struct file *file, struct request_queue *q,
-                  struct gendisk *bd_disk, unsigned int cmd, void __user *arg)
+int scsi_cmd_ioctl(struct request_queue *q, struct gendisk *bd_disk, fmode_t mode,
+                  unsigned int cmd, void __user *arg)
 {
        int err;
 
@@ -559,7 +559,7 @@ int scsi_cmd_ioctl(struct file *file, struct request_queue *q,
                        err = -EFAULT;
                        if (copy_from_user(&hdr, arg, sizeof(hdr)))
                                break;
-                       err = sg_io(q, bd_disk, &hdr, file ? file->f_mode : 0);
+                       err = sg_io(q, bd_disk, &hdr, mode);
                        if (err == -EFAULT)
                                break;
 
@@ -607,7 +607,7 @@ int scsi_cmd_ioctl(struct file *file, struct request_queue *q,
                        hdr.cmdp = ((struct cdrom_generic_command __user*) arg)->cmd;
                        hdr.cmd_len = sizeof(cgc.cmd);
 
-                       err = sg_io(q, bd_disk, &hdr, file ? file->f_mode : 0);
+                       err = sg_io(q, bd_disk, &hdr, mode);
                        if (err == -EFAULT)
                                break;
 
@@ -631,7 +631,7 @@ int scsi_cmd_ioctl(struct file *file, struct request_queue *q,
                        if (!arg)
                                break;
 
-                       err = sg_scsi_ioctl(q, bd_disk, file ? file->f_mode : 0, arg);
+                       err = sg_scsi_ioctl(q, bd_disk, mode, arg);
                        break;
                case CDROMCLOSETRAY:
                        err = blk_send_start_stop(q, bd_disk, 0x03);
index 1e1f9153000c27638e854142017fc61f6b49a094..d9b1c15b81137c73ab787dcec67dca7de09a65ea 100644 (file)
@@ -1232,7 +1232,8 @@ static int cciss_ioctl(struct inode *inode, struct file *filep,
        case SG_EMULATED_HOST:
        case SG_IO:
        case SCSI_IOCTL_SEND_COMMAND:
-               return scsi_cmd_ioctl(filep, disk->queue, disk, cmd, argp);
+               return scsi_cmd_ioctl(disk->queue, disk,
+                                     filep ? filep->f_mode : 0, cmd, argp);
 
        /* scsi_cmd_ioctl would normally handle these, below, but */
        /* they aren't a good fit for cciss, as CD-ROMs are */
index 85d41eb67c0bd5918f4dc10968625b27036a99ea..bc04330f3683ebf4748abc7dd13c9651fc389473 100644 (file)
@@ -1729,7 +1729,7 @@ static int ub_bd_ioctl(struct inode *inode, struct file *filp,
        struct gendisk *disk = inode->i_bdev->bd_disk;
        void __user *usermem = (void __user *) arg;
 
-       return scsi_cmd_ioctl(filp, disk->queue, disk, cmd, usermem);
+       return scsi_cmd_ioctl(disk->queue, disk, filp ? filp->f_mode : 0, cmd, usermem);
 }
 
 /*
index 6ec5fc052786cae3c45cda835afe4ebbb9ca7b82..7643cd16fd67fb8495b08fc75aeccf1880ce0dd4 100644 (file)
@@ -149,8 +149,8 @@ static void do_virtblk_request(struct request_queue *q)
 static int virtblk_ioctl(struct inode *inode, struct file *filp,
                         unsigned cmd, unsigned long data)
 {
-       return scsi_cmd_ioctl(filp, inode->i_bdev->bd_disk->queue,
-                             inode->i_bdev->bd_disk, cmd,
+       return scsi_cmd_ioctl(inode->i_bdev->bd_disk->queue,
+                             inode->i_bdev->bd_disk, filp->f_mode, cmd,
                              (void __user *)data);
 }
 
index 4feefa622aed12b4532d34b40fd099cb20ef81af..e286eb5d1f6afcd82a21477508d9228594288301 100644 (file)
@@ -2672,7 +2672,7 @@ int cdrom_ioctl(struct file * file, struct cdrom_device_info *cdi,
        /*
         * Try the generic SCSI command ioctl's first.
         */
-       ret = scsi_cmd_ioctl(file, disk->queue, disk, cmd, argp);
+       ret = scsi_cmd_ioctl(disk->queue, disk, file ? file->f_mode : 0, cmd, argp);
        if (ret != -ENOTTY)
                return ret;
 
index 0d5f5054ab64720ba299b19eb540ebc6caa0e6de..3c9da4ac93410b3a1ac0ca709bc8170ce3bc7c83 100644 (file)
@@ -280,8 +280,8 @@ int ide_floppy_ioctl(ide_drive_t *drive, struct inode *inode,
         * 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);
+               err = scsi_cmd_ioctl(bdev->bd_disk->queue, bdev->bd_disk,
+                               file ? file->f_mode : 0, cmd, argp);
 
        if (err == -ENOTTY)
                err = generic_ide_ioctl(drive, file, bdev, cmd, arg);
index 202c1ed9abd7d90c1f2975ab82b9686159175f5c..5d74413f591a85b1025650983d5d7b437012a04e 100644 (file)
@@ -775,7 +775,8 @@ static int sd_ioctl(struct inode * inode, struct file * filp,
                case SCSI_IOCTL_GET_BUS_NUMBER:
                        return scsi_ioctl(sdp, cmd, p);
                default:
-                       error = scsi_cmd_ioctl(filp, disk->queue, disk, cmd, p);
+                       error = scsi_cmd_ioctl(disk->queue, disk,
+                                       filp ? filp->f_mode : 0, cmd, p);
                        if (error != -ENOTTY)
                                return error;
        }
index 5c28d08f18f46a1bc3f28c5451f84606af747f7c..8dffac9f3419bff0aaa0394e6a073b24152fb41b 100644 (file)
@@ -3567,8 +3567,8 @@ static long st_ioctl(struct file *file, unsigned int cmd_in, unsigned long arg)
                            !capable(CAP_SYS_RAWIO))
                                i = -EPERM;
                        else
-                               i = scsi_cmd_ioctl(file, STp->disk->queue,
-                                                  STp->disk, cmd_in, p);
+                               i = scsi_cmd_ioctl(STp->disk->queue, STp->disk,
+                                                  file->f_mode, cmd_in, p);
                        if (i != -ENOTTY)
                                return i;
                        break;
index 8945c30e99362ad5c137272bdd9f7a42d004a388..48f41b991adbdfdf81a9ec507098e015ca68e474 100644 (file)
@@ -717,8 +717,8 @@ extern void blk_plug_device(struct request_queue *);
 extern void blk_plug_device_unlocked(struct request_queue *);
 extern int blk_remove_plug(struct request_queue *);
 extern void blk_recount_segments(struct request_queue *, struct bio *);
-extern int scsi_cmd_ioctl(struct file *, struct request_queue *,
-                         struct gendisk *, unsigned int, void __user *);
+extern int scsi_cmd_ioctl(struct request_queue *, struct gendisk *, fmode_t,
+                         unsigned int, void __user *);
 extern int sg_scsi_ioctl(struct request_queue *, struct gendisk *, fmode_t,
                         struct scsi_ioctl_command __user *);