From patchwork Thu Apr 9 05:53:49 2009 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Kevin Cernekee X-Patchwork-Id: 25767 Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@ozlabs.org Received: from bombadil.infradead.org (bombadil.infradead.org [18.85.46.34]) (using TLSv1 with cipher DHE-RSA-AES256-SHA (256/256 bits)) (Client did not present a certificate) by ozlabs.org (Postfix) with ESMTPS id 3F7E8DE0DC for ; Thu, 9 Apr 2009 15:56:03 +1000 (EST) Received: from localhost ([::1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.69 #1 (Red Hat Linux)) id 1LrnD9-0004Wt-3c; Thu, 09 Apr 2009 05:54:03 +0000 Received: from mail-qy0-f122.google.com ([209.85.221.122]) by bombadil.infradead.org with esmtp (Exim 4.69 #1 (Red Hat Linux)) id 1LrnCw-0004Pp-70 for linux-mtd@lists.infradead.org; Thu, 09 Apr 2009 05:54:01 +0000 Received: by mail-qy0-f122.google.com with SMTP id 28so909170qyk.28 for ; Wed, 08 Apr 2009 22:53:50 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=gamma; h=domainkey-signature:mime-version:received:date:message-id:subject :from:to:cc:content-type:content-transfer-encoding; bh=Az2MCbG23xdxGxeks0yOVDc7f3/gs0ZDlCQIoWFUqzI=; b=HhjfepWo5gRr1ARo8BT715DGQiY9y7u3FNhgcsvwVgoM/v/6DZTwbV91HPtrp4T5AN ZwSn8zBkN7ATTYGTw+Ox8MmQxMoee2SxlX9pZuQSwrRdfG48MQ5A4kFGic6NbQzrK59+ 7swsnl6MOJagiEX619wj2uhDvK75vlL9RppzM= DomainKey-Signature: a=rsa-sha1; c=nofws; d=gmail.com; s=gamma; h=mime-version:date:message-id:subject:from:to:cc:content-type :content-transfer-encoding; b=q5IuOp7v/GhBeO6Mnj6ng2nSM42A5T8IvOTQnI3FdgZJmj5uKXCmQ6LgVe+yUS1jLP 1EJbjNN/5cAWh/Ew/7ZvCUvJ+jWCj5PjhjWTVu1Ahs9C3aNrvX+c45k63CFtFxRQT5Ss L+qF8eBlTzH/7SFzUl7S8mbUtp0T8iFWyAGDs= MIME-Version: 1.0 Received: by 10.229.97.19 with SMTP id j19mr821662qcn.54.1239256429937; Wed, 08 Apr 2009 22:53:49 -0700 (PDT) Date: Wed, 8 Apr 2009 22:53:49 -0700 Message-ID: Subject: [PATCH 4/4] [MTD] Add OOB ioctls for >4GiB devices From: Kevin Cernekee To: David Woodhouse X-Spam-Score: 0.0 (/) Cc: Linux MTD , "linux-kernel@vger.kernel.org" X-BeenThere: linux-mtd@lists.infradead.org X-Mailman-Version: 2.1.11 Precedence: list List-Id: Linux MTD discussion mailing list List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Sender: linux-mtd-bounces@lists.infradead.org Errors-To: linux-mtd-bounces+incoming=patchwork.ozlabs.org@lists.infradead.org Signed-off-by: Kevin Cernekee --- drivers/mtd/mtdchar.c | 28 ++++++++++++++++++++++++++++ fs/compat_ioctl.c | 2 ++ include/mtd/mtd-abi.h | 9 +++++++++ 3 files changed, 39 insertions(+), 0 deletions(-) diff --git a/drivers/mtd/mtdchar.c b/drivers/mtd/mtdchar.c index 51bb0b0..99d1fbc 100644 --- a/drivers/mtd/mtdchar.c +++ b/drivers/mtd/mtdchar.c @@ -607,6 +607,34 @@ static int mtd_ioctl(struct inode *inode, struct file *file, break; } + case MEMWRITEOOB64: + { + struct mtd_oob_buf64 buf; + struct mtd_oob_buf64 __user *buf_user = argp; + + if (copy_from_user(&buf, argp, sizeof(buf))) + ret = -EFAULT; + else + ret = mtd_do_writeoob(file, mtd, buf.start, buf.length, + (void __user *)(uintptr_t)buf.usr_ptr, + &buf_user->length); + break; + } + + case MEMREADOOB64: + { + struct mtd_oob_buf64 buf; + struct mtd_oob_buf64 __user *buf_user = argp; + + if (copy_from_user(&buf, argp, sizeof(buf))) + ret = -EFAULT; + else + ret = mtd_do_readoob(mtd, buf.start, buf.length, + (void __user *)(uintptr_t)buf.usr_ptr, + &buf_user->length); + break; + } + case MEMLOCK: { struct erase_info_user einfo; diff --git a/fs/compat_ioctl.c b/fs/compat_ioctl.c index 1db8d41..5f7b8a1 100644 --- a/fs/compat_ioctl.c +++ b/fs/compat_ioctl.c @@ -2411,6 +2411,8 @@ COMPATIBLE_IOCTL(ECCGETLAYOUT) COMPATIBLE_IOCTL(ECCGETSTATS) COMPATIBLE_IOCTL(MTDFILEMODE) COMPATIBLE_IOCTL(MEMERASE64) +COMPATIBLE_IOCTL(MEMREADOOB64) +COMPATIBLE_IOCTL(MEMWRITEOOB64) /* NBD */ ULONG_IOCTL(NBD_SET_SOCK) ULONG_IOCTL(NBD_SET_BLKSIZE) diff --git a/include/mtd/mtd-abi.h b/include/mtd/mtd-abi.h index 2e32be1..be51ae2 100644 --- a/include/mtd/mtd-abi.h +++ b/include/mtd/mtd-abi.h @@ -23,6 +23,13 @@ struct mtd_oob_buf { unsigned char __user *ptr; }; +struct mtd_oob_buf64 { + __u64 start; + __u32 pad; + __u32 length; + __u64 usr_ptr; +}; + #define MTD_ABSENT 0 #define MTD_RAM 1 #define MTD_ROM 2 @@ -101,6 +108,8 @@ struct otp_info { #define ECCGETSTATS _IOR('M', 18, struct mtd_ecc_stats) #define MTDFILEMODE _IO('M', 19) #define MEMERASE64 _IOW('M', 20, struct erase_info_user64) +#define MEMWRITEOOB64 _IOWR('M', 21, struct mtd_oob_buf64) +#define MEMREADOOB64 _IOWR('M', 22, struct mtd_oob_buf64) /* * Obsolete legacy interface. Keep it in order not to break userspace