From: Andi Kleen <ak@muc.de>
To: James.Bottomley@SteelEye.com, linux-scsi@vger.kernel.org
Subject: [PATCH] Add compat_ioctl to SD
Date: 18 Jan 2005 12:12:02 +0100
Date: Tue, 18 Jan 2005 12:12:02 +0100 [thread overview]
Message-ID: <20050118111202.GF43344@muc.de> (raw)
Add compat_ioctl entry point to SD
Requires the compat_ioctl for block devices patch I sent earlier
to linux-kernel.
Signed-off-by: Andi Kleen <ak@muc.de>
diff -u linux-2.6.11-rc1-bk4/drivers/scsi/sd.c-o linux-2.6.11-rc1-bk4/drivers/scsi/sd.c
--- linux-2.6.11-rc1-bk4/drivers/scsi/sd.c-o 2005-01-17 10:39:40.000000000 +0100
+++ linux-2.6.11-rc1-bk4/drivers/scsi/sd.c 2005-01-18 04:55:17.000000000 +0100
@@ -738,11 +738,50 @@
sd_revalidate_disk(sdkp->disk);
}
+
+#ifdef CONFIG_COMPAT
+/*
+ * This gets directly called from VFS. When the ioctl
+ * is not recognized we go back to the other translation paths.
+ */
+static long sd_compat_ioctl(struct file *file, unsigned int cmd, unsigned long arg)
+{
+ struct block_device *bdev = file->f_dentry->d_inode->i_bdev;
+ struct gendisk *disk = bdev->bd_disk;
+ struct scsi_device *sdev = scsi_disk(disk)->device;
+
+ /*
+ * If we are in the middle of error recovery, don't let anyone
+ * else try and use this device. Also, if error recovery fails, it
+ * may try and take the device offline, in which case all further
+ * access to the device is prohibited.
+ */
+ if (!scsi_block_when_processing_errors(sdev))
+ return -ENODEV;
+
+ if (sdev->host->hostt->compat_ioctl) {
+ int ret;
+
+ ret = sdev->host->hostt->compat_ioctl(sdev, cmd, (void __user *)arg);
+
+ return ret;
+ }
+
+ /*
+ * Let the static ioctl translation table take care of it.
+ */
+ return -ENOIOCTLCMD;
+}
+#endif
+
static struct block_device_operations sd_fops = {
.owner = THIS_MODULE,
.open = sd_open,
.release = sd_release,
.ioctl = sd_ioctl,
+#ifdef CONFIG_COMPAT
+ .compat_ioctl = sd_compat_ioctl,
+#endif
.media_changed = sd_media_changed,
.revalidate_disk = sd_revalidate_disk,
};
reply other threads:[~2005-01-18 11:12 UTC|newest]
Thread overview: [no followups] expand[flat|nested] mbox.gz Atom feed
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=20050118111202.GF43344@muc.de \
--to=ak@muc.de \
--cc=James.Bottomley@SteelEye.com \
--cc=linux-scsi@vger.kernel.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.