summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorDave Jones <davej@suse.de>2002-05-30 20:46:15 -0700
committerLinus Torvalds <torvalds@penguin.transmeta.com>2002-05-30 20:46:15 -0700
commitdbf4ab44acdd779153a09d7dfc35fa557e882e11 (patch)
tree521c402b032974ee1292d979bc10e6d979965d4a
parent7af03ca1fa084f8073852883a52e8c8bf6834e10 (diff)
[PATCH] forward ioctls on raw devices to underlying devices
Should allow for things like adjusting readahead on raw devices.
-rw-r--r--drivers/char/raw.c21
1 files changed, 21 insertions, 0 deletions
diff --git a/drivers/char/raw.c b/drivers/char/raw.c
index a901f7b1bdbe..b1033d13b258 100644
--- a/drivers/char/raw.c
+++ b/drivers/char/raw.c
@@ -34,6 +34,7 @@ ssize_t raw_write(struct file *, const char *, size_t, loff_t *);
int raw_open(struct inode *, struct file *);
int raw_release(struct inode *, struct file *);
int raw_ctl_ioctl(struct inode *, struct file *, unsigned int, unsigned long);
+int raw_ioctl(struct inode *, struct file *, unsigned int, unsigned long);
static struct file_operations raw_fops = {
@@ -41,6 +42,7 @@ static struct file_operations raw_fops = {
write: raw_write,
open: raw_open,
release: raw_release,
+ ioctl: raw_ioctl,
};
static struct file_operations raw_ctl_fops = {
@@ -143,6 +145,25 @@ int raw_release(struct inode *inode, struct file *filp)
+/* Forward ioctls to the underlying block device. */
+int raw_ioctl(struct inode *inode,
+ struct file *flip,
+ unsigned int command,
+ unsigned long arg)
+{
+ int minor = minor(inode->i_rdev), err;
+ struct block_device *b;
+ if (minor < 1 && minor > 255)
+ return -ENODEV;
+
+ b = raw_devices[minor].binding;
+ err = -EINVAL;
+ if (b && b->bd_inode && b->bd_op && b->bd_op->ioctl) {
+ err = b->bd_op->ioctl(b->bd_inode, NULL, command, arg);
+ }
+ return err;
+}
+
/*
* Deal with ioctls against the raw-device control interface, to bind
* and unbind other raw devices.