From patchwork Tue May 12 20:47:00 2009 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Andrew Morton X-Patchwork-Id: 27113 Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@bilbo.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 bilbo.ozlabs.org (Postfix) with ESMTPS id 80413B707C for ; Wed, 13 May 2009 07:11:55 +1000 (EST) Received: from localhost ([::1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.69 #1 (Red Hat Linux)) id 1M3zE9-0007FW-5Z; Tue, 12 May 2009 21:09:29 +0000 Received: from smtp1.linux-foundation.org ([140.211.169.13]) by bombadil.infradead.org with esmtps (Exim 4.69 #1 (Red Hat Linux)) id 1M3zDo-0007Bb-Kt; Tue, 12 May 2009 21:09:27 +0000 Received: from imap1.linux-foundation.org (imap1.linux-foundation.org [140.211.169.55]) by smtp1.linux-foundation.org (8.14.2/8.13.5/Debian-3ubuntu1.1) with ESMTP id n4CL6GJa010954 (version=TLSv1/SSLv3 cipher=DHE-RSA-AES256-SHA bits=256 verify=NO); Tue, 12 May 2009 14:06:52 -0700 Received: from localhost.localdomain (localhost [127.0.0.1]) by imap1.linux-foundation.org (8.13.5.20060308/8.13.5/Debian-3ubuntu1.1) with ESMTP id n4CL6Geq009485; Tue, 12 May 2009 14:06:16 -0700 Message-Id: <200905122106.n4CL6Geq009485@imap1.linux-foundation.org> Subject: [patch 08/14] mtd: add OOB ioctls for >4GiB devices To: dwmw2@infradead.org From: akpm@linux-foundation.org Date: Tue, 12 May 2009 13:47:00 -0700 X-Spam-Status: No, hits=-3.488 required=5 tests=AWL, BAYES_00, OSDL_HEADER_SUBJECT_BRACKETED X-Spam-Checker-Version: SpamAssassin 3.2.4-osdl_revision__1.47__ X-MIMEDefang-Filter: lf$Revision: 1.188 $ X-Scanned-By: MIMEDefang 2.63 on 140.211.169.13 X-Spam-Score: 0.0 (/) Cc: akpm@linux-foundation.org, linux-mtd@lists.infradead.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: , MIME-Version: 1.0 Sender: linux-mtd-bounces@lists.infradead.org Errors-To: linux-mtd-bounces+incoming=patchwork.ozlabs.org@lists.infradead.org From: Kevin Cernekee Signed-off-by: Kevin Cernekee Cc: David Woodhouse Signed-off-by: Andrew Morton --- drivers/mtd/mtdchar.c | 28 ++++++++++++++++++++++++++++ fs/compat_ioctl.c | 2 ++ include/mtd/mtd-abi.h | 9 +++++++++ 3 files changed, 39 insertions(+) diff -puN drivers/mtd/mtdchar.c~mtd-add-oob-ioctls-for-4gib-devices drivers/mtd/mtdchar.c --- a/drivers/mtd/mtdchar.c~mtd-add-oob-ioctls-for-4gib-devices +++ a/drivers/mtd/mtdchar.c @@ -607,6 +607,34 @@ static int mtd_ioctl(struct inode *inode 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 -puN fs/compat_ioctl.c~mtd-add-oob-ioctls-for-4gib-devices fs/compat_ioctl.c --- a/fs/compat_ioctl.c~mtd-add-oob-ioctls-for-4gib-devices +++ a/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 -puN include/mtd/mtd-abi.h~mtd-add-oob-ioctls-for-4gib-devices include/mtd/mtd-abi.h --- a/include/mtd/mtd-abi.h~mtd-add-oob-ioctls-for-4gib-devices +++ a/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