[PATCH] mtd/utils: sync with MTD ioctl interface rework to get rid of MEMGETOOBSEL/MEMSETOOBSEL

Todd Poynor tpoynor at mvista.com
Fri Dec 2 17:06:10 EST 2005


Hi Vitaly, my comments...

> +++ util/nanddump.c	2 Dec 2005 06:54:11 -0000
> @@ -163,6 +163,7 @@
>  	struct mtd_oob_buf oob = {0, 16, oobbuf};
>  	mtd_info_t meminfo;
>  	char pretty_buf[80];
> +	uint32_t oobavail;
>  
>   	process_options(argc, argv);
>  
> @@ -179,6 +180,13 @@
>  		exit (1);
>  	}
>  
> +	if (ioctl(fd, MEMGETOOBAVAIL, &oobavail) != 0) {
> +		perror("unable to get NAND oobavail");
> +		close(fd);
> +		exit(1);
> +	}

How about fall back to all 16/64/etc. avail?

For debugging purposes it can be nice to see the raw OOB, in case that 
can be shoehorned in here somehow.

> +++ util/nandwrite.c	2 Dec 2005 06:54:11 -0000

> -	       "  -j, --jffs2  	 	force jffs2 oob layout (legacy support)\n"
> -	       "  -y, --yaffs  	 	force yaffs oob layout (legacy support)\n"

Again, it may be good to keep a legacy mode around during the transition 
period.

>  		if (writeoob) {
>  			/* Read OOB data from input file, exit on failure */
> -			if ((cnt = read(ifd, oobreadbuf, meminfo.oobsize)) != meminfo.oobsize) {
> +			if ((cnt = read(ifd, oobreadbuf, oobavail)) != oobavail) {

This requires the input file to be tailored to the oobavail of a 
specific destination device, reducing the benefit of autoplacement.  It 
may be best to continue to pad input files oob data to the full oobsize, 
much like the data portion is handled.

> +				memcpy(oobbuf, oobreadbuf, oobavail);

No need for oobreadbuf and copy if no OOB layout processing done anymore?


-- 
Todd




More information about the linux-mtd mailing list