public inbox for linux-kernel@vger.kernel.org
 help / color / mirror / Atom feed
From: Christoph Hellwig <hch@lst.de>
To: akpm@osdl.org, schwidefsky@de.ibm.com
Cc: linux-kernel@vger.kernel.org
Subject: [PATCH 1/4] add compat_ioctl methods to dasd
Date: Fri, 4 Nov 2005 23:16:52 +0100	[thread overview]
Message-ID: <20051104221652.GB9384@lst.de> (raw)

all dasd ioctls are directly useable from 32bit process, thus switch
the dasd driver to unlocked_ioctl/compat_ioctl and get rid of the
translations in the global table.


Index: linux-2.6/arch/s390/kernel/compat_ioctl.c
===================================================================
--- linux-2.6.orig/arch/s390/kernel/compat_ioctl.c	2005-11-04 13:49:43.000000000 +0100
+++ linux-2.6/arch/s390/kernel/compat_ioctl.c	2005-11-04 14:01:19.000000000 +0100
@@ -44,26 +44,6 @@
 #include "../../../fs/compat_ioctl.c"
 
 /* s390 only ioctls */
-COMPATIBLE_IOCTL(DASDAPIVER)
-COMPATIBLE_IOCTL(BIODASDDISABLE)
-COMPATIBLE_IOCTL(BIODASDENABLE)
-COMPATIBLE_IOCTL(BIODASDRSRV)
-COMPATIBLE_IOCTL(BIODASDRLSE)
-COMPATIBLE_IOCTL(BIODASDSLCK)
-COMPATIBLE_IOCTL(BIODASDINFO)
-COMPATIBLE_IOCTL(BIODASDINFO2)
-COMPATIBLE_IOCTL(BIODASDFMT)
-COMPATIBLE_IOCTL(BIODASDPRRST)
-COMPATIBLE_IOCTL(BIODASDQUIESCE)
-COMPATIBLE_IOCTL(BIODASDRESUME)
-COMPATIBLE_IOCTL(BIODASDPRRD)
-COMPATIBLE_IOCTL(BIODASDPSRD)
-COMPATIBLE_IOCTL(BIODASDGATTR)
-COMPATIBLE_IOCTL(BIODASDSATTR)
-COMPATIBLE_IOCTL(BIODASDCMFENABLE)
-COMPATIBLE_IOCTL(BIODASDCMFDISABLE)
-COMPATIBLE_IOCTL(BIODASDREADALLCMB)
-
 COMPATIBLE_IOCTL(TUBICMD)
 COMPATIBLE_IOCTL(TUBOCMD)
 COMPATIBLE_IOCTL(TUBGETI)
Index: linux-2.6/drivers/s390/block/dasd.c
===================================================================
--- linux-2.6.orig/drivers/s390/block/dasd.c	2005-11-04 13:49:43.000000000 +0100
+++ linux-2.6/drivers/s390/block/dasd.c	2005-11-04 14:01:19.000000000 +0100
@@ -1726,7 +1726,10 @@
 	.owner		= THIS_MODULE,
 	.open		= dasd_open,
 	.release	= dasd_release,
-	.ioctl		= dasd_ioctl,
+	.unlocked_ioctl	= dasd_ioctl,
+#ifdef CONFIG_COMPAT
+	.compat_ioctl	= dasd_ioctl,
+#endif
 };
 
 
Index: linux-2.6/drivers/s390/block/dasd_int.h
===================================================================
--- linux-2.6.orig/drivers/s390/block/dasd_int.h	2005-11-04 13:49:43.000000000 +0100
+++ linux-2.6/drivers/s390/block/dasd_int.h	2005-11-04 14:01:19.000000000 +0100
@@ -525,7 +525,7 @@
 void dasd_ioctl_exit(void);
 int  dasd_ioctl_no_register(struct module *, int, dasd_ioctl_fn_t);
 int  dasd_ioctl_no_unregister(struct module *, int, dasd_ioctl_fn_t);
-int  dasd_ioctl(struct inode *, struct file *, unsigned int, unsigned long);
+long dasd_ioctl(struct file *, unsigned int, unsigned long);
 
 /* externals in dasd_proc.c */
 int dasd_proc_init(void);
Index: linux-2.6/drivers/s390/block/dasd_ioctl.c
===================================================================
--- linux-2.6.orig/drivers/s390/block/dasd_ioctl.c	2005-11-04 13:49:43.000000000 +0100
+++ linux-2.6/drivers/s390/block/dasd_ioctl.c	2005-11-04 14:01:19.000000000 +0100
@@ -79,15 +79,14 @@
 	return 0;
 }
 
-int
-dasd_ioctl(struct inode *inp, struct file *filp,
-	   unsigned int no, unsigned long data)
+long
+dasd_ioctl(struct file *filp, unsigned int no, unsigned long data)
 {
-	struct block_device *bdev = inp->i_bdev;
+	struct block_device *bdev = filp->f_dentry->d_inode->i_bdev;
 	struct dasd_device *device = bdev->bd_disk->private_data;
 	struct dasd_ioctl *ioctl;
 	const char *dir;
-	int rc;
+	int rc = -EINVAL;
 
 	if ((_IOC_DIR(no) != _IOC_NONE) && (data == 0)) {
 		PRINT_DEBUG("empty data ptr");
@@ -100,6 +99,8 @@
 	DBF_DEV_EVENT(DBF_DEBUG, device,
 		      "ioctl 0x%08x %s'0x%x'%d(%d) with data %8lx", no,
 		      dir, _IOC_TYPE(no), _IOC_NR(no), _IOC_SIZE(no), data);
+
+	lock_kernel()
 	/* Search for ioctl no in the ioctl list. */
 	list_for_each_entry(ioctl, &dasd_ioctl_list, list) {
 		if (ioctl->no == no) {
@@ -108,14 +109,16 @@
 				continue;
 			rc = ioctl->handler(bdev, no, data);
 			module_put(ioctl->owner);
-			return rc;
+			goto out;
 		}
 	}
 	/* No ioctl with number no. */
 	DBF_DEV_EVENT(DBF_INFO, device,
 		      "unknown ioctl 0x%08x=%s'0x%x'%d(%d) data %8lx", no,
 		      dir, _IOC_TYPE(no), _IOC_NR(no), _IOC_SIZE(no), data);
-	return -EINVAL;
+ out:
+	unlock_kernel();
+	return rc;
 }
 
 static int

             reply	other threads:[~2005-11-04 22:16 UTC|newest]

Thread overview: 7+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2005-11-04 22:16 Christoph Hellwig [this message]
2005-11-12  9:33 ` [PATCH 1/4] add compat_ioctl methods to dasd Christoph Hellwig
2005-11-15 14:51   ` Martin Schwidefsky
2005-11-15 17:24     ` Christoph Hellwig
2005-11-16  8:45       ` Christoph Hellwig
2005-11-17 12:27         ` Martin Schwidefsky
2005-11-17 22:18           ` Christoph Hellwig

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=20051104221652.GB9384@lst.de \
    --to=hch@lst.de \
    --cc=akpm@osdl.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=schwidefsky@de.ibm.com \
    /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 a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox