Patchwork [MTD-UTILS] Add support for 4KB page flash devices

login
register
mail settings
Submitter AYYANARPONNUSAMY GANGHEYAMOORTHY
Date Sept. 19, 2008, 12:41 p.m.
Message ID <33142758.53091221828088797.JavaMail.weblogic@epml16>
Download mbox | patch
Permalink /patch/622/
State Superseded
Headers show

Comments

AYYANARPONNUSAMY GANGHEYAMOORTHY - Sept. 19, 2008, 12:41 p.m.
We can now use these utilities on 4KB devices.

Signed-off-by: Rohit Hagargundgi <h.rohit@samsung.com>
Kyungmin Park - Sept. 22, 2008, 6:22 a.m.
Hi,

On Fri, Sep 19, 2008 at 9:41 PM, AYYANARPONNUSAMY GANGHEYAMOORTHY
<moorthy.apg@samsung.com> wrote:
> We can now use these utilities on 4KB devices.
>
> Signed-off-by: Rohit Hagargundgi <h.rohit@samsung.com>
> ---
> --- a/flash_otp_write.c 2008-06-27 21:51:28.000000000 +0530
> +++ b/flash_otp_write.c 2008-07-01 16:04:12.000000000 +0530
> @@ -18,7 +18,7 @@ int main(int argc,char *argv[])
>        int fd, val, ret, size, wrote, len;
>        mtd_info_t mtdInfo;
>        off_t offset;
> -       char *p, buf[2048];
> +       char *p, buf[4096];
>

Is it no problem the stack overflow in application?
How about to use malloc & free?

Thank you,
Kyungmin Park
Sergei Shtylyov - Sept. 22, 2008, 9:19 a.m.
Hello.

Kyungmin Park wrote:

>> We can now use these utilities on 4KB devices.
>>
>> Signed-off-by: Rohit Hagargundgi <h.rohit@samsung.com>
>> ---
>> --- a/flash_otp_write.c 2008-06-27 21:51:28.000000000 +0530
>> +++ b/flash_otp_write.c 2008-07-01 16:04:12.000000000 +0530
>> @@ -18,7 +18,7 @@ int main(int argc,char *argv[])
>>        int fd, val, ret, size, wrote, len;
>>        mtd_info_t mtdInfo;
>>        off_t offset;
>> -       char *p, buf[2048];
>> +       char *p, buf[4096];
>>
>>     
>
> Is it no problem the stack overflow in application?
> How about to use malloc & free?
>   

   Come on, it's only an extra page of stack for a non-recursive 
function -- this shouldn't pose any danger.

WBR, Sergei

Patch

--- a/flash_otp_write.c	2008-06-27 21:51:28.000000000 +0530
+++ b/flash_otp_write.c	2008-07-01 16:04:12.000000000 +0530
@@ -18,7 +18,7 @@  int main(int argc,char *argv[])
 	int fd, val, ret, size, wrote, len;
 	mtd_info_t mtdInfo;
 	off_t offset;
-	char *p, buf[2048];
+	char *p, buf[4096];
 
 	if (argc != 4 || strcmp(argv[1], "-u")) {
 		fprintf(stderr, "Usage: %s -u <device> <offset>\n", argv[0]);
--- a/include/mtd/mtd-abi.h	2008-06-27 21:51:28.000000000 +0530
+++ b/include/mtd/mtd-abi.h	2008-06-30 18:51:39.000000000 +0530
@@ -104,7 +104,7 @@  struct nand_oobinfo {
 	uint32_t useecc;
 	uint32_t eccbytes;
 	uint32_t oobfree[8][2];
-	uint32_t eccpos[32];
+	uint32_t eccpos[128];
 };
 
 struct nand_oobfree {
@@ -119,7 +119,7 @@  struct nand_oobfree {
  */
 struct nand_ecclayout {
 	uint32_t eccbytes;
-	uint32_t eccpos[64];
+	uint32_t eccpos[128];
 	uint32_t oobavail;
 	struct nand_oobfree oobfree[MTD_MAX_OOBFREE_ENTRIES];
 };
--- a/flashcp.c	2008-06-27 21:51:28.000000000 +0530
+++ b/flashcp.c	2008-07-02 14:49:21.000000000 +0530
@@ -61,7 +62,7 @@  typedef int bool;
 #define PERCENTAGE(x,total) (((x) * 100) / (total))
 
 /* size of read/write buffer */
-#define BUFSIZE (10 * 1024)
+#define BUFSIZE (10 * 4096)
 
 /* cmd-line flags */
 #define FLAG_NONE		0x00