diff options
Diffstat (limited to 'block/compat_ioctl.c')
-rw-r--r-- | block/compat_ioctl.c | 54 |
1 files changed, 54 insertions, 0 deletions
diff --git a/block/compat_ioctl.c b/block/compat_ioctl.c index 500cc9e761c1..219b7e76e8ad 100644 --- a/block/compat_ioctl.c +++ b/block/compat_ioctl.c | |||
@@ -40,6 +40,53 @@ static int compat_put_u64(unsigned long arg, u64 val) | |||
40 | #define BLKBSZSET_32 _IOW(0x12, 113, int) | 40 | #define BLKBSZSET_32 _IOW(0x12, 113, int) |
41 | #define BLKGETSIZE64_32 _IOR(0x12, 114, int) | 41 | #define BLKGETSIZE64_32 _IOR(0x12, 114, int) |
42 | 42 | ||
43 | struct compat_blk_user_trace_setup { | ||
44 | char name[32]; | ||
45 | u16 act_mask; | ||
46 | u32 buf_size; | ||
47 | u32 buf_nr; | ||
48 | compat_u64 start_lba; | ||
49 | compat_u64 end_lba; | ||
50 | u32 pid; | ||
51 | }; | ||
52 | #define BLKTRACESETUP32 _IOWR(0x12, 115, struct compat_blk_user_trace_setup) | ||
53 | |||
54 | static int compat_blk_trace_setup(struct block_device *bdev, char __user *arg) | ||
55 | { | ||
56 | struct blk_user_trace_setup buts; | ||
57 | struct compat_blk_user_trace_setup cbuts; | ||
58 | struct request_queue *q; | ||
59 | int ret; | ||
60 | |||
61 | q = bdev_get_queue(bdev); | ||
62 | if (!q) | ||
63 | return -ENXIO; | ||
64 | |||
65 | if (copy_from_user(&cbuts, arg, sizeof(cbuts))) | ||
66 | return -EFAULT; | ||
67 | |||
68 | buts = (struct blk_user_trace_setup) { | ||
69 | .act_mask = cbuts.act_mask, | ||
70 | .buf_size = cbuts.buf_size, | ||
71 | .buf_nr = cbuts.buf_nr, | ||
72 | .start_lba = cbuts.start_lba, | ||
73 | .end_lba = cbuts.end_lba, | ||
74 | .pid = cbuts.pid, | ||
75 | }; | ||
76 | memcpy(&buts.name, &cbuts.name, 32); | ||
77 | |||
78 | mutex_lock(&bdev->bd_mutex); | ||
79 | ret = do_blk_trace_setup(q, bdev, &buts); | ||
80 | mutex_unlock(&bdev->bd_mutex); | ||
81 | if (ret) | ||
82 | return ret; | ||
83 | |||
84 | if (copy_to_user(arg, &buts.name, 32)) | ||
85 | return -EFAULT; | ||
86 | |||
87 | return 0; | ||
88 | } | ||
89 | |||
43 | static int compat_blkdev_driver_ioctl(struct inode *inode, struct file *file, | 90 | static int compat_blkdev_driver_ioctl(struct inode *inode, struct file *file, |
44 | struct gendisk *disk, unsigned cmd, unsigned long arg) | 91 | struct gendisk *disk, unsigned cmd, unsigned long arg) |
45 | { | 92 | { |
@@ -197,6 +244,13 @@ static int compat_blkdev_locked_ioctl(struct inode *inode, struct file *file, | |||
197 | 244 | ||
198 | case BLKGETSIZE64_32: | 245 | case BLKGETSIZE64_32: |
199 | return compat_put_u64(arg, bdev->bd_inode->i_size); | 246 | return compat_put_u64(arg, bdev->bd_inode->i_size); |
247 | |||
248 | case BLKTRACESETUP32: | ||
249 | return compat_blk_trace_setup(bdev, compat_ptr(arg)); | ||
250 | case BLKTRACESTART: /* compatible */ | ||
251 | case BLKTRACESTOP: /* compatible */ | ||
252 | case BLKTRACETEARDOWN: /* compatible */ | ||
253 | return blk_trace_ioctl(bdev, cmd, compat_ptr(arg)); | ||
200 | } | 254 | } |
201 | return -ENOIOCTLCMD; | 255 | return -ENOIOCTLCMD; |
202 | } | 256 | } |