Unified · Split
| @@ -914,7 +914,7 @@ static long bsg_ioctl(struct file *file, unsigned int cmd, unsigned long arg) · 913 unmodified lines | ||
| 914 | 914 | case SG_EMULATED_HOST: |
| 915 | 915 | case SCSI_IOCTL_SEND_COMMAND: { |
| 916 | 916 | void __user *uarg = (void __user *) arg; |
| 917 | − return scsi_cmd_ioctl(file, bd->queue, NULL, cmd, uarg); | |
| 917 | + return scsi_cmd_ioctl(bd->queue, NULL, file->f_mode, cmd, uarg); | |
| 918 | 918 | } |
| 919 | 919 | case SG_IO: { |
| 920 | 920 | struct request *rq; |
| @@ -517,8 +517,8 @@ static inline int blk_send_start_stop(struct request_queue *q, · 516 unmodified lines | ||
| 517 | 517 | return __blk_send_generic(q, bd_disk, GPCMD_START_STOP_UNIT, data); |
| 518 | 518 | } |
| 519 | 519 | |
| 520 | −int scsi_cmd_ioctl(struct file *file, struct request_queue *q, | |
| 521 | − struct gendisk *bd_disk, unsigned int cmd, void __user *arg) | |
| 520 | +int scsi_cmd_ioctl(struct request_queue *q, struct gendisk *bd_disk, fmode_t mode, | |
| 521 | + unsigned int cmd, void __user *arg) | |
| 522 | 522 | { |
| 523 | 523 | int err; |
| 524 | 524 | |
| @@ -559,7 +559,7 @@ int scsi_cmd_ioctl(struct file *file, struct request_queue *q, · 34 unmodified lines | ||
| 559 | 559 | err = -EFAULT; |
| 560 | 560 | if (copy_from_user(&hdr, arg, sizeof(hdr))) |
| 561 | 561 | break; |
| 562 | − err = sg_io(q, bd_disk, &hdr, file ? file->f_mode : 0); | |
| 562 | + err = sg_io(q, bd_disk, &hdr, mode); | |
| 563 | 563 | if (err == -EFAULT) |
| 564 | 564 | break; |
| 565 | 565 | |
| @@ -607,7 +607,7 @@ int scsi_cmd_ioctl(struct file *file, struct request_queue *q, · 41 unmodified lines | ||
| 607 | 607 | hdr.cmdp = ((struct cdrom_generic_command __user*) arg)->cmd; |
| 608 | 608 | hdr.cmd_len = sizeof(cgc.cmd); |
| 609 | 609 | |
| 610 | − err = sg_io(q, bd_disk, &hdr, file ? file->f_mode : 0); | |
| 610 | + err = sg_io(q, bd_disk, &hdr, mode); | |
| 611 | 611 | if (err == -EFAULT) |
| 612 | 612 | break; |
| 613 | 613 | |
| @@ -631,7 +631,7 @@ int scsi_cmd_ioctl(struct file *file, struct request_queue *q, · 17 unmodified lines | ||
| 631 | 631 | if (!arg) |
| 632 | 632 | break; |
| 633 | 633 | |
| 634 | − err = sg_scsi_ioctl(q, bd_disk, file ? file->f_mode : 0, arg); | |
| 634 | + err = sg_scsi_ioctl(q, bd_disk, mode, arg); | |
| 635 | 635 | break; |
| 636 | 636 | case CDROMCLOSETRAY: |
| 637 | 637 | err = blk_send_start_stop(q, bd_disk, 0x03); |
| @@ -1232,7 +1232,8 @@ static int cciss_ioctl(struct inode *inode, struct file *filep, · 1231 unmodified lines | ||
| 1232 | 1232 | case SG_EMULATED_HOST: |
| 1233 | 1233 | case SG_IO: |
| 1234 | 1234 | case SCSI_IOCTL_SEND_COMMAND: |
| 1235 | − return scsi_cmd_ioctl(filep, disk->queue, disk, cmd, argp); | |
| 1235 | + return scsi_cmd_ioctl(disk->queue, disk, | |
| 1236 | + filep ? filep->f_mode : 0, cmd, argp); | |
| 1236 | 1237 | |
| 1237 | 1238 | /* scsi_cmd_ioctl would normally handle these, below, but */ |
| 1238 | 1239 | /* they aren't a good fit for cciss, as CD-ROMs are */ |
| @@ -1729,7 +1729,7 @@ static int ub_bd_ioctl(struct inode *inode, struct file *filp, · 1728 unmodified lines | ||
| 1729 | 1729 | struct gendisk *disk = inode->i_bdev->bd_disk; |
| 1730 | 1730 | void __user *usermem = (void __user *) arg; |
| 1731 | 1731 | |
| 1732 | − return scsi_cmd_ioctl(filp, disk->queue, disk, cmd, usermem); | |
| 1732 | + return scsi_cmd_ioctl(disk->queue, disk, filp ? filp->f_mode : 0, cmd, usermem); | |
| 1733 | 1733 | } |
| 1734 | 1734 | |
| 1735 | 1735 | /* |
| @@ -149,8 +149,8 @@ static void do_virtblk_request(struct request_queue *q) · 148 unmodified lines | ||
| 149 | 149 | static int virtblk_ioctl(struct inode *inode, struct file *filp, |
| 150 | 150 | unsigned cmd, unsigned long data) |
| 151 | 151 | { |
| 152 | − return scsi_cmd_ioctl(filp, inode->i_bdev->bd_disk->queue, | |
| 153 | − inode->i_bdev->bd_disk, cmd, | |
| 152 | + return scsi_cmd_ioctl(inode->i_bdev->bd_disk->queue, | |
| 153 | + inode->i_bdev->bd_disk, filp->f_mode, cmd, | |
| 154 | 154 | (void __user *)data); |
| 155 | 155 | } |
| 156 | 156 | |
| @@ -2672,7 +2672,7 @@ int cdrom_ioctl(struct file * file, struct cdrom_device_info *cdi, · 2671 unmodified lines | ||
| 2672 | 2672 | /* |
| 2673 | 2673 | * Try the generic SCSI command ioctl's first. |
| 2674 | 2674 | */ |
| 2675 | − ret = scsi_cmd_ioctl(file, disk->queue, disk, cmd, argp); | |
| 2675 | + ret = scsi_cmd_ioctl(disk->queue, disk, file ? file->f_mode : 0, cmd, argp); | |
| 2676 | 2676 | if (ret != -ENOTTY) |
| 2677 | 2677 | return ret; |
| 2678 | 2678 | |
| @@ -280,8 +280,8 @@ int ide_floppy_ioctl(ide_drive_t *drive, struct inode *inode, · 279 unmodified lines | ||
| 280 | 280 | * and CDROM_SEND_PACKET (legacy) ioctls |
| 281 | 281 | */ |
| 282 | 282 | if (cmd != CDROM_SEND_PACKET && cmd != SCSI_IOCTL_SEND_COMMAND) |
| 283 | − err = scsi_cmd_ioctl(file, bdev->bd_disk->queue, | |
| 284 | − bdev->bd_disk, cmd, argp); | |
| 283 | + err = scsi_cmd_ioctl(bdev->bd_disk->queue, bdev->bd_disk, | |
| 284 | + file ? file->f_mode : 0, cmd, argp); | |
| 285 | 285 | |
| 286 | 286 | if (err == -ENOTTY) |
| 287 | 287 | err = generic_ide_ioctl(drive, file, bdev, cmd, arg); |
| @@ -775,7 +775,8 @@ static int sd_ioctl(struct inode * inode, struct file * filp, · 774 unmodified lines | ||
| 775 | 775 | case SCSI_IOCTL_GET_BUS_NUMBER: |
| 776 | 776 | return scsi_ioctl(sdp, cmd, p); |
| 777 | 777 | default: |
| 778 | − error = scsi_cmd_ioctl(filp, disk->queue, disk, cmd, p); | |
| 778 | + error = scsi_cmd_ioctl(disk->queue, disk, | |
| 779 | + filp ? filp->f_mode : 0, cmd, p); | |
| 779 | 780 | if (error != -ENOTTY) |
| 780 | 781 | return error; |
| 781 | 782 | } |
| @@ -3567,8 +3567,8 @@ static long st_ioctl(struct file *file, unsigned int cmd_in, unsigned long arg) · 3566 unmodified lines | ||
| 3567 | 3567 | !capable(CAP_SYS_RAWIO)) |
| 3568 | 3568 | i = -EPERM; |
| 3569 | 3569 | else |
| 3570 | − i = scsi_cmd_ioctl(file, STp->disk->queue, | |
| 3571 | − STp->disk, cmd_in, p); | |
| 3570 | + i = scsi_cmd_ioctl(STp->disk->queue, STp->disk, | |
| 3571 | + file->f_mode, cmd_in, p); | |
| 3572 | 3572 | if (i != -ENOTTY) |
| 3573 | 3573 | return i; |
| 3574 | 3574 | break; |
| @@ -717,8 +717,8 @@ extern void blk_plug_device(struct request_queue *); · 716 unmodified lines | ||
| 717 | 717 | extern void blk_plug_device_unlocked(struct request_queue *); |
| 718 | 718 | extern int blk_remove_plug(struct request_queue *); |
| 719 | 719 | extern void blk_recount_segments(struct request_queue *, struct bio *); |
| 720 | −extern int scsi_cmd_ioctl(struct file *, struct request_queue *, | |
| 721 | − struct gendisk *, unsigned int, void __user *); | |
| 720 | +extern int scsi_cmd_ioctl(struct request_queue *, struct gendisk *, fmode_t, | |
| 721 | + unsigned int, void __user *); | |
| 722 | 722 | extern int sg_scsi_ioctl(struct request_queue *, struct gendisk *, fmode_t, |
| 723 | 723 | struct scsi_ioctl_command __user *); |
| 724 | 724 | |