summaryrefslogtreecommitdiffstats
path: root/block/scsi_ioctl.c
diff options
context:
space:
mode:
authorAl Viro <viro@zeniv.linux.org.uk>2008-09-02 16:35:55 -0400
committerAl Viro <viro@zeniv.linux.org.uk>2008-10-21 07:47:10 -0400
commit5842e51ff2e8d660756248db80ad24e4f41977d9 (patch)
tree245de9d6178271f9caa4f52f3abde6455ac4221f /block/scsi_ioctl.c
parent86d434dede14108dd917b25af0f29c0cb28b8d18 (diff)
downloadlinux-5842e51ff2e8d660756248db80ad24e4f41977d9.tar.bz2
[PATCH] pass mode instead of file to sg_io()
Signed-off-by: Al Viro <viro@zeniv.linux.org.uk>
Diffstat (limited to 'block/scsi_ioctl.c')
-rw-r--r--block/scsi_ioctl.c15
1 files changed, 7 insertions, 8 deletions
diff --git a/block/scsi_ioctl.c b/block/scsi_ioctl.c
index c525905f9d35..9a441559118d 100644
--- a/block/scsi_ioctl.c
+++ b/block/scsi_ioctl.c
@@ -190,12 +190,11 @@ void blk_set_cmd_filter_defaults(struct blk_cmd_filter *filter)
EXPORT_SYMBOL_GPL(blk_set_cmd_filter_defaults);
static int blk_fill_sghdr_rq(struct request_queue *q, struct request *rq,
- struct sg_io_hdr *hdr, struct file *file)
+ struct sg_io_hdr *hdr, fmode_t mode)
{
if (copy_from_user(rq->cmd, hdr->cmdp, hdr->cmd_len))
return -EFAULT;
- if (blk_verify_command(&q->cmd_filter, rq->cmd,
- file->f_mode & FMODE_WRITE))
+ if (blk_verify_command(&q->cmd_filter, rq->cmd, mode & FMODE_WRITE))
return -EPERM;
/*
@@ -260,8 +259,8 @@ static int blk_complete_sghdr_rq(struct request *rq, struct sg_io_hdr *hdr,
return r;
}
-static int sg_io(struct file *file, struct request_queue *q,
- struct gendisk *bd_disk, struct sg_io_hdr *hdr)
+static int sg_io(struct request_queue *q, struct gendisk *bd_disk,
+ struct sg_io_hdr *hdr, fmode_t mode)
{
unsigned long start_time;
int writing = 0, ret = 0;
@@ -293,7 +292,7 @@ static int sg_io(struct file *file, struct request_queue *q,
if (!rq)
return -ENOMEM;
- if (blk_fill_sghdr_rq(q, rq, hdr, file)) {
+ if (blk_fill_sghdr_rq(q, rq, hdr, mode)) {
blk_put_request(rq);
return -EFAULT;
}
@@ -565,7 +564,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(file, q, bd_disk, &hdr);
+ err = sg_io(q, bd_disk, &hdr, file ? file->f_mode : 0);
if (err == -EFAULT)
break;
@@ -613,7 +612,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(file, q, bd_disk, &hdr);
+ err = sg_io(q, bd_disk, &hdr, file ? file->f_mode : 0);
if (err == -EFAULT)
break;