All of lore.kernel.org
 help / color / mirror / Atom feed
From: Kenneth Johansson <kenneth.johansson@etx.ericsson.se>
To: andersen@codepoet.org
Cc: David Woodhouse <dwmw2@infradead.org>,
	Mtd <linux-mtd@lists.infradead.org>
Subject: Re: mkfs.jffs2.c rework
Date: 25 Nov 2002 13:39:15 +0100	[thread overview]
Message-ID: <1038227955.929.30.camel@spawn> (raw)
In-Reply-To: <20021125122110.GC18046@codepoet.org>

[-- Attachment #1: Type: text/plain, Size: 461 bytes --]

On Mon, 2002-11-25 at 13:21, Erik Andersen wrote:
> I've got these changes done.  Shall I check it in?  Adding
> support for cleanmarkers can be done soon (after I get a chance

Here is a patch I did for eraseall to add cleanmarker. Big endian system
only.


-- 
Kenneth Johansson	
Ericsson AB                       Tel: +46 8 404 71 83
Borgafjordsgatan 9                Fax: +46 8 404 72 72
164 80 Stockholm                  kenneth.johansson@etx.ericsson.se


[-- Attachment #2: eraseall.diff --]
[-- Type: text/plain, Size: 2743 bytes --]

--- /home/innkeon/src/mtd/mtd/util/eraseall.c	Wed Apr 25 09:11:19 2001
+++ eraseall.c	Mon Oct 14 14:50:43 2002
@@ -16,7 +16,7 @@
    along with this program; if not, write to the Free Software
    Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA  
 
-   $Id: eraseall.c,v 1.7 2001/04/25 07:11:19 ollie Exp $
+   $Id: eraseall.c,v 1.1 2002/10/14 12:50:43 innkeon Exp $
 */
 #include <unistd.h>
 #include <stdlib.h>
@@ -32,8 +32,10 @@
 #include <linux/mtd/mtd.h>
 
 #define PROGRAM "eraseall"
-#define VERSION "0.1.0"
+#define VERSION "0.2.0"
 
+static char cleanmarker[]={0x19,0x85,0x20,0x03,0x00,0x00,0x00,0x0c,0xf0,0x60,0xdc,0x98};
+static int jffs2_format;
 static const char *exe_name;
 static const char *mtd_device;
 static int quiet; /* true -- don't output progress */
@@ -68,7 +70,7 @@
 	erase.start += meminfo.erasesize) {
        
        if( !quiet ) {
-	   printf( "\rErasing %ld Kibyte @ %lx -- %2ld %% complete.", 
+	   printf( "\rErasing %d Kibyte @ %x -- %2d %% complete.", 
 		   meminfo.erasesize/1024, erase.start,
 		   erase.start*100/meminfo.size );
        }
@@ -80,9 +82,15 @@
 			mtd_device, strerror( errno) );
 	       //exit( 1 );
        }
+       if(jffs2_format){
+	       if(erase.start != lseek(fd,erase.start,SEEK_SET))
+		       fprintf( stderr, "Could not seek to pos %x on %s",erase.start,mtd_device);
+	       write(fd,cleanmarker,sizeof(cleanmarker));
+       }
+
    }
    if( !quiet ) {
-       printf( "\rErased %ld Kibyte @ %lx -- 100%% complete.       \n",
+       printf( "\rErased %d Kibyte @ %lx -- 100%% complete.       \n",
 	       meminfo.size/1024, 0L );
    }
    
@@ -98,10 +106,11 @@
 
     for(;;) {
         int option_index = 0;
-        static const char* short_options="q";
+        static const char* short_options="qf";
         static const struct option long_options[] = {
             {"help", no_argument, 0, 0},
             {"version", no_argument, 0, 0},
+	    {"format", no_argument, 0, 'f'},
 	    {"quiet", no_argument, 0, 'q'},
 	    {"silent", no_argument, 0, 'q'},
 
@@ -126,8 +135,11 @@
             }
             break;
 	case 'q' :
-	    quiet=1;
+	   quiet=1;
 	    break;
+	case 'f' :
+	   jffs2_format=1;
+	   break;
         case '?' :
             error=1;
             break;
@@ -151,6 +163,7 @@
     printf( "Usage: %s [OPTION] MTD_DEVICE\n"
             "Erases all of the specified MTD device.\n"
             "\n"
+            "  -f, --format   write cleanmarker for jffs2\n"
             "  -q, --quiet    don't display progress messages\n"
 	    "      --silent   same as --quiet\n"
             "      --help     display this help and exit\n"

  reply	other threads:[~2002-11-25 12:08 UTC|newest]

Thread overview: 10+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2002-11-25 11:18 mkfs.jffs2.c rework Erik Andersen
2002-11-25 11:49 ` David Woodhouse
2002-11-25 12:06   ` Erik Andersen
2002-11-25 12:12     ` David Woodhouse
2002-11-25 12:21   ` Erik Andersen
2002-11-25 12:39     ` Kenneth Johansson [this message]
2002-11-25 13:50   ` johan.adolfsson
2002-11-25 16:18     ` Joakim Tjernlund
2002-11-25 16:20       ` David Woodhouse
2002-11-25 16:33         ` Joakim Tjernlund

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=1038227955.929.30.camel@spawn \
    --to=kenneth.johansson@etx.ericsson.se \
    --cc=andersen@codepoet.org \
    --cc=dwmw2@infradead.org \
    --cc=linux-mtd@lists.infradead.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.