mtd/util nanddump.c,1.27,1.28

gleixner at infradead.org gleixner at infradead.org
Thu Mar 17 07:10:33 EST 2005


Update of /home/cvs/mtd/util
In directory phoenix.infradead.org:/tmp/cvs-serv24598

Modified Files:
	nanddump.c 
Log Message:
Add an option to omit bad blocks from the dump

Index: nanddump.c
===================================================================
RCS file: /home/cvs/mtd/util/nanddump.c,v
retrieving revision 1.27
retrieving revision 1.28
diff -u -r1.27 -r1.28
--- nanddump.c	17 Feb 2005 14:55:07 -0000	1.27
+++ nanddump.c	17 Mar 2005 12:10:30 -0000	1.28
@@ -44,6 +44,7 @@
 	       "-i         --ignoreerrors       ignore errors\n"
 	       "-l length  --length=length      length\n"
 	       "-o         --omitoob            omit oob data\n"
+	       "-b         --omitbad            omit bad blocks from the dump\n"
 	       "-p         --prettyprint        print nice (hexdump)\n"
 	       "-s addr    --startaddress=addr  start address\n");
 	exit(0);
@@ -71,7 +72,7 @@
 unsigned long	length;		// dump length
 char    *mtddev;		// mtd device name
 char    *dumpfile;		// dump file name
-
+int	omitbad;
 
 void process_options (int argc, char *argv[])
 {
@@ -79,13 +80,14 @@
 
 	for (;;) {
 		int option_index = 0;
-		static const char *short_options = "s:f:il:op";
+		static const char *short_options = "bs:f:il:op";
 		static const struct option long_options[] = {
 			{"help", no_argument, 0, 0},
 			{"version", no_argument, 0, 0},
 			{"ignoreerrors", no_argument, 0, 'i'},
 			{"prettyprint", no_argument, 0, 'p'},
 			{"omitoob", no_argument, 0, 'o'},
+			{"omitbad", no_argument, 0, 'b'},
 			{"startaddress", required_argument, 0, 's'},
 			{"length", required_argument, 0, 'l'},
 			{0, 0, 0, 0},
@@ -108,6 +110,9 @@
 				break;
 			}
 			break;
+		case 'b':
+			omitbad = 1;
+			break;
 		case 's':
 			start_addr = atol(optarg);
 			break;
@@ -220,6 +225,8 @@
 		}
 
 		if (badblock) {
+			if (omitbad)
+				continue;
 			memset (readbuf, 0xff, bs);
 		} else {
 			/* Read page data and exit on failure */





More information about the linux-mtd-cvs mailing list