mirror of
https://git.kernel.org/pub/scm/linux/kernel/git/herbert/cryptodev-2.6.git
synced 2026-05-02 18:17:50 -04:00
set_blocksize(): switch to passing struct file *
Signed-off-by: Al Viro <viro@zeniv.linux.org.uk>
This commit is contained in:
@@ -473,11 +473,14 @@ static int compat_hdio_getgeo(struct block_device *bdev,
|
||||
#endif
|
||||
|
||||
/* set the logical block size */
|
||||
static int blkdev_bszset(struct block_device *bdev, blk_mode_t mode,
|
||||
static int blkdev_bszset(struct file *file, blk_mode_t mode,
|
||||
int __user *argp)
|
||||
{
|
||||
// this one might be file_inode(file)->i_rdev - a rare valid
|
||||
// use of file_inode() for those.
|
||||
dev_t dev = I_BDEV(file->f_mapping->host)->bd_dev;
|
||||
struct file *excl_file;
|
||||
int ret, n;
|
||||
struct file *file;
|
||||
|
||||
if (!capable(CAP_SYS_ADMIN))
|
||||
return -EACCES;
|
||||
@@ -487,13 +490,13 @@ static int blkdev_bszset(struct block_device *bdev, blk_mode_t mode,
|
||||
return -EFAULT;
|
||||
|
||||
if (mode & BLK_OPEN_EXCL)
|
||||
return set_blocksize(bdev, n);
|
||||
return set_blocksize(file, n);
|
||||
|
||||
file = bdev_file_open_by_dev(bdev->bd_dev, mode, &bdev, NULL);
|
||||
if (IS_ERR(file))
|
||||
excl_file = bdev_file_open_by_dev(dev, mode, &dev, NULL);
|
||||
if (IS_ERR(excl_file))
|
||||
return -EBUSY;
|
||||
ret = set_blocksize(bdev, n);
|
||||
fput(file);
|
||||
ret = set_blocksize(excl_file, n);
|
||||
fput(excl_file);
|
||||
return ret;
|
||||
}
|
||||
|
||||
@@ -621,7 +624,7 @@ long blkdev_ioctl(struct file *file, unsigned cmd, unsigned long arg)
|
||||
case BLKBSZGET: /* get block device soft block size (cf. BLKSSZGET) */
|
||||
return put_int(argp, block_size(bdev));
|
||||
case BLKBSZSET:
|
||||
return blkdev_bszset(bdev, mode, argp);
|
||||
return blkdev_bszset(file, mode, argp);
|
||||
case BLKGETSIZE64:
|
||||
return put_u64(argp, bdev_nr_bytes(bdev));
|
||||
|
||||
@@ -681,7 +684,7 @@ long compat_blkdev_ioctl(struct file *file, unsigned cmd, unsigned long arg)
|
||||
case BLKBSZGET_32: /* get the logical block size (cf. BLKSSZGET) */
|
||||
return put_int(argp, bdev_logical_block_size(bdev));
|
||||
case BLKBSZSET_32:
|
||||
return blkdev_bszset(bdev, mode, argp);
|
||||
return blkdev_bszset(file, mode, argp);
|
||||
case BLKGETSIZE64_32:
|
||||
return put_u64(argp, bdev_nr_bytes(bdev));
|
||||
|
||||
|
||||
Reference in New Issue
Block a user