Commit ca7db9f9 authored by Andy Whitcroft's avatar Andy Whitcroft Committed by Tim Gardner

UBUNTU: SAUCE: dm: introduce a target_ioctl op to allow target specific ioctls

In e56f81e0 "dm: refactor ioctl handling" the target specific ioctl
operation was removed in favour of providing a mapping to the underlying
device, to which ioctls are all assumed to apply.  This prevents targets
from having target specific ioctls.

Introduce a new target_ioctl callback which (if present) is offered the
command and arguments for processing.  This callback can return -ENOTTY
to indicate the ioctl should be passed on to the underlying device as
normal.

BugLink: http://bugs.launchpad.net/bugs/1538618Signed-off-by: default avatarAndy Whitcroft <apw@canonical.com>
parent c71138b8
......@@ -610,6 +610,15 @@ static int dm_blk_ioctl(struct block_device *bdev, fmode_t mode,
if (r < 0)
return r;
if (tgt->type->target_ioctl) {
int res = tgt->type->target_ioctl(tgt, cmd, arg);
if (res != -ENOTTY) {
r = res;
goto out;
}
}
if (r > 0) {
/*
* Target determined this ioctl is being issued against
......
......@@ -81,6 +81,8 @@ typedef int (*dm_message_fn) (struct dm_target *ti, unsigned argc, char **argv);
typedef int (*dm_prepare_ioctl_fn) (struct dm_target *ti,
struct block_device **bdev, fmode_t *mode);
typedef int (*dm_target_ioctl_fn) (struct dm_target *ti, unsigned int cmd,
unsigned long arg);
/*
* These iteration functions are typically used to check (and combine)
......@@ -157,6 +159,7 @@ struct target_type {
dm_status_fn status;
dm_message_fn message;
dm_prepare_ioctl_fn prepare_ioctl;
dm_target_ioctl_fn target_ioctl;
dm_busy_fn busy;
dm_iterate_devices_fn iterate_devices;
dm_io_hints_fn io_hints;
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment