From 45e79a3acdcf54113b3d7b23e9e64e6541dbfeb5 Mon Sep 17 00:00:00 2001 From: FUJITA Tomonori Date: Mon, 9 Jul 2007 12:39:20 +0200 Subject: bsg: add a request_queue argument to scsi_cmd_ioctl() bsg uses scsi_cmd_ioctl() for some SCSI/sg ioctl commands. scsi_cmd_ioctl() gets a request queue from a gendisk arguement. This prevents bsg being bound to SCSI devices that don't have a gendisk (like OSD). This adds a request_queue argument to scsi_cmd_ioctl(). The SCSI/sg ioctl commands doesn't use a gendisk so it's safe for any SCSI devices to use scsi_cmd_ioctl(). Signed-off-by: FUJITA Tomonori Signed-off-by: Jens Axboe --- block/bsg.c | 2 +- block/scsi_ioctl.c | 10 +++------- 2 files changed, 4 insertions(+), 8 deletions(-) (limited to 'block') diff --git a/block/bsg.c b/block/bsg.c index c85d961ee41e..0427ece9b6d8 100644 --- a/block/bsg.c +++ b/block/bsg.c @@ -900,7 +900,7 @@ bsg_ioctl(struct inode *inode, struct file *file, unsigned int cmd, case SG_EMULATED_HOST: case SCSI_IOCTL_SEND_COMMAND: { void __user *uarg = (void __user *) arg; - return scsi_cmd_ioctl(file, bd->disk, cmd, uarg); + return scsi_cmd_ioctl(file, bd->queue, bd->disk, cmd, uarg); } case SG_IO: { struct request *rq; diff --git a/block/scsi_ioctl.c b/block/scsi_ioctl.c index db53b2c268d3..a26ba07955fe 100644 --- a/block/scsi_ioctl.c +++ b/block/scsi_ioctl.c @@ -548,16 +548,12 @@ static inline int blk_send_start_stop(request_queue_t *q, struct gendisk *bd_dis return __blk_send_generic(q, bd_disk, GPCMD_START_STOP_UNIT, data); } -int scsi_cmd_ioctl(struct file *file, struct gendisk *bd_disk, unsigned int cmd, void __user *arg) +int scsi_cmd_ioctl(struct file *file, struct request_queue *q, + struct gendisk *bd_disk, unsigned int cmd, void __user *arg) { - request_queue_t *q; int err; - q = bd_disk->queue; - if (!q) - return -ENXIO; - - if (blk_get_queue(q)) + if (!q || blk_get_queue(q)) return -ENXIO; switch (cmd) { -- cgit v1.2.3-70-g09d2