aboutsummaryrefslogtreecommitdiff
path: root/block/blktrace.c
diff options
context:
space:
mode:
authorLinus Torvalds <torvalds@woody.linux-foundation.org>2007-10-11 19:14:22 -0700
committerLinus Torvalds <torvalds@woody.linux-foundation.org>2007-10-11 19:14:22 -0700
commit1ce48904285fe4b0298864f9153a8502ebeac35c (patch)
treeffe1e0c31cdea427b48ae4d4d59a96ff9d208f32 /block/blktrace.c
parent55982fd184a065b1c69279d29cbc01dbf424d2f4 (diff)
parent780513ecb80ea0934fc6833efc4f5ed9ab4ff9bb (diff)
Merge branch 'block-2.6.24' of git://git.kernel.dk/data/git/linux-2.6-block
* 'block-2.6.24' of git://git.kernel.dk/data/git/linux-2.6-block: (37 commits) [BLOCK] Fix failing compile with BLK_DEV_IO_TRACE=n compat_ioctl: move floppy handlers to block/compat_ioctl.c compat_ioctl: move cdrom handlers to block/compat_ioctl.c compat_ioctl: move BLKPG handling to block/compat_ioctl.c compat_ioctl: move hdio calls to block/compat_ioctl.c compat_ioctl: handle blk_trace ioctls compat_ioctl: add compat_blkdev_driver_ioctl() compat_ioctl: move common block ioctls to compat_blkdev_ioctl Sysace: Don't enable IRQ until after interrupt handler is registered Sysace: sparse fixes Sysace: Minor coding convention fixup drivers/block/umem: use DRIVER_NAME where appropriate drivers/block/umem: trim trailing whitespace drivers/block/umem: minor cleanups drivers/block/umem: use dev_printk() drivers/block/umem: move private include away from include/linux Sysace: Labels in C code should not be indented. Sysace: Add of_platform_bus binding Sysace: Move IRQ handler registration to occur after FSM is initialized Sysace: minor rework and cleanup changes ...
Diffstat (limited to 'block/blktrace.c')
-rw-r--r--block/blktrace.c54
1 files changed, 34 insertions, 20 deletions
diff --git a/block/blktrace.c b/block/blktrace.c
index 20fa034ea4a..775471ef84a 100644
--- a/block/blktrace.c
+++ b/block/blktrace.c
@@ -312,33 +312,26 @@ static struct rchan_callbacks blk_relay_callbacks = {
/*
* Setup everything required to start tracing
*/
-static int blk_trace_setup(struct request_queue *q, struct block_device *bdev,
- char __user *arg)
+int do_blk_trace_setup(struct request_queue *q, struct block_device *bdev,
+ struct blk_user_trace_setup *buts)
{
- struct blk_user_trace_setup buts;
struct blk_trace *old_bt, *bt = NULL;
struct dentry *dir = NULL;
char b[BDEVNAME_SIZE];
int ret, i;
- if (copy_from_user(&buts, arg, sizeof(buts)))
- return -EFAULT;
-
- if (!buts.buf_size || !buts.buf_nr)
+ if (!buts->buf_size || !buts->buf_nr)
return -EINVAL;
- strcpy(buts.name, bdevname(bdev, b));
+ strcpy(buts->name, bdevname(bdev, b));
/*
* some device names have larger paths - convert the slashes
* to underscores for this to work as expected
*/
- for (i = 0; i < strlen(buts.name); i++)
- if (buts.name[i] == '/')
- buts.name[i] = '_';
-
- if (copy_to_user(arg, &buts, sizeof(buts)))
- return -EFAULT;
+ for (i = 0; i < strlen(buts->name); i++)
+ if (buts->name[i] == '/')
+ buts->name[i] = '_';
ret = -ENOMEM;
bt = kzalloc(sizeof(*bt), GFP_KERNEL);
@@ -350,7 +343,7 @@ static int blk_trace_setup(struct request_queue *q, struct block_device *bdev,
goto err;
ret = -ENOENT;
- dir = blk_create_tree(buts.name);
+ dir = blk_create_tree(buts->name);
if (!dir)
goto err;
@@ -363,20 +356,21 @@ static int blk_trace_setup(struct request_queue *q, struct block_device *bdev,
if (!bt->dropped_file)
goto err;
- bt->rchan = relay_open("trace", dir, buts.buf_size, buts.buf_nr, &blk_relay_callbacks, bt);
+ bt->rchan = relay_open("trace", dir, buts->buf_size,
+ buts->buf_nr, &blk_relay_callbacks, bt);
if (!bt->rchan)
goto err;
- bt->act_mask = buts.act_mask;
+ bt->act_mask = buts->act_mask;
if (!bt->act_mask)
bt->act_mask = (u16) -1;
- bt->start_lba = buts.start_lba;
- bt->end_lba = buts.end_lba;
+ bt->start_lba = buts->start_lba;
+ bt->end_lba = buts->end_lba;
if (!bt->end_lba)
bt->end_lba = -1ULL;
- bt->pid = buts.pid;
+ bt->pid = buts->pid;
bt->trace_state = Blktrace_setup;
ret = -EBUSY;
@@ -401,6 +395,26 @@ err:
return ret;
}
+static int blk_trace_setup(struct request_queue *q, struct block_device *bdev,
+ char __user *arg)
+{
+ struct blk_user_trace_setup buts;
+ int ret;
+
+ ret = copy_from_user(&buts, arg, sizeof(buts));
+ if (ret)
+ return -EFAULT;
+
+ ret = do_blk_trace_setup(q, bdev, &buts);
+ if (ret)
+ return ret;
+
+ if (copy_to_user(arg, &buts, sizeof(buts)))
+ return -EFAULT;
+
+ return 0;
+}
+
static int blk_trace_startstop(struct request_queue *q, int start)
{
struct blk_trace *bt;