mirror of
https://github.com/adulau/aha.git
synced 2024-12-28 11:46:19 +00:00
[PATCH] kill the rest of struct file propagation in block ioctls
Now we can switch blkdev_ioctl() block_device/mode Signed-off-by: Al Viro <viro@zeniv.linux.org.uk>
This commit is contained in:
parent
6af3a56e1d
commit
56b26add02
5 changed files with 14 additions and 17 deletions
|
@ -177,7 +177,7 @@ struct compat_blkpg_ioctl_arg {
|
||||||
compat_caddr_t data;
|
compat_caddr_t data;
|
||||||
};
|
};
|
||||||
|
|
||||||
static int compat_blkpg_ioctl(struct inode *inode, struct file *file,
|
static int compat_blkpg_ioctl(struct block_device *bdev, fmode_t mode,
|
||||||
unsigned int cmd, struct compat_blkpg_ioctl_arg __user *ua32)
|
unsigned int cmd, struct compat_blkpg_ioctl_arg __user *ua32)
|
||||||
{
|
{
|
||||||
struct blkpg_ioctl_arg __user *a = compat_alloc_user_space(sizeof(*a));
|
struct blkpg_ioctl_arg __user *a = compat_alloc_user_space(sizeof(*a));
|
||||||
|
@ -196,7 +196,7 @@ static int compat_blkpg_ioctl(struct inode *inode, struct file *file,
|
||||||
if (err)
|
if (err)
|
||||||
return err;
|
return err;
|
||||||
|
|
||||||
return blkdev_ioctl(inode, file, cmd, (unsigned long)a);
|
return blkdev_ioctl(bdev, mode, cmd, (unsigned long)a);
|
||||||
}
|
}
|
||||||
|
|
||||||
#define BLKBSZGET_32 _IOR(0x12, 112, int)
|
#define BLKBSZGET_32 _IOR(0x12, 112, int)
|
||||||
|
@ -715,13 +715,13 @@ long compat_blkdev_ioctl(struct file *file, unsigned cmd, unsigned long arg)
|
||||||
* but we call blkdev_ioctl, which gets the lock for us
|
* but we call blkdev_ioctl, which gets the lock for us
|
||||||
*/
|
*/
|
||||||
case BLKRRPART:
|
case BLKRRPART:
|
||||||
return blkdev_ioctl(inode, file, cmd,
|
return blkdev_ioctl(bdev, mode, cmd,
|
||||||
(unsigned long)compat_ptr(arg));
|
(unsigned long)compat_ptr(arg));
|
||||||
case BLKBSZSET_32:
|
case BLKBSZSET_32:
|
||||||
return blkdev_ioctl(inode, file, BLKBSZSET,
|
return blkdev_ioctl(bdev, mode, BLKBSZSET,
|
||||||
(unsigned long)compat_ptr(arg));
|
(unsigned long)compat_ptr(arg));
|
||||||
case BLKPG:
|
case BLKPG:
|
||||||
return compat_blkpg_ioctl(inode, file, cmd, compat_ptr(arg));
|
return compat_blkpg_ioctl(bdev, mode, cmd, compat_ptr(arg));
|
||||||
case BLKRAGET:
|
case BLKRAGET:
|
||||||
case BLKFRAGET:
|
case BLKFRAGET:
|
||||||
if (!arg)
|
if (!arg)
|
||||||
|
|
|
@ -230,20 +230,13 @@ EXPORT_SYMBOL_GPL(__blkdev_driver_ioctl);
|
||||||
* always keep this in sync with compat_blkdev_ioctl() and
|
* always keep this in sync with compat_blkdev_ioctl() and
|
||||||
* compat_blkdev_locked_ioctl()
|
* compat_blkdev_locked_ioctl()
|
||||||
*/
|
*/
|
||||||
int blkdev_ioctl(struct inode *inode, struct file *file, unsigned cmd,
|
int blkdev_ioctl(struct block_device *bdev, fmode_t mode, unsigned cmd,
|
||||||
unsigned long arg)
|
unsigned long arg)
|
||||||
{
|
{
|
||||||
struct block_device *bdev = inode->i_bdev;
|
|
||||||
struct gendisk *disk = bdev->bd_disk;
|
struct gendisk *disk = bdev->bd_disk;
|
||||||
struct backing_dev_info *bdi;
|
struct backing_dev_info *bdi;
|
||||||
loff_t size;
|
loff_t size;
|
||||||
int ret, n;
|
int ret, n;
|
||||||
fmode_t mode = 0;
|
|
||||||
if (file) {
|
|
||||||
mode = file->f_mode;
|
|
||||||
if (file->f_flags & O_NDELAY)
|
|
||||||
mode |= FMODE_NDELAY_NOW;
|
|
||||||
}
|
|
||||||
|
|
||||||
switch(cmd) {
|
switch(cmd) {
|
||||||
case BLKFLSBUF:
|
case BLKFLSBUF:
|
||||||
|
|
|
@ -125,7 +125,7 @@ raw_ioctl(struct inode *inode, struct file *filp,
|
||||||
{
|
{
|
||||||
struct block_device *bdev = filp->private_data;
|
struct block_device *bdev = filp->private_data;
|
||||||
|
|
||||||
return blkdev_ioctl(bdev->bd_inode, NULL, command, arg);
|
return blkdev_ioctl(bdev, 0, command, arg);
|
||||||
}
|
}
|
||||||
|
|
||||||
static void bind_device(struct raw_config_request *rq)
|
static void bind_device(struct raw_config_request *rq)
|
||||||
|
|
|
@ -1202,7 +1202,11 @@ static int blkdev_close(struct inode * inode, struct file * filp)
|
||||||
|
|
||||||
static long block_ioctl(struct file *file, unsigned cmd, unsigned long arg)
|
static long block_ioctl(struct file *file, unsigned cmd, unsigned long arg)
|
||||||
{
|
{
|
||||||
return blkdev_ioctl(file->f_mapping->host, file, cmd, arg);
|
struct block_device *bdev = I_BDEV(file->f_mapping->host);
|
||||||
|
fmode_t mode = file->f_mode;
|
||||||
|
if (file->f_flags & O_NDELAY)
|
||||||
|
mode |= FMODE_NDELAY_NOW;
|
||||||
|
return blkdev_ioctl(bdev, mode, cmd, arg);
|
||||||
}
|
}
|
||||||
|
|
||||||
static const struct address_space_operations def_blk_aops = {
|
static const struct address_space_operations def_blk_aops = {
|
||||||
|
@ -1238,7 +1242,7 @@ int ioctl_by_bdev(struct block_device *bdev, unsigned cmd, unsigned long arg)
|
||||||
int res;
|
int res;
|
||||||
mm_segment_t old_fs = get_fs();
|
mm_segment_t old_fs = get_fs();
|
||||||
set_fs(KERNEL_DS);
|
set_fs(KERNEL_DS);
|
||||||
res = blkdev_ioctl(bdev->bd_inode, NULL, cmd, arg);
|
res = blkdev_ioctl(bdev, 0, cmd, arg);
|
||||||
set_fs(old_fs);
|
set_fs(old_fs);
|
||||||
return res;
|
return res;
|
||||||
}
|
}
|
||||||
|
|
|
@ -1717,7 +1717,7 @@ extern const struct file_operations bad_sock_fops;
|
||||||
extern const struct file_operations def_fifo_fops;
|
extern const struct file_operations def_fifo_fops;
|
||||||
#ifdef CONFIG_BLOCK
|
#ifdef CONFIG_BLOCK
|
||||||
extern int ioctl_by_bdev(struct block_device *, unsigned, unsigned long);
|
extern int ioctl_by_bdev(struct block_device *, unsigned, unsigned long);
|
||||||
extern int blkdev_ioctl(struct inode *, struct file *, unsigned, unsigned long);
|
extern int blkdev_ioctl(struct block_device *, fmode_t, unsigned, unsigned long);
|
||||||
extern long compat_blkdev_ioctl(struct file *, unsigned, unsigned long);
|
extern long compat_blkdev_ioctl(struct file *, unsigned, unsigned long);
|
||||||
extern int blkdev_get(struct block_device *, fmode_t);
|
extern int blkdev_get(struct block_device *, fmode_t);
|
||||||
extern int blkdev_put(struct block_device *, fmode_t);
|
extern int blkdev_put(struct block_device *, fmode_t);
|
||||||
|
|
Loading…
Reference in a new issue