Commit a74ee53e authored by Linus Torvalds's avatar Linus Torvalds

Pass done file pointer to block device ioctl's

They'll need it for permission checking.
parent 1dde9f57
......@@ -259,7 +259,7 @@ static int pcd_block_ioctl(struct inode *inode, struct file *file,
unsigned cmd, unsigned long arg)
{
struct pcd_unit *cd = inode->i_bdev->bd_disk->private_data;
return cdrom_ioctl(&cd->info, inode, cmd, arg);
return cdrom_ioctl(file, &cd->info, inode, cmd, arg);
}
static int pcd_block_media_changed(struct gendisk *disk)
......
......@@ -323,7 +323,7 @@ static int sg_scsi_ioctl(request_queue_t *q, struct gendisk *bd_disk,
return err;
}
int scsi_cmd_ioctl(struct gendisk *bd_disk, unsigned int cmd, void __user *arg)
int scsi_cmd_ioctl(struct file *file, struct gendisk *bd_disk, unsigned int cmd, void __user *arg)
{
request_queue_t *q;
struct request *rq;
......
......@@ -2072,14 +2072,14 @@ static int cdrom_read_cdda(struct cdrom_device_info *cdi, __u8 __user *ubuf,
* these days. ATAPI / SCSI specific code now mainly resides in
* mmc_ioct().
*/
int cdrom_ioctl(struct cdrom_device_info *cdi, struct inode *ip,
unsigned int cmd, unsigned long arg)
int cdrom_ioctl(struct file * file, struct cdrom_device_info *cdi,
struct inode *ip, unsigned int cmd, unsigned long arg)
{
struct cdrom_device_ops *cdo = cdi->ops;
int ret;
/* Try the generic SCSI command ioctl's first.. */
ret = scsi_cmd_ioctl(ip->i_bdev->bd_disk, cmd, (void __user *)arg);
ret = scsi_cmd_ioctl(file, ip->i_bdev->bd_disk, cmd, (void __user *)arg);
if (ret != -ENOTTY)
return ret;
......
......@@ -3179,7 +3179,7 @@ static int scd_block_release(struct inode *inode, struct file *file)
static int scd_block_ioctl(struct inode *inode, struct file *file,
unsigned cmd, unsigned long arg)
{
return cdrom_ioctl(&scd_info, inode, cmd, arg);
return cdrom_ioctl(file, &scd_info, inode, cmd, arg);
}
static int scd_block_media_changed(struct gendisk *disk)
......
......@@ -1363,7 +1363,7 @@ static int cm206_block_release(struct inode *inode, struct file *file)
static int cm206_block_ioctl(struct inode *inode, struct file *file,
unsigned cmd, unsigned long arg)
{
return cdrom_ioctl(&cm206_info, inode, cmd, arg);
return cdrom_ioctl(file, &cm206_info, inode, cmd, arg);
}
static int cm206_block_media_changed(struct gendisk *disk)
......
......@@ -227,7 +227,7 @@ static int mcd_block_release(struct inode *inode, struct file *file)
static int mcd_block_ioctl(struct inode *inode, struct file *file,
unsigned cmd, unsigned long arg)
{
return cdrom_ioctl(&mcd_info, inode, cmd, arg);
return cdrom_ioctl(file, &mcd_info, inode, cmd, arg);
}
static int mcd_block_media_changed(struct gendisk *disk)
......
......@@ -233,7 +233,7 @@ static int mcdx_block_ioctl(struct inode *inode, struct file *file,
unsigned cmd, unsigned long arg)
{
struct s_drive_stuff *p = inode->i_bdev->bd_disk->private_data;
return cdrom_ioctl(&p->info, inode, cmd, arg);
return cdrom_ioctl(file, &p->info, inode, cmd, arg);
}
static int mcdx_block_media_changed(struct gendisk *disk)
......
......@@ -5372,7 +5372,7 @@ static int sbpcd_block_ioctl(struct inode *inode, struct file *file,
unsigned cmd, unsigned long arg)
{
struct sbpcd_drive *p = inode->i_bdev->bd_disk->private_data;
return cdrom_ioctl(p->sbpcd_infop, inode, cmd, arg);
return cdrom_ioctl(file, p->sbpcd_infop, inode, cmd, arg);
}
static int sbpcd_block_media_changed(struct gendisk *disk)
......
......@@ -199,7 +199,7 @@ static int viocd_blk_ioctl(struct inode *inode, struct file *file,
unsigned cmd, unsigned long arg)
{
struct disk_info *di = inode->i_bdev->bd_disk->private_data;
return cdrom_ioctl(&di->viocd_info, inode, cmd, arg);
return cdrom_ioctl(file, &di->viocd_info, inode, cmd, arg);
}
static int viocd_blk_media_changed(struct gendisk *disk)
......
......@@ -3395,10 +3395,10 @@ static int idecd_ioctl (struct inode *inode, struct file *file,
{
struct block_device *bdev = inode->i_bdev;
ide_drive_t *drive = bdev->bd_disk->private_data;
int err = generic_ide_ioctl(bdev, cmd, arg);
int err = generic_ide_ioctl(file, bdev, cmd, arg);
if (err == -EINVAL) {
struct cdrom_info *info = drive->driver_data;
err = cdrom_ioctl(&info->devinfo, inode, cmd, arg);
err = cdrom_ioctl(file, &info->devinfo, inode, cmd, arg);
}
return err;
}
......
......@@ -1668,7 +1668,7 @@ static int idedisk_ioctl(struct inode *inode, struct file *file,
unsigned int cmd, unsigned long arg)
{
struct block_device *bdev = inode->i_bdev;
return generic_ide_ioctl(bdev, cmd, arg);
return generic_ide_ioctl(file, bdev, cmd, arg);
}
static int idedisk_media_changed(struct gendisk *disk)
......
......@@ -1946,7 +1946,7 @@ static int idefloppy_ioctl(struct inode *inode, struct file *file,
ide_drive_t *drive = bdev->bd_disk->private_data;
idefloppy_floppy_t *floppy = drive->driver_data;
void __user *argp = (void __user *)arg;
int err = generic_ide_ioctl(bdev, cmd, arg);
int err = generic_ide_ioctl(file, bdev, cmd, arg);
int prevent = (arg) ? 1 : 0;
idefloppy_pc_t pc;
if (err != -EINVAL)
......
......@@ -4807,7 +4807,7 @@ static int idetape_ioctl(struct inode *inode, struct file *file,
{
struct block_device *bdev = inode->i_bdev;
ide_drive_t *drive = bdev->bd_disk->private_data;
int err = generic_ide_ioctl(bdev, cmd, arg);
int err = generic_ide_ioctl(file, bdev, cmd, arg);
if (err == -EINVAL)
err = idetape_blkdev_ioctl(drive, cmd, arg);
return err;
......
......@@ -1453,8 +1453,8 @@ static int generic_ide_resume(struct device *dev)
return ide_do_drive_cmd(drive, &rq, ide_head_wait);
}
int generic_ide_ioctl(struct block_device *bdev, unsigned int cmd,
unsigned long arg)
int generic_ide_ioctl(struct file *file, struct block_device *bdev,
unsigned int cmd, unsigned long arg)
{
ide_drive_t *drive = bdev->bd_disk->private_data;
ide_settings_t *setting;
......@@ -1605,7 +1605,7 @@ int generic_ide_ioctl(struct block_device *bdev, unsigned int cmd,
case CDROMEJECT:
case CDROMCLOSETRAY:
return scsi_cmd_ioctl(bdev->bd_disk, cmd, p);
return scsi_cmd_ioctl(file, bdev->bd_disk, cmd, p);
case HDIO_GET_BUSSTATE:
if (!capable(CAP_SYS_ADMIN))
......
......@@ -735,7 +735,7 @@ static int idescsi_ide_ioctl(struct inode *inode, struct file *file,
unsigned int cmd, unsigned long arg)
{
struct block_device *bdev = inode->i_bdev;
return generic_ide_ioctl(bdev, cmd, arg);
return generic_ide_ioctl(file, bdev, cmd, arg);
}
static struct block_device_operations idescsi_ops = {
......
......@@ -594,7 +594,7 @@ 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(disk, cmd, p);
error = scsi_cmd_ioctl(filp, disk, cmd, p);
if (error != -ENOTTY)
return error;
}
......
......@@ -504,7 +504,7 @@ static int sr_block_ioctl(struct inode *inode, struct file *file, unsigned cmd,
case SCSI_IOCTL_GET_BUS_NUMBER:
return scsi_ioctl(sdev, cmd, (void __user *)arg);
}
return cdrom_ioctl(&cd->cdi, inode, cmd, arg);
return cdrom_ioctl(file, &cd->cdi, inode, cmd, arg);
}
static int sr_block_media_changed(struct gendisk *disk)
......
......@@ -3408,7 +3408,7 @@ static int st_ioctl(struct inode *inode, struct file *file,
case SCSI_IOCTL_GET_BUS_NUMBER:
break;
default:
i = scsi_cmd_ioctl(STp->disk, cmd_in, p);
i = scsi_cmd_ioctl(file, STp->disk, cmd_in, p);
if (i != -ENOTTY)
return i;
break;
......
......@@ -517,7 +517,7 @@ extern int blk_remove_plug(request_queue_t *);
extern void blk_recount_segments(request_queue_t *, struct bio *);
extern int blk_phys_contig_segment(request_queue_t *q, struct bio *, struct bio *);
extern int blk_hw_contig_segment(request_queue_t *q, struct bio *, struct bio *);
extern int scsi_cmd_ioctl(struct gendisk *, unsigned int, void __user *);
extern int scsi_cmd_ioctl(struct file *, struct gendisk *, unsigned int, void __user *);
extern void blk_start_queue(request_queue_t *q);
extern void blk_stop_queue(request_queue_t *q);
extern void __blk_stop_queue(request_queue_t *q);
......
......@@ -984,8 +984,8 @@ struct cdrom_device_ops {
extern int cdrom_open(struct cdrom_device_info *cdi, struct inode *ip,
struct file *fp);
extern int cdrom_release(struct cdrom_device_info *cdi, struct file *fp);
extern int cdrom_ioctl(struct cdrom_device_info *cdi, struct inode *ip,
unsigned int cmd, unsigned long arg);
extern int cdrom_ioctl(struct file *file, struct cdrom_device_info *cdi,
struct inode *ip, unsigned int cmd, unsigned long arg);
extern int cdrom_media_changed(struct cdrom_device_info *);
extern int register_cdrom(struct cdrom_device_info *cdi);
......
......@@ -1194,7 +1194,7 @@ typedef struct ide_driver_s {
#define DRIVER(drive) ((drive)->driver)
extern int generic_ide_ioctl(struct block_device *, unsigned, unsigned long);
extern int generic_ide_ioctl(struct file *, struct block_device *, unsigned, unsigned long);
/*
* ide_hwifs[] is the master data structure used to keep track
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment