diff options
author | Al Viro <al@aretha.pdmi.ras.ru> | 2008-09-19 03:17:36 -0400 |
---|---|---|
committer | Al Viro <viro@zeniv.linux.org.uk> | 2008-10-21 07:49:14 -0400 |
commit | 56b26add02b4bdea81d5e0ebda60db1fe3311ad4 (patch) | |
tree | 3e9b5877f77ce24a6d17574ff3d32ae8351fa0ef | |
parent | 6af3a56e1dd4d95836a47214e5c60d5b749a5501 (diff) |
[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>
-rw-r--r-- | block/compat_ioctl.c | 10 | ||||
-rw-r--r-- | block/ioctl.c | 9 | ||||
-rw-r--r-- | drivers/char/raw.c | 2 | ||||
-rw-r--r-- | fs/block_dev.c | 8 | ||||
-rw-r--r-- | include/linux/fs.h | 2 |
5 files changed, 14 insertions, 17 deletions
diff --git a/block/compat_ioctl.c b/block/compat_ioctl.c index 5b3db0640d87..3098c92402fd 100644 --- a/block/compat_ioctl.c +++ b/block/compat_ioctl.c | |||
@@ -177,7 +177,7 @@ struct compat_blkpg_ioctl_arg { | |||
177 | compat_caddr_t data; | 177 | compat_caddr_t data; |
178 | }; | 178 | }; |
179 | 179 | ||
180 | static int compat_blkpg_ioctl(struct inode *inode, struct file *file, | 180 | static int compat_blkpg_ioctl(struct block_device *bdev, fmode_t mode, |
181 | unsigned int cmd, struct compat_blkpg_ioctl_arg __user *ua32) | 181 | unsigned int cmd, struct compat_blkpg_ioctl_arg __user *ua32) |
182 | { | 182 | { |
183 | struct blkpg_ioctl_arg __user *a = compat_alloc_user_space(sizeof(*a)); | 183 | 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, | |||
196 | if (err) | 196 | if (err) |
197 | return err; | 197 | return err; |
198 | 198 | ||
199 | return blkdev_ioctl(inode, file, cmd, (unsigned long)a); | 199 | return blkdev_ioctl(bdev, mode, cmd, (unsigned long)a); |
200 | } | 200 | } |
201 | 201 | ||
202 | #define BLKBSZGET_32 _IOR(0x12, 112, int) | 202 | #define BLKBSZGET_32 _IOR(0x12, 112, int) |
@@ -715,13 +715,13 @@ long compat_blkdev_ioctl(struct file *file, unsigned cmd, unsigned long arg) | |||
715 | * but we call blkdev_ioctl, which gets the lock for us | 715 | * but we call blkdev_ioctl, which gets the lock for us |
716 | */ | 716 | */ |
717 | case BLKRRPART: | 717 | case BLKRRPART: |
718 | return blkdev_ioctl(inode, file, cmd, | 718 | return blkdev_ioctl(bdev, mode, cmd, |
719 | (unsigned long)compat_ptr(arg)); | 719 | (unsigned long)compat_ptr(arg)); |
720 | case BLKBSZSET_32: | 720 | case BLKBSZSET_32: |
721 | return blkdev_ioctl(inode, file, BLKBSZSET, | 721 | return blkdev_ioctl(bdev, mode, BLKBSZSET, |
722 | (unsigned long)compat_ptr(arg)); | 722 | (unsigned long)compat_ptr(arg)); |
723 | case BLKPG: | 723 | case BLKPG: |
724 | return compat_blkpg_ioctl(inode, file, cmd, compat_ptr(arg)); | 724 | return compat_blkpg_ioctl(bdev, mode, cmd, compat_ptr(arg)); |
725 | case BLKRAGET: | 725 | case BLKRAGET: |
726 | case BLKFRAGET: | 726 | case BLKFRAGET: |
727 | if (!arg) | 727 | if (!arg) |
diff --git a/block/ioctl.c b/block/ioctl.c index 14b7f2c10662..c832d639b6e2 100644 --- a/block/ioctl.c +++ b/block/ioctl.c | |||
@@ -230,20 +230,13 @@ EXPORT_SYMBOL_GPL(__blkdev_driver_ioctl); | |||
230 | * always keep this in sync with compat_blkdev_ioctl() and | 230 | * always keep this in sync with compat_blkdev_ioctl() and |
231 | * compat_blkdev_locked_ioctl() | 231 | * compat_blkdev_locked_ioctl() |
232 | */ | 232 | */ |
233 | int blkdev_ioctl(struct inode *inode, struct file *file, unsigned cmd, | 233 | int blkdev_ioctl(struct block_device *bdev, fmode_t mode, unsigned cmd, |
234 | unsigned long arg) | 234 | unsigned long arg) |
235 | { | 235 | { |
236 | struct block_device *bdev = inode->i_bdev; | ||
237 | struct gendisk *disk = bdev->bd_disk; | 236 | struct gendisk *disk = bdev->bd_disk; |
238 | struct backing_dev_info *bdi; | 237 | struct backing_dev_info *bdi; |
239 | loff_t size; | 238 | loff_t size; |
240 | int ret, n; | 239 | int ret, n; |
241 | fmode_t mode = 0; | ||
242 | if (file) { | ||
243 | mode = file->f_mode; | ||
244 | if (file->f_flags & O_NDELAY) | ||
245 | mode |= FMODE_NDELAY_NOW; | ||
246 | } | ||
247 | 240 | ||
248 | switch(cmd) { | 241 | switch(cmd) { |
249 | case BLKFLSBUF: | 242 | case BLKFLSBUF: |
diff --git a/drivers/char/raw.c b/drivers/char/raw.c index f3cf5eb9b7fb..96adf28a17e4 100644 --- a/drivers/char/raw.c +++ b/drivers/char/raw.c | |||
@@ -125,7 +125,7 @@ raw_ioctl(struct inode *inode, struct file *filp, | |||
125 | { | 125 | { |
126 | struct block_device *bdev = filp->private_data; | 126 | struct block_device *bdev = filp->private_data; |
127 | 127 | ||
128 | return blkdev_ioctl(bdev->bd_inode, NULL, command, arg); | 128 | return blkdev_ioctl(bdev, 0, command, arg); |
129 | } | 129 | } |
130 | 130 | ||
131 | static void bind_device(struct raw_config_request *rq) | 131 | static void bind_device(struct raw_config_request *rq) |
diff --git a/fs/block_dev.c b/fs/block_dev.c index b89c956e04f6..05865b93f7e1 100644 --- a/fs/block_dev.c +++ b/fs/block_dev.c | |||
@@ -1202,7 +1202,11 @@ static int blkdev_close(struct inode * inode, struct file * filp) | |||
1202 | 1202 | ||
1203 | static long block_ioctl(struct file *file, unsigned cmd, unsigned long arg) | 1203 | static long block_ioctl(struct file *file, unsigned cmd, unsigned long arg) |
1204 | { | 1204 | { |
1205 | return blkdev_ioctl(file->f_mapping->host, file, cmd, arg); | 1205 | struct block_device *bdev = I_BDEV(file->f_mapping->host); |
1206 | fmode_t mode = file->f_mode; | ||
1207 | if (file->f_flags & O_NDELAY) | ||
1208 | mode |= FMODE_NDELAY_NOW; | ||
1209 | return blkdev_ioctl(bdev, mode, cmd, arg); | ||
1206 | } | 1210 | } |
1207 | 1211 | ||
1208 | static const struct address_space_operations def_blk_aops = { | 1212 | 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) | |||
1238 | int res; | 1242 | int res; |
1239 | mm_segment_t old_fs = get_fs(); | 1243 | mm_segment_t old_fs = get_fs(); |
1240 | set_fs(KERNEL_DS); | 1244 | set_fs(KERNEL_DS); |
1241 | res = blkdev_ioctl(bdev->bd_inode, NULL, cmd, arg); | 1245 | res = blkdev_ioctl(bdev, 0, cmd, arg); |
1242 | set_fs(old_fs); | 1246 | set_fs(old_fs); |
1243 | return res; | 1247 | return res; |
1244 | } | 1248 | } |
diff --git a/include/linux/fs.h b/include/linux/fs.h index 11de682c65a1..ff536e106b4e 100644 --- a/include/linux/fs.h +++ b/include/linux/fs.h | |||
@@ -1717,7 +1717,7 @@ extern const struct file_operations bad_sock_fops; | |||
1717 | extern const struct file_operations def_fifo_fops; | 1717 | extern const struct file_operations def_fifo_fops; |
1718 | #ifdef CONFIG_BLOCK | 1718 | #ifdef CONFIG_BLOCK |
1719 | extern int ioctl_by_bdev(struct block_device *, unsigned, unsigned long); | 1719 | extern int ioctl_by_bdev(struct block_device *, unsigned, unsigned long); |
1720 | extern int blkdev_ioctl(struct inode *, struct file *, unsigned, unsigned long); | 1720 | extern int blkdev_ioctl(struct block_device *, fmode_t, unsigned, unsigned long); |
1721 | extern long compat_blkdev_ioctl(struct file *, unsigned, unsigned long); | 1721 | extern long compat_blkdev_ioctl(struct file *, unsigned, unsigned long); |
1722 | extern int blkdev_get(struct block_device *, fmode_t); | 1722 | extern int blkdev_get(struct block_device *, fmode_t); |
1723 | extern int blkdev_put(struct block_device *, fmode_t); | 1723 | extern int blkdev_put(struct block_device *, fmode_t); |