mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
From: Arnd Bergmann <arnd@arndb.de>
To: linux-kernel@vger.kernel.org
Cc: Arnd Bergmann <arnd@arndb.de>,
	Paul Clements <Paul.Clements@steeleye.com>,
	Jens Axboe <jens.axboe@oracle.com>,
	Andrew Morton <akpm@linux-foundation.org>,
	Pavel Machek <pavel@suse.cz>, Tejun Heo <tj@kernel.org>
Subject: [PATCH 05/12] nbd: add compat_ioctl method
Date: Mon, 16 Nov 2009 00:27:00 +0000	[thread overview]
Message-ID: <1258331227-1694-6-git-send-email-arnd@arndb.de> (raw)
In-Reply-To: <1258331227-1694-1-git-send-email-arnd@arndb.de>

The nbd driver needs a special case for its compat_ioctl
handling, because it treats the ioctl argument as an
integer instead of a pointer.

Move that handling into the nbd driver itself from
fs/compat_ioctl.c in order to keep it local.

Push down the BKL into the ioctl method at the
same time.

Signed-off-by: Arnd Bergmann <arnd@arndb.de>
Cc: Paul Clements <Paul.Clements@steeleye.com>
Cc: Jens Axboe <jens.axboe@oracle.com>
Cc: Andrew Morton <akpm@linux-foundation.org>
Cc: Pavel Machek <pavel@suse.cz>
Cc: Tejun Heo <tj@kernel.org>
---
 drivers/block/nbd.c |    7 ++++++-
 fs/compat_ioctl.c   |   11 -----------
 2 files changed, 6 insertions(+), 12 deletions(-)

diff --git a/drivers/block/nbd.c b/drivers/block/nbd.c
index cc923a5..758b75d 100644
--- a/drivers/block/nbd.c
+++ b/drivers/block/nbd.c
@@ -30,6 +30,8 @@
 #include <net/sock.h>
 #include <linux/net.h>
 #include <linux/kthread.h>
+#include <linux/smp_lock.h>
+#include <linux/compat.h>
 
 #include <asm/uaccess.h>
 #include <asm/system.h>
@@ -715,9 +717,11 @@ static int nbd_ioctl(struct block_device *bdev, fmode_t mode,
 	dprintk(DBG_IOCTL, "%s: nbd_ioctl cmd=%s(0x%x) arg=%lu\n",
 			lo->disk->disk_name, ioctl_cmd_to_ascii(cmd), cmd, arg);
 
+	lock_kernel();
 	mutex_lock(&lo->tx_lock);
 	error = __nbd_ioctl(bdev, lo, cmd, arg);
 	mutex_unlock(&lo->tx_lock);
+	unlock_kernel();
 
 	return error;
 }
@@ -725,7 +729,8 @@ static int nbd_ioctl(struct block_device *bdev, fmode_t mode,
 static const struct block_device_operations nbd_fops =
 {
 	.owner =	THIS_MODULE,
-	.locked_ioctl =	nbd_ioctl,
+	.ioctl =	nbd_ioctl,
+	.compat_ioctl =	nbd_ioctl,
 };
 
 /*
diff --git a/fs/compat_ioctl.c b/fs/compat_ioctl.c
index 80f1a92..376d907 100644
--- a/fs/compat_ioctl.c
+++ b/fs/compat_ioctl.c
@@ -1362,12 +1362,6 @@ COMPATIBLE_IOCTL(USBDEVFS_SUBMITURB32)
 COMPATIBLE_IOCTL(USBDEVFS_REAPURB32)
 COMPATIBLE_IOCTL(USBDEVFS_REAPURBNDELAY32)
 COMPATIBLE_IOCTL(USBDEVFS_CLEAR_HALT)
-/* NBD */
-COMPATIBLE_IOCTL(NBD_DO_IT)
-COMPATIBLE_IOCTL(NBD_CLEAR_SOCK)
-COMPATIBLE_IOCTL(NBD_CLEAR_QUE)
-COMPATIBLE_IOCTL(NBD_PRINT_DEBUG)
-COMPATIBLE_IOCTL(NBD_DISCONNECT)
 /* i2c */
 COMPATIBLE_IOCTL(I2C_SLAVE)
 COMPATIBLE_IOCTL(I2C_SLAVE_FORCE)
@@ -1614,11 +1608,6 @@ static long do_ioctl_trans(int fd, unsigned int cmd,
 	case KDSKBMETA:
 	case KDSKBLED:
 	case KDSETLED:
-	/* NBD */
-	case NBD_SET_SOCK:
-	case NBD_SET_BLKSIZE:
-	case NBD_SET_SIZE:
-	case NBD_SET_SIZE_BLOCKS:
 		return do_vfs_ioctl(file, fd, cmd, arg);
 	}
 
-- 
1.6.3.3


  parent reply	other threads:[~2009-11-16  0:27 UTC|newest]

Thread overview: 19+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
     [not found] <1258331227-1694-1-git-send-email-arnd@arndb.de>
2009-11-16  0:26 ` [PATCH 01/12] arch/um: handle compat_ioctl in tty line driver Arnd Bergmann
2009-11-16  0:26 ` [PATCH 02/12] scsi/sg: move compat_ioctl handling into sg driver Arnd Bergmann
2009-11-16  0:26 ` [PATCH 03/12] autofs/autofs4: move compat_ioctl handling into fs Arnd Bergmann
2009-11-16  0:26 ` [PATCH 04/12] raw: partly fix compat_ioctl handling on non-x86 Arnd Bergmann
2009-11-16  0:27 ` Arnd Bergmann [this message]
2009-11-16  0:27 ` [PATCH 06/12] smbfs: do compat_ioctl handling in place Arnd Bergmann
2009-11-16  0:27 ` [PATCH 07/12] i2cdev: move compat_ioctl handling into driver Arnd Bergmann
2009-12-14 14:23   ` Jean Delvare
2009-12-14 15:31     ` Arnd Bergmann
2010-06-03 12:31       ` Jean Delvare
2009-11-16  0:27 ` [PATCH 08/12] md: move compat_ioctl handling into md.c Arnd Bergmann
2009-11-16  8:39   ` Andre Noll
2009-11-16  0:27 ` [PATCH 09/12] lp: move compat_ioctl handling into lp.c Arnd Bergmann
2009-11-17  1:38   ` Greg KH
2009-11-16  0:27 ` [PATCH 10/12] usbdevfs: move compat_ioctl handling to devio.c Arnd Bergmann
2009-11-17  1:38   ` Greg KH
2009-11-16  0:27 ` [PATCH 11/12] hamradio/mkiss: fix typo in compat_ioctl Arnd Bergmann
2009-11-16  5:13   ` David Miller
2009-11-16  0:27 ` [PATCH 12/12] compat_ioctl: remove unused handlers Arnd Bergmann

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=1258331227-1694-6-git-send-email-arnd@arndb.de \
    --to=arnd@arndb.de \
    --cc=Paul.Clements@steeleye.com \
    --cc=akpm@linux-foundation.org \
    --cc=jens.axboe@oracle.com \
    --cc=linux-kernel@vger.kernel.org \
    --cc=pavel@suse.cz \
    --cc=tj@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 a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox

all inboxes | Powered by JetHome®