public inbox for linux-mtd@lists.infradead.org
 help / color / mirror / Atom feed
* [PATCH 2/4] [MTD] Add MEMERASE64 ioctl for >4GiB devices
@ 2009-04-09  5:52 Kevin Cernekee
  2009-04-10 22:06 ` Andrew Morton
  2009-04-17  7:30 ` Artem Bityutskiy
  0 siblings, 2 replies; 5+ messages in thread
From: Kevin Cernekee @ 2009-04-09  5:52 UTC (permalink / raw)
  To: David Woodhouse; +Cc: Linux MTD, linux-kernel@vger.kernel.org

New MEMERASE/MEMREADOOB/MEMWRITEOOB ioctls are needed in order to support
64-bit offsets into large NAND flash devices.

Signed-off-by: Kevin Cernekee <kpc.mtd@gmail.com>

---
 drivers/mtd/mtdchar.c |   29 +++++++++++++++++++++--------
 fs/compat_ioctl.c     |    1 +
 include/mtd/mtd-abi.h |    6 ++++++
 3 files changed, 28 insertions(+), 8 deletions(-)

diff --git a/drivers/mtd/mtdchar.c b/drivers/mtd/mtdchar.c
index 763d3f0..ad4b861 100644
--- a/drivers/mtd/mtdchar.c
+++ b/drivers/mtd/mtdchar.c
@@ -417,6 +417,7 @@ static int mtd_ioctl(struct inode *inode, struct file *file,
 		break;

 	case MEMERASE:
+	case MEMERASE64:
 	{
 		struct erase_info *erase;

@@ -427,20 +428,32 @@ static int mtd_ioctl(struct inode *inode, struct
file *file,
 		if (!erase)
 			ret = -ENOMEM;
 		else {
-			struct erase_info_user einfo;
-
 			wait_queue_head_t waitq;
 			DECLARE_WAITQUEUE(wait, current);

 			init_waitqueue_head(&waitq);

-			if (copy_from_user(&einfo, argp,
-				    sizeof(struct erase_info_user))) {
-				kfree(erase);
-				return -EFAULT;
+			if (cmd == MEMERASE64) {
+				struct erase_info_user64 einfo64;
+
+				if (copy_from_user(&einfo64, argp,
+					    sizeof(struct erase_info_user64))) {
+					kfree(erase);
+					return -EFAULT;
+				}
+				erase->addr = einfo64.start;
+				erase->len = einfo64.length;
+			} else {
+				struct erase_info_user einfo32;
+
+				if (copy_from_user(&einfo32, argp,
+					    sizeof(struct erase_info_user))) {
+					kfree(erase);
+					return -EFAULT;
+				}
+				erase->addr = einfo32.start;
+				erase->len = einfo32.length;
 			}
-			erase->addr = einfo.start;
-			erase->len = einfo.length;
 			erase->mtd = mtd;
 			erase->callback = mtdchar_erase_callback;
 			erase->priv = (unsigned long)&waitq;
diff --git a/fs/compat_ioctl.c b/fs/compat_ioctl.c
index 3e87ce4..06d4e0c 100644
--- a/fs/compat_ioctl.c
+++ b/fs/compat_ioctl.c
@@ -2441,6 +2441,7 @@ COMPATIBLE_IOCTL(MEMGETREGIONCOUNT)
 COMPATIBLE_IOCTL(MEMGETREGIONINFO)
 COMPATIBLE_IOCTL(MEMGETBADBLOCK)
 COMPATIBLE_IOCTL(MEMSETBADBLOCK)
+COMPATIBLE_IOCTL(MEMERASE64)
 /* 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 b6595b3..2e32be1 100644
--- a/include/mtd/mtd-abi.h
+++ b/include/mtd/mtd-abi.h
@@ -12,6 +12,11 @@ struct erase_info_user {
 	__u32 length;
 };

+struct erase_info_user64 {
+	__u64 start;
+	__u64 length;
+};
+
 struct mtd_oob_buf {
 	__u32 start;
 	__u32 length;
@@ -95,6 +100,7 @@ struct otp_info {
 #define ECCGETLAYOUT		_IOR('M', 17, struct nand_ecclayout)
 #define ECCGETSTATS		_IOR('M', 18, struct mtd_ecc_stats)
 #define MTDFILEMODE		_IO('M', 19)
+#define MEMERASE64		_IOW('M', 20, struct erase_info_user64)

 /*
  * Obsolete legacy interface. Keep it in order not to break userspace
-- 
1.5.4.3

^ permalink raw reply related	[flat|nested] 5+ messages in thread

* Re: [PATCH 2/4] [MTD] Add MEMERASE64 ioctl for >4GiB devices
  2009-04-09  5:52 [PATCH 2/4] [MTD] Add MEMERASE64 ioctl for >4GiB devices Kevin Cernekee
@ 2009-04-10 22:06 ` Andrew Morton
  2009-04-17  7:30 ` Artem Bityutskiy
  1 sibling, 0 replies; 5+ messages in thread
From: Andrew Morton @ 2009-04-10 22:06 UTC (permalink / raw)
  To: Kevin Cernekee; +Cc: linux-mtd, dwmw2, linux-kernel

On Wed, 8 Apr 2009 22:52:28 -0700
Kevin Cernekee <kpc.mtd@gmail.com> wrote:

> Subject: [PATCH 2/4] [MTD] Add MEMERASE64 ioctl for >4GiB devices

triviata:

The text inside [] is usually removed by the patch recipient - the []
denotes transient information such as "patch" and the kernel version,
etc.

The preferred form for patch titles is

	subsytem-identifier: what-i-did-to-it

so this patch should have been

	mtd: add MEMERASE64 ioctl for >4GiB devices

> 
> @@ -427,20 +428,32 @@ static int mtd_ioctl(struct inode *inode, struct
> file *file,

Your email client is wordwrapping the text.

^ permalink raw reply	[flat|nested] 5+ messages in thread

* Re: [PATCH 2/4] [MTD] Add MEMERASE64 ioctl for >4GiB devices
  2009-04-09  5:52 [PATCH 2/4] [MTD] Add MEMERASE64 ioctl for >4GiB devices Kevin Cernekee
  2009-04-10 22:06 ` Andrew Morton
@ 2009-04-17  7:30 ` Artem Bityutskiy
  2009-04-18 16:21   ` Kevin Cernekee
  1 sibling, 1 reply; 5+ messages in thread
From: Artem Bityutskiy @ 2009-04-17  7:30 UTC (permalink / raw)
  To: Kevin Cernekee; +Cc: Linux MTD, David Woodhouse, linux-kernel@vger.kernel.org

On Wed, 2009-04-08 at 22:52 -0700, Kevin Cernekee wrote:
> New MEMERASE/MEMREADOOB/MEMWRITEOOB ioctls are needed in order to support
> 64-bit offsets into large NAND flash devices.
> 
> Signed-off-by: Kevin Cernekee <kpc.mtd@gmail.com>
> 

Kevin, are you going to re-send patches 2-4, taking into account
Arnd's and Andrew's suggestions?

-- 
Best regards,
Artem Bityutskiy (Битюцкий Артём)

^ permalink raw reply	[flat|nested] 5+ messages in thread

* Re: [PATCH 2/4] [MTD] Add MEMERASE64 ioctl for >4GiB devices
  2009-04-17  7:30 ` Artem Bityutskiy
@ 2009-04-18 16:21   ` Kevin Cernekee
  2009-04-20  6:47     ` Artem Bityutskiy
  0 siblings, 1 reply; 5+ messages in thread
From: Kevin Cernekee @ 2009-04-18 16:21 UTC (permalink / raw)
  To: dedekind; +Cc: Linux MTD, David Woodhouse, linux-kernel@vger.kernel.org

On Fri, Apr 17, 2009 at 12:30 AM, Artem Bityutskiy
<dedekind@infradead.org> wrote:
> Kevin, are you going to re-send patches 2-4, taking into account
> Arnd's and Andrew's suggestions?

For Arnd's suggestion, I posted a followup patch here:

http://lists.infradead.org/pipermail/linux-mtd/2009-April/025269.html

Andrew brought up two issues: [MTD] in the subject line, and
linewrapping.  I am assuming that he fixed these himself since he
pulled all five patches (originals + followup) into the -mm tree.

Should I fix and repost the set anyway?

Thanks.

^ permalink raw reply	[flat|nested] 5+ messages in thread

* Re: [PATCH 2/4] [MTD] Add MEMERASE64 ioctl for >4GiB devices
  2009-04-18 16:21   ` Kevin Cernekee
@ 2009-04-20  6:47     ` Artem Bityutskiy
  0 siblings, 0 replies; 5+ messages in thread
From: Artem Bityutskiy @ 2009-04-20  6:47 UTC (permalink / raw)
  To: Kevin Cernekee; +Cc: Linux MTD, David Woodhouse, linux-kernel@vger.kernel.org

On Sat, 2009-04-18 at 09:21 -0700, Kevin Cernekee wrote:
> On Fri, Apr 17, 2009 at 12:30 AM, Artem Bityutskiy
> <dedekind@infradead.org> wrote:
> > Kevin, are you going to re-send patches 2-4, taking into account
> > Arnd's and Andrew's suggestions?
> 
> For Arnd's suggestion, I posted a followup patch here:
> 
> http://lists.infradead.org/pipermail/linux-mtd/2009-April/025269.html
> 
> Andrew brought up two issues: [MTD] in the subject line, and
> linewrapping.  I am assuming that he fixed these himself since he
> pulled all five patches (originals + followup) into the -mm tree.
> 
> Should I fix and repost the set anyway?

No, I just missed that patch. Pushed your patches to l2-mtd-2.6.git.
Will ping dwmw2 about this. I also checked that your patches at
least do not break MTD for UBI/UBIFS. Thanks.

-- 
Best regards,
Artem Bityutskiy (Битюцкий Артём)

^ permalink raw reply	[flat|nested] 5+ messages in thread

end of thread, other threads:[~2009-04-20  6:47 UTC | newest]

Thread overview: 5+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2009-04-09  5:52 [PATCH 2/4] [MTD] Add MEMERASE64 ioctl for >4GiB devices Kevin Cernekee
2009-04-10 22:06 ` Andrew Morton
2009-04-17  7:30 ` Artem Bityutskiy
2009-04-18 16:21   ` Kevin Cernekee
2009-04-20  6:47     ` Artem Bityutskiy

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox