[MTD] Disconnect struct mtd_info from ABI

Linux-MTD Mailing List linux-mtd at lists.infradead.org
Tue May 30 09:59:02 EDT 2006


Commit:     73c619ea0e49c9306afa7ea53c3362fbc56ffd70
Parent:     92cbfdcc3661d7670b01b92b89811cd3a2412297
Author:     Joern Engel <joern at wh.fh-wedel.de>
AuthorDate: Tue May 30 14:25:35 2006 +0200
Commit:     Joern Engel <joern at wh.fh-wedel.de>
CommitDate: Tue May 30 14:25:35 2006 +0200

    [MTD] Disconnect struct mtd_info from ABI
    
    mtdchar.c direcly copied part of struct mtd_info to userspace, thereby
    implicitly making it part of the ABI.  With this patch, struct
    mtd_info is independent of the ABI and can have its fields removed,
    reordered, etc.
    
    Signed-off-by: Joern Engel <joern at wh.fh-wedel.de>

 drivers/mtd/mtdchar.c |   11 ++++++++++-
 1 files changed, 10 insertions(+), 1 deletions(-)

diff --git a/drivers/mtd/mtdchar.c b/drivers/mtd/mtdchar.c
index fdc535b..5dd0b8d 100644
--- a/drivers/mtd/mtdchar.c
+++ b/drivers/mtd/mtdchar.c
@@ -380,6 +380,7 @@ static int mtd_ioctl(struct inode *inode
 	void __user *argp = (void __user *)arg;
 	int ret = 0;
 	u_long size;
+	struct mtd_info_user info;
 
 	DEBUG(MTD_DEBUG_LEVEL0, "MTD_ioctl\n");
 
@@ -415,7 +416,15 @@ static int mtd_ioctl(struct inode *inode
 	}
 
 	case MEMGETINFO:
-		if (copy_to_user(argp, mtd, sizeof(struct mtd_info_user)))
+		info.type	= mtd->type;
+		info.flags	= mtd->flags;
+		info.size	= mtd->size;
+		info.erasesize	= mtd->erasesize;
+		info.writesize	= mtd->writesize;
+		info.oobsize	= mtd->oobsize;
+		info.ecctype	= mtd->ecctype;
+		info.eccsize	= mtd->eccsize;
+		if (copy_to_user(argp, &info, sizeof(struct mtd_info_user)))
 			return -EFAULT;
 		break;
 



More information about the linux-mtd-cvs mailing list