mtd/util Makefile, 1.59, 1.60 compr.c, 1.8, 1.9 compr.h, 1.6,
1.7 compr_rtime.c, 1.3, 1.4 compr_zlib.c, 1.3, 1.4 crc32.h,
1.5, 1.6 doc_loadbios.c, 1.8, 1.9 docfdisk.c, 1.8,
1.9 flash_erase.c, 1.12, 1.13 flash_eraseall.c, 1.23,
1.24 flash_info.c, 1.6, 1.7 flash_otp_dump.c, 1.1,
1.2 flash_otp_info.c, 1.1, 1.2 flash_otp_lock.c, 1.1,
1.2 flash_otp_write.c, 1.1, 1.2 flashcp.c, 1.5,
1.6 ftl_check.c, 1.5, 1.6 ftl_format.c, 1.8, 1.9 jffs-dump.c,
1.2, 1.3 jffs2dump.c, 1.11, 1.12 jffs2reader.c, 1.5,
1.6 mkfs.ffs2.c, 1.4, 1.5 mkfs.jffs.c, 1.14, 1.15 mkfs.jffs2.c,
1.46, 1.47 nanddump.c, 1.28, 1.29 nandwrite.c, 1.31,
1.32 nftl_format.c, 1.23, 1.24 nftldump.c, 1.16,
1.17 rfddump.c, 1.2, 1.3 rfdformat.c, 1.2, 1.3 summary.h, 1.5,
1.6 sumtool.c, 1.7, 1.8
gleixner at infradead.org
gleixner at infradead.org
Mon Nov 7 06:15:54 EST 2005
- Previous message: mtd/fs/ffs2 ffs2_fs.h, 1.1, 1.2 ffs2_fs_i.h, 1.1, 1.2 ffs2_fs_sb.h,
1.1, 1.2 io.c, 1.1, 1.2 makefile, 1.1, 1.2 super.c, 1.1, 1.2
- Next message: mtd/html/doc Makefile,1.2,1.3
- Messages sorted by:
[ date ]
[ thread ]
[ subject ]
[ author ]
Update of /home/cvs/mtd/util
In directory phoenix.infradead.org:/tmp/cvs-serv29274/util
Modified Files:
Makefile compr.c compr.h compr_rtime.c compr_zlib.c crc32.h
doc_loadbios.c docfdisk.c flash_erase.c flash_eraseall.c
flash_info.c flash_otp_dump.c flash_otp_info.c
flash_otp_lock.c flash_otp_write.c flashcp.c ftl_check.c
ftl_format.c jffs-dump.c jffs2dump.c jffs2reader.c mkfs.ffs2.c
mkfs.jffs.c mkfs.jffs2.c nanddump.c nandwrite.c nftl_format.c
nftldump.c rfddump.c rfdformat.c summary.h sumtool.c
Log Message:
[MTD / JFFS2] Clean up trailing white spaces
Index: Makefile
===================================================================
RCS file: /home/cvs/mtd/util/Makefile,v
retrieving revision 1.59
retrieving revision 1.60
diff -u -r1.59 -r1.60
--- Makefile 7 Sep 2005 08:34:57 -0000 1.59
+++ Makefile 7 Nov 2005 11:15:09 -0000 1.60
@@ -16,9 +16,9 @@
jffs2dump \
nftldump nftl_format docfdisk \
rfddump rfdformat \
- sumtool #jffs2reader
+ sumtool #jffs2reader
-SYMLINKS =
+SYMLINKS =
%: %.o
$(CC) $(LDFLAGS) -g -o $@ $^
@@ -30,7 +30,7 @@
all: $(TARGETS)
-IGNORE=${wildcard .*.c.dep}
+IGNORE=${wildcard .*.c.dep}
-include ${IGNORE}
clean:
@@ -46,7 +46,7 @@
$(CC) $(LDFLAGS) -o $@ $^
jffs2reader: jffs2reader.o
- $(CC) $(LDFLAGS) -o $@ $^ -lz
+ $(CC) $(LDFLAGS) -o $@ $^ -lz
jffs2dump: jffs2dump.o crc32.o
$(CC) $(LDFLAGS) -o $@ $^
Index: compr.c
===================================================================
RCS file: /home/cvs/mtd/util/compr.c,v
retrieving revision 1.8
retrieving revision 1.9
diff -u -r1.8 -r1.9
--- compr.c 26 Jul 2005 13:07:02 -0000 1.8
+++ compr.c 7 Nov 2005 11:15:09 -0000 1.9
@@ -73,7 +73,7 @@
/* Actual compression mode */
static int jffs2_compression_mode = JFFS2_COMPR_MODE_PRIORITY;
-void jffs2_set_compression_mode(int mode)
+void jffs2_set_compression_mode(int mode)
{
jffs2_compression_mode = mode;
}
@@ -111,7 +111,7 @@
#define JFFS2_BUFFER_FILL 0x55
-/* Called before compression (if compression_check is setted) to prepare
+/* Called before compression (if compression_check is setted) to prepare
the buffer for buffer overflow test */
static void jffs2_decompression_test_prepare(unsigned char *buf, int size)
{
@@ -129,7 +129,7 @@
for (i=buf_size;i>cdatalen;i--) {
if (output_buf[i]!=JFFS2_BUFFER_FILL) {
fprintf(stderr,"COMPR_ERROR: buffer overflow at %s. "
- "(bs=%d csize=%d b[%d]=%d)\n", compr->name,
+ "(bs=%d csize=%d b[%d]=%d)\n", compr->name,
buf_size, cdatalen, i, (int)(output_buf[i]));
jffs2_error_cnt++;
return;
@@ -162,7 +162,7 @@
jffs2_error_cnt++;
break;
}
- }
+ }
}
}
@@ -176,12 +176,12 @@
* data.
*
* Returns: Lower byte to be stored with data indicating compression type used.
- * Zero is used to show that the data could not be compressed - the
+ * Zero is used to show that the data could not be compressed - the
* compressed version was actually larger than the original.
* Upper byte will be used later. (soon)
*
* If the cdata buffer isn't large enough to hold all the uncompressed data,
- * jffs2_compress should compress as much as will fit, and should set
+ * jffs2_compress should compress as much as will fit, and should set
* *datalen accordingly to show the amount of data which were compressed.
*/
uint16_t jffs2_compress( unsigned char *data_in, unsigned char **cpage_out,
@@ -383,7 +383,7 @@
}
act_buf += sprintf(act_buf,"\nCompressors:\n");
act_buf += sprintf(act_buf,"%10s ","none");
- act_buf += sprintf(act_buf,"compr: %d blocks (%d) decompr: %d blocks\n", none_stat_compr_blocks,
+ act_buf += sprintf(act_buf,"compr: %d blocks (%d) decompr: %d blocks\n", none_stat_compr_blocks,
none_stat_compr_size, none_stat_decompr_blocks);
list_for_each_entry(this, &jffs2_compressor_list, list) {
act_buf += sprintf(act_buf,"%10s (prio:%d) ",this->name,this->priority);
@@ -391,15 +391,15 @@
act_buf += sprintf(act_buf,"- ");
else
act_buf += sprintf(act_buf,"+ ");
- act_buf += sprintf(act_buf,"compr: %d blocks (%d/%d) decompr: %d blocks ", this->stat_compr_blocks,
- this->stat_compr_new_size, this->stat_compr_orig_size,
+ act_buf += sprintf(act_buf,"compr: %d blocks (%d/%d) decompr: %d blocks ", this->stat_compr_blocks,
+ this->stat_compr_new_size, this->stat_compr_orig_size,
this->stat_decompr_blocks);
act_buf += sprintf(act_buf,"\n");
}
return buf;
}
-int jffs2_set_compression_mode_name(const char *name)
+int jffs2_set_compression_mode_name(const char *name)
{
if (!strcmp("none",name)) {
jffs2_compression_mode = JFFS2_COMPR_MODE_NONE;
Index: compr.h
===================================================================
RCS file: /home/cvs/mtd/util/compr.h,v
retrieving revision 1.6
retrieving revision 1.7
diff -u -r1.6 -r1.7
--- compr.h 26 Jul 2005 13:07:02 -0000 1.6
+++ compr.h 7 Nov 2005 11:15:09 -0000 1.7
@@ -4,7 +4,7 @@
* Copyright (C) 2004 Ferenc Havasi <havasi at inf.u-szeged.hu>,
* University of Szeged, Hungary
*
- * For licensing information, see the file 'LICENCE' in the
+ * For licensing information, see the file 'LICENCE' in the
* jffs2 directory.
*
* $Id$
Index: compr_rtime.c
===================================================================
RCS file: /home/cvs/mtd/util/compr_rtime.c,v
retrieving revision 1.3
retrieving revision 1.4
diff -u -r1.3 -r1.4
--- compr_rtime.c 23 Jun 2004 15:00:14 -0000 1.3
+++ compr_rtime.c 7 Nov 2005 11:15:09 -0000 1.4
@@ -26,26 +26,26 @@
#include "compr.h"
/* _compress returns the compressed size, -1 if bigger */
-static int jffs2_rtime_compress(unsigned char *data_in, unsigned char *cpage_out,
+static int jffs2_rtime_compress(unsigned char *data_in, unsigned char *cpage_out,
uint32_t *sourcelen, uint32_t *dstlen, void *model)
{
short positions[256];
int outpos = 0;
int pos=0;
- memset(positions,0,sizeof(positions));
-
+ memset(positions,0,sizeof(positions));
+
while (pos < (*sourcelen) && outpos <= (*dstlen)-2) {
int backpos, runlen=0;
unsigned char value;
-
+
value = data_in[pos];
cpage_out[outpos++] = data_in[pos++];
-
+
backpos = positions[value];
positions[value]=pos;
-
+
while ((backpos < pos) && (pos < (*sourcelen)) &&
(data_in[pos]==data_in[backpos++]) && (runlen<255)) {
pos++;
@@ -58,12 +58,12 @@
/* We failed */
return -1;
}
-
+
/* Tell the caller how much we managed to compress, and how much space it took */
*sourcelen = pos;
*dstlen = outpos;
return 0;
-}
+}
static int jffs2_rtime_decompress(unsigned char *data_in, unsigned char *cpage_out,
@@ -72,19 +72,19 @@
short positions[256];
int outpos = 0;
int pos=0;
-
- memset(positions,0,sizeof(positions));
-
+
+ memset(positions,0,sizeof(positions));
+
while (outpos<destlen) {
unsigned char value;
int backoffs;
int repeat;
-
+
value = data_in[pos++];
cpage_out[outpos++] = value; /* first the verbatim copied byte */
repeat = data_in[pos++];
backoffs = positions[value];
-
+
positions[value]=outpos;
if (repeat) {
if (backoffs + repeat >= outpos) {
@@ -94,12 +94,12 @@
}
} else {
memcpy(&cpage_out[outpos],&cpage_out[backoffs],repeat);
- outpos+=repeat;
+ outpos+=repeat;
}
}
}
return 0;
-}
+}
static struct jffs2_compressor jffs2_rtime_comp = {
Index: compr_zlib.c
===================================================================
RCS file: /home/cvs/mtd/util/compr_zlib.c,v
retrieving revision 1.3
retrieving revision 1.4
diff -u -r1.3 -r1.4
--- compr_zlib.c 23 Jun 2004 15:00:14 -0000 1.3
+++ compr_zlib.c 7 Nov 2005 11:15:09 -0000 1.4
@@ -44,16 +44,16 @@
#define min(x,y) ((x)<(y)?(x):(y))
- /* Plan: call deflate() with avail_in == *sourcelen,
- avail_out = *dstlen - 12 and flush == Z_FINISH.
+ /* Plan: call deflate() with avail_in == *sourcelen,
+ avail_out = *dstlen - 12 and flush == Z_FINISH.
If it doesn't manage to finish, call it again with
avail_in == 0 and avail_out set to the remaining 12
- bytes for it to clean up.
+ bytes for it to clean up.
Q: Is 12 bytes sufficient?
*/
#define STREAM_END_SPACE 12
-int jffs2_zlib_compress(unsigned char *data_in, unsigned char *cpage_out,
+int jffs2_zlib_compress(unsigned char *data_in, unsigned char *cpage_out,
uint32_t *sourcelen, uint32_t *dstlen, void *model)
{
z_stream strm;
@@ -70,7 +70,7 @@
}
strm.next_in = data_in;
strm.total_in = 0;
-
+
strm.next_out = cpage_out;
strm.total_out = 0;
@@ -116,7 +116,7 @@
strm.next_in = data_in;
strm.avail_in = srclen;
strm.total_in = 0;
-
+
strm.next_out = cpage_out;
strm.avail_out = destlen;
strm.total_out = 0;
Index: crc32.h
===================================================================
RCS file: /home/cvs/mtd/util/crc32.h,v
retrieving revision 1.5
retrieving revision 1.6
diff -u -r1.5 -r1.6
--- crc32.h 24 Feb 2004 17:40:51 -0000 1.5
+++ crc32.h 7 Nov 2005 11:15:09 -0000 1.6
@@ -9,7 +9,7 @@
/* Return a 32-bit CRC of the contents of the buffer. */
-static inline uint32_t
+static inline uint32_t
crc32(uint32_t val, const void *ss, int len)
{
const unsigned char *s = ss;
Index: doc_loadbios.c
===================================================================
RCS file: /home/cvs/mtd/util/doc_loadbios.c,v
retrieving revision 1.8
retrieving revision 1.9
diff -u -r1.8 -r1.9
--- doc_loadbios.c 5 May 2004 11:57:55 -0000 1.8
+++ doc_loadbios.c 7 Nov 2005 11:15:10 -0000 1.9
@@ -28,38 +28,38 @@
" the source firmware file and the offset\n");
return 1;
}
-
+
// Open and size the device
if ((ofd = open(argv[1],O_RDWR)) < 0) {
perror("Open flash device");
return 1;
}
-
+
if ((ifd = open(argv[2], O_RDONLY)) < 0) {
perror("Open firmware file\n");
close(ofd);
return 1;
}
-
+
if (fstat(ifd, &statbuf) != 0) {
perror("Stat firmware file");
goto error;
}
-
+
#if 0
if (statbuf.st_size > 65536) {
printf("Firmware too large (%ld bytes)\n",statbuf.st_size);
goto error;
}
-#endif
-
+#endif
+
if (ioctl(ofd,MEMGETINFO,&meminfo) != 0) {
perror("ioctl(MEMGETINFO)");
goto error;
}
iplsize = (ipltailsize = 0);
- if (argc >= 4) {
+ if (argc >= 4) {
/* DoC Millennium has IPL in the first 1K of flash memory */
/* You may want to specify the offset 1024 to store
the firmware next to IPL. */
@@ -91,14 +91,14 @@
erase.length = meminfo.erasesize;
- for (ofs = iplsize - ipltailsize ;
- ofs < iplsize + statbuf.st_size ;
+ for (ofs = iplsize - ipltailsize ;
+ ofs < iplsize + statbuf.st_size ;
ofs += meminfo.erasesize) {
erase.start = ofs;
printf("Performing Flash Erase of length %lu at offset %lu\n",
(long unsigned) erase.length, (long unsigned) erase.start);
-
- if (ioctl(ofd,MEMERASE,&erase) != 0) {
+
+ if (ioctl(ofd,MEMERASE,&erase) != 0) {
perror("ioctl(MEMERASE)");
goto error;
}
@@ -120,7 +120,7 @@
}
}
- printf("Writing the firmware of length %lu at %lu... ",
+ printf("Writing the firmware of length %lu at %lu... ",
(unsigned long) statbuf.st_size,
(unsigned long) iplsize);
do {
Index: docfdisk.c
===================================================================
RCS file: /home/cvs/mtd/util/docfdisk.c,v
retrieving revision 1.8
retrieving revision 1.9
diff -u -r1.8 -r1.9
--- docfdisk.c 28 Jul 2004 14:32:33 -0000 1.8
+++ docfdisk.c 7 Nov 2005 11:15:10 -0000 1.9
@@ -1,4 +1,4 @@
-/*
+/*
* docfdisk.c: Modify INFTL partition tables
*
*
Index: flash_erase.c
===================================================================
RCS file: /home/cvs/mtd/util/flash_erase.c,v
retrieving revision 1.12
retrieving revision 1.13
diff -u -r1.12 -r1.13
--- flash_erase.c 5 May 2004 21:28:36 -0000 1.12
+++ flash_erase.c 7 Nov 2005 11:15:10 -0000 1.13
@@ -1,4 +1,4 @@
-/*
+/*
* flash_erase.c -- erase parts of a MTD device
*/
@@ -120,7 +120,7 @@
}
if (ioctl(Fd,MEMERASE,&erase) != 0)
- {
+ {
perror("\nMTD Erase failure");
close(Fd);
return 8;
@@ -139,7 +139,7 @@
int start;
int count;
int unlock;
- int res = 0;
+ int res = 0;
if (1 >= argc)
{
@@ -183,6 +183,6 @@
res = region_erase(Fd, start, count, unlock, regcount);
}
}
-
+
return res;
}
Index: flash_eraseall.c
===================================================================
RCS file: /home/cvs/mtd/util/flash_eraseall.c,v
retrieving revision 1.23
retrieving revision 1.24
diff -u -r1.23 -r1.24
--- flash_eraseall.c 4 Nov 2005 08:06:27 -0000 1.23
+++ flash_eraseall.c 7 Nov 2005 11:15:10 -0000 1.24
@@ -1,6 +1,6 @@
/* eraseall.c -- erase the whole of a MTD device
- Copyright (C) 2000 Arcom Control System Ltd
+ Copyright (C) 2000 Arcom Control System Ltd
Renamed to flash_eraseall.c
@@ -8,15 +8,15 @@
it under the terms of the GNU General Public License as published by
the Free Software Foundation; either version 2 of the License, or
(at your option) any later version.
-
+
This program is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
GNU General Public License for more details.
-
+
You should have received a copy of the GNU General Public License
along with this program; if not, write to the Free Software
- Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA
+ Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA
$Id$
*/
@@ -101,7 +101,7 @@
fprintf(stderr, "%s: %s: unable to get NAND oobinfo\n", exe_name, mtd_device);
exit(1);
}
-
+
/* Check for autoplacement */
if (oobinfo.useecc == MTD_NANDECC_AUTOPLACE) {
/* Get the position of the free bytes */
@@ -163,7 +163,7 @@
printf
("\rErasing %d Kibyte @ %x -- %2llu %% complete.",
meminfo.erasesize / 1024, erase.start,
- (unsigned long long)
+ (unsigned long long)
erase.start * 100 / meminfo.size);
}
fflush(stdout);
@@ -172,11 +172,11 @@
fprintf(stderr, "\n%s: %s: MTD Erase failure: %s\n", exe_name, mtd_device, strerror(errno));
continue;
}
-
+
/* format for JFFS2 ? */
- if (!jffs2)
+ if (!jffs2)
continue;
-
+
/* write cleanmarker */
if (isNAND) {
struct mtd_oob_buf oob;
@@ -200,7 +200,7 @@
if (lseek (fd, erase.start, SEEK_SET) < 0) {
fprintf(stderr, "\n%s: %s: MTD lseek failure: %s\n", exe_name, mtd_device, strerror(errno));
continue;
- }
+ }
if (write (fd , &ebh, sizeof (ebh)) != sizeof (ebh)) {
fprintf(stderr, "\n%s: %s: MTD write failure: %s\n", exe_name, mtd_device, strerror(errno));
continue;
Index: flash_info.c
===================================================================
RCS file: /home/cvs/mtd/util/flash_info.c,v
retrieving revision 1.6
retrieving revision 1.7
diff -u -r1.6 -r1.7
--- flash_info.c 5 May 2004 21:28:36 -0000 1.6
+++ flash_info.c 7 Nov 2005 11:15:10 -0000 1.7
@@ -1,4 +1,4 @@
-/*
+/*
* flash_info.c -- print info about a MTD device
*/
@@ -22,7 +22,7 @@
fprintf(stderr,"Usage: flash_info device\n");
return 16;
}
-
+
// Open and size the device
if ((Fd = open(argv[1],O_RDONLY)) < 0)
{
Index: flash_otp_dump.c
===================================================================
RCS file: /home/cvs/mtd/util/flash_otp_dump.c,v
retrieving revision 1.1
retrieving revision 1.2
diff -u -r1.1 -r1.2
--- flash_otp_dump.c 8 Feb 2005 17:45:53 -0000 1.1
+++ flash_otp_dump.c 7 Nov 2005 11:15:10 -0000 1.2
@@ -1,4 +1,4 @@
-/*
+/*
* flash_otp_dump.c -- display One-Time-Programm data
*/
@@ -20,7 +20,7 @@
fprintf(stderr,"Usage: %s [ -f | -u ] <device>\n", argv[0]);
return EINVAL;
}
-
+
fd = open(argv[2], O_RDONLY);
if (fd < 0) {
perror(argv[2]);
Index: flash_otp_info.c
===================================================================
RCS file: /home/cvs/mtd/util/flash_otp_info.c,v
retrieving revision 1.1
retrieving revision 1.2
diff -u -r1.1 -r1.2
--- flash_otp_info.c 8 Feb 2005 17:45:53 -0000 1.1
+++ flash_otp_info.c 7 Nov 2005 11:15:10 -0000 1.2
@@ -1,4 +1,4 @@
-/*
+/*
* flash_otp_info.c -- print info about One-Time-Programm data
*/
@@ -19,7 +19,7 @@
fprintf(stderr,"Usage: %s [ -f | -u ] <device>\n", argv[0]);
return EINVAL;
}
-
+
fd = open(argv[2], O_RDONLY);
if (fd < 0) {
perror(argv[2]);
Index: flash_otp_lock.c
===================================================================
RCS file: /home/cvs/mtd/util/flash_otp_lock.c,v
retrieving revision 1.1
retrieving revision 1.2
diff -u -r1.1 -r1.2
--- flash_otp_lock.c 17 Feb 2005 20:38:36 -0000 1.1
+++ flash_otp_lock.c 7 Nov 2005 11:15:10 -0000 1.2
@@ -1,4 +1,4 @@
-/*
+/*
* flash_otp_lock.c -- lock area of One-Time-Program data
*/
@@ -23,7 +23,7 @@
fprintf(stderr, "CAUTION! ONCE LOCKED, OTP REGIONS CAN'T BE UNLOCKED!\n");
return EINVAL;
}
-
+
fd = open(argv[2], O_WRONLY);
if (fd < 0) {
perror(argv[2]);
Index: flash_otp_write.c
===================================================================
RCS file: /home/cvs/mtd/util/flash_otp_write.c,v
retrieving revision 1.1
retrieving revision 1.2
diff -u -r1.1 -r1.2
--- flash_otp_write.c 17 Feb 2005 20:38:36 -0000 1.1
+++ flash_otp_write.c 7 Nov 2005 11:15:10 -0000 1.2
@@ -1,4 +1,4 @@
-/*
+/*
* flash_otp_write.c -- write One-Time-Program data
*/
@@ -25,7 +25,7 @@
fprintf(stderr, "CAUTION! ONCE SET TO 0, OTP DATA BITS CAN'T BE ERASED!\n");
return EINVAL;
}
-
+
fd = open(argv[2], O_WRONLY);
if (fd < 0) {
perror(argv[2]);
Index: flashcp.c
===================================================================
RCS file: /home/cvs/mtd/util/flashcp.c,v
retrieving revision 1.5
retrieving revision 1.6
diff -u -r1.5 -r1.6
--- flashcp.c 17 Feb 2005 14:55:06 -0000 1.5
+++ flashcp.c 7 Nov 2005 11:15:11 -0000 1.6
@@ -180,7 +180,7 @@
(progname = strrchr (argv[0],'/')) ? progname++ : (progname = argv[0]);
/*********************
- * parse cmd-line
+ * parse cmd-line
*****************/
for (;;) {
Index: ftl_check.c
===================================================================
RCS file: /home/cvs/mtd/util/ftl_check.c,v
retrieving revision 1.5
retrieving revision 1.6
diff -u -r1.5 -r1.6
--- ftl_check.c 17 Jan 2005 13:43:27 -0000 1.5
+++ ftl_check.c 7 Nov 2005 11:15:11 -0000 1.6
@@ -86,7 +86,7 @@
erase_unit_header_t hdr, hdr2;
u_int i, j, nbam, *bam;
int control, data, free, deleted;
-
+
/* Get partition size, block size */
if (ioctl(fd, MEMGETINFO, &mtd) != 0) {
perror("get info failed");
@@ -116,7 +116,7 @@
fprintf(stderr, "No valid erase unit headers!\n");
return;
}
-
+
printf("Partition header:\n");
printf(" Formatted size = ");
print_size(FROM_LE32(hdr.FormattedSize));
@@ -127,7 +127,7 @@
printf(", virtual block size = ");
print_size(1 << hdr.BlockSize);
printf("\n");
-
+
/* Create basic block allocation table for control blocks */
nbam = (mtd.erasesize >> hdr.BlockSize);
bam = malloc(nbam * sizeof(u_int));
@@ -192,7 +192,7 @@
int verbose;
int optch, errflg, fd;
struct stat buf;
-
+
errflg = 0;
verbose = 0;
while ((optch = getopt(argc, argv, "vh")) != -1) {
@@ -227,7 +227,7 @@
check_partition(fd, verbose);
close(fd);
-
+
exit(EXIT_SUCCESS);
return 0;
}
Index: ftl_format.c
===================================================================
RCS file: /home/cvs/mtd/util/ftl_format.c,v
retrieving revision 1.8
retrieving revision 1.9
diff -u -r1.8 -r1.9
--- ftl_format.c 17 Jan 2005 13:43:27 -0000 1.8
+++ ftl_format.c 7 Nov 2005 11:15:12 -0000 1.9
@@ -92,7 +92,7 @@
u_int BootSize)
{
u_int i, BootUnits, nbam, __FormattedSize;
-
+
/* Default everything to the erased state */
memset(hdr, 0xff, sizeof(*hdr));
memcpy(hdr->LinkTargetTuple, LinkTarget, 5);
@@ -100,7 +100,7 @@
hdr->EndTuple[0] = hdr->EndTuple[1] = 0xff;
BootSize = (BootSize + (BlockSize-1)) & ~(BlockSize-1);
BootUnits = BootSize / BlockSize;
-
+
/* We only support 512-byte blocks */
hdr->BlockSize = 9;
hdr->EraseUnitSize = 0;
@@ -120,7 +120,7 @@
__FormattedSize -=
(FROM_LE16(hdr->NumEraseUnits) - Spare) * (nbam << hdr->BlockSize);
__FormattedSize -= ((__FormattedSize * Reserve / 100) & ~0xfff);
-
+
hdr->FormattedSize = TO_LE32(__FormattedSize);
/* hdr->FirstVMAddress defaults to erased state */
@@ -141,7 +141,7 @@
erase_info_t erase;
erase_unit_header_t hdr;
u_int step, lun, i, nbam, *bam;
-
+
/* Get partition size, block size */
if (ioctl(fd, MEMGETINFO, &mtd) != 0) {
perror("get info failed");
@@ -157,7 +157,7 @@
bootsize = 1;
}
#endif
-
+
/* Create header */
build_header(&hdr, mtd.size, mtd.erasesize,
spare, reserve, bootsize);
@@ -187,14 +187,14 @@
if ((strcmp(str, "y\n") != 0) && (strcmp(str, "Y\n") != 0))
return -1;
}
-
+
/* Create basic block allocation table for control blocks */
nbam = ((mtd.erasesize >> hdr.BlockSize) * sizeof(u_int)
+ FROM_LE32(hdr.BAMOffset) + (1 << hdr.BlockSize) - 1) >> hdr.BlockSize;
bam = malloc(nbam * sizeof(u_int));
for (i = 0; i < nbam; i++)
bam[i] = TO_LE32(BLOCK_CONTROL);
-
+
/* Erase partition */
if (!quiet) {
printf("Erasing all blocks...\n");
@@ -287,7 +287,7 @@
reserve = 5;
errflg = 0;
bootsize = 0;
-
+
while ((optch = getopt(argc, argv, "qir:s:b:")) != -1) {
switch (optch) {
case 'q':
@@ -337,7 +337,7 @@
printf("format successful.\n");
}
close(fd);
-
+
exit((ret) ? EXIT_FAILURE : EXIT_SUCCESS);
return 0;
}
Index: jffs-dump.c
===================================================================
RCS file: /home/cvs/mtd/util/jffs-dump.c,v
retrieving revision 1.2
retrieving revision 1.3
diff -u -r1.2 -r1.3
--- jffs-dump.c 18 Aug 2000 09:14:16 -0000 1.2
+++ jffs-dump.c 7 Nov 2005 11:15:12 -0000 1.3
@@ -178,7 +178,7 @@
fprintf(stdout, "}\n");
}
-static void write_val32(__u32 *adr, __u32 val)
+static void write_val32(__u32 *adr, __u32 val)
{
switch(endian) {
case ENDIAN_HOST:
@@ -193,7 +193,7 @@
}
}
-static void write_val16(__u16 *adr, __u16 val)
+static void write_val16(__u16 *adr, __u16 val)
{
switch(endian) {
case ENDIAN_HOST:
@@ -208,7 +208,7 @@
}
}
-static __u32 read_val32(__u32 *adr)
+static __u32 read_val32(__u32 *adr)
{
__u32 val;
@@ -226,7 +226,7 @@
return val;
}
-static __u16 read_val16(__u16 *adr)
+static __u16 read_val16(__u16 *adr)
{
__u16 val;
@@ -323,7 +323,7 @@
if (wordbuf == JFFS_MAGIC_BITMASK)
break;
}
-
+
case JFFS_MAGIC_BITMASK:
if (pread(fs, &ino, sizeof(ino), pos) < 0) {
perror("pread");
@@ -351,11 +351,11 @@
}
}
pos += (ino.nsize + 3) & ~3;
-
+
pos += (ino.dsize + 3) & ~3;
}
-
+
}
}
Index: jffs2dump.c
===================================================================
RCS file: /home/cvs/mtd/util/jffs2dump.c,v
retrieving revision 1.11
retrieving revision 1.12
diff -u -r1.11 -r1.12
--- jffs2dump.c 4 Nov 2005 08:06:27 -0000 1.11
+++ jffs2dump.c 7 Nov 2005 11:15:12 -0000 1.12
@@ -10,7 +10,7 @@
* published by the Free Software Foundation.
*
* Overview:
- * This utility dumps the contents of a binary JFFS2 image
+ * This utility dumps the contents of a binary JFFS2 image
*
*
* Bug/ToDo:
@@ -63,9 +63,9 @@
"-l --littleendian image is little endian\n"
"-c --content dump image contents\n"
"-e fname --endianconvert=fname convert image endianness, output to file fname\n"
- "-r --recalccrc recalc name and data crc on endian conversion\n"
- "-d len --datsize=len size of data chunks, when oob data in binary image (NAND only)\n"
- "-o len --oobsize=len size of oob data chunk in binary image (NAND only)\n"
+ "-r --recalccrc recalc name and data crc on endian conversion\n"
+ "-d len --datsize=len size of data chunks, when oob data in binary image (NAND only)\n"
+ "-o len --oobsize=len size of oob data chunk in binary image (NAND only)\n"
"-v --verbose verbose output\n");
exit(0);
}
@@ -165,10 +165,10 @@
break;
}
}
-
- if ((argc - optind) != 1 || error)
+
+ if ((argc - optind) != 1 || error)
display_help ();
-
+
img = argv[optind];
}
@@ -176,7 +176,7 @@
/*
* Dump image contents
*/
-void do_dumpcontent (void)
+void do_dumpcontent (void)
{
char *p = data, *p_free_begin;
union jffs2_node_union *node;
@@ -190,7 +190,7 @@
p_free_begin = NULL;
while ( p < (data + imglen)) {
node = (union jffs2_node_union*) p;
-
+
/* Skip empty space */
if (!p_free_begin)
p_free_begin = p;
@@ -199,7 +199,7 @@
empty += 4;
continue;
}
-
+
if (p != p_free_begin)
printf("Empty space found from 0x%08x to 0x%08x\n", p_free_begin-data, p-data);
p_free_begin = NULL;
@@ -212,16 +212,16 @@
continue;
}
bitchbitmask = 0;
-
+
type = je16_to_cpu(node->u.nodetype);
if ((type & JFFS2_NODE_ACCURATE) != JFFS2_NODE_ACCURATE) {
obsolete = 1;
type |= JFFS2_NODE_ACCURATE;
} else
obsolete = 0;
- /* Set accurate for CRC check */
+ /* Set accurate for CRC check */
node->u.nodetype = cpu_to_je16(type);
-
+
crc = crc32 (0, node, sizeof (struct jffs2_unknown_node) - 4);
if (crc != je32_to_cpu (node->u.hdr_crc)) {
printf ("Wrong hdr_crc at 0x%08x, 0x%08x instead of 0x%08x\n", p - data, je32_to_cpu (node->u.hdr_crc), crc);
@@ -231,12 +231,12 @@
}
switch(je16_to_cpu(node->u.nodetype)) {
-
+
case JFFS2_NODETYPE_INODE:
printf ("%8s Inode node at 0x%08x, totlen 0x%08x, #ino %5d, version %5d, isize %8d, csize %8d, dsize %8d, offset %8d\n",
obsolete ? "Obsolete" : "",
p - data, je32_to_cpu (node->i.totlen), je32_to_cpu (node->i.ino),
- je32_to_cpu ( node->i.version), je32_to_cpu (node->i.isize),
+ je32_to_cpu ( node->i.version), je32_to_cpu (node->i.isize),
je32_to_cpu (node->i.csize), je32_to_cpu (node->i.dsize), je32_to_cpu (node->i.offset));
crc = crc32 (0, node, sizeof (struct jffs2_raw_inode) - 8);
@@ -246,7 +246,7 @@
dirty += PAD(je32_to_cpu (node->i.totlen));;
continue;
}
-
+
crc = crc32(0, p + sizeof (struct jffs2_raw_inode), je32_to_cpu(node->i.csize));
if (crc != je32_to_cpu(node->i.data_crc)) {
printf ("Wrong data_crc at 0x%08x, 0x%08x instead of 0x%08x\n", p - data, je32_to_cpu (node->i.data_crc), crc);
@@ -257,14 +257,14 @@
p += PAD(je32_to_cpu (node->i.totlen));
break;
-
+
case JFFS2_NODETYPE_DIRENT:
memcpy (name, node->d.name, node->d.nsize);
name [node->d.nsize] = 0x0;
printf ("%8s Dirent node at 0x%08x, totlen 0x%08x, #pino %5d, version %5d, #ino %8d, nsize %8d, name %s\n",
obsolete ? "Obsolete" : "",
p - data, je32_to_cpu (node->d.totlen), je32_to_cpu (node->d.pino),
- je32_to_cpu ( node->d.version), je32_to_cpu (node->d.ino),
+ je32_to_cpu ( node->d.version), je32_to_cpu (node->d.ino),
node->d.nsize, name);
crc = crc32 (0, node, sizeof (struct jffs2_raw_dirent) - 8);
@@ -274,7 +274,7 @@
dirty += PAD(je32_to_cpu (node->d.totlen));;
continue;
}
-
+
crc = crc32(0, p + sizeof (struct jffs2_raw_dirent), node->d.nsize);
if (crc != je32_to_cpu(node->d.name_crc)) {
printf ("Wrong name_crc at 0x%08x, 0x%08x instead of 0x%08x\n", p - data, je32_to_cpu (node->d.name_crc), crc);
@@ -283,9 +283,9 @@
continue;
}
- p += PAD(je32_to_cpu (node->d.totlen));
+ p += PAD(je32_to_cpu (node->d.totlen));
break;
-
+
case JFFS2_NODETYPE_SUMMARY: {
int i;
@@ -397,39 +397,39 @@
case JFFS2_NODETYPE_CLEANMARKER:
if (verbose) {
- printf ("%8s Cleanmarker at 0x%08x, totlen 0x%08x\n",
+ printf ("%8s Cleanmarker at 0x%08x, totlen 0x%08x\n",
obsolete ? "Obsolete" : "",
p - data, je32_to_cpu (node->u.totlen));
- }
- p += PAD(je32_to_cpu (node->u.totlen));
+ }
+ p += PAD(je32_to_cpu (node->u.totlen));
break;
-
+
case JFFS2_NODETYPE_PADDING:
if (verbose) {
- printf ("%8s Padding node at 0x%08x, totlen 0x%08x\n",
+ printf ("%8s Padding node at 0x%08x, totlen 0x%08x\n",
obsolete ? "Obsolete" : "",
p - data, je32_to_cpu (node->u.totlen));
- }
- p += PAD(je32_to_cpu (node->u.totlen));
+ }
+ p += PAD(je32_to_cpu (node->u.totlen));
break;
-
+
case 0xffff:
p += 4;
empty += 4;
break;
-
- default:
+
+ default:
if (verbose) {
- printf ("%8s Unknown node at 0x%08x, totlen 0x%08x\n",
+ printf ("%8s Unknown node at 0x%08x, totlen 0x%08x\n",
obsolete ? "Obsolete" : "",
p - data, je32_to_cpu (node->u.totlen));
- }
- p += PAD(je32_to_cpu (node->u.totlen));
- dirty += PAD(je32_to_cpu (node->u.totlen));
-
+ }
+ p += PAD(je32_to_cpu (node->u.totlen));
+ dirty += PAD(je32_to_cpu (node->u.totlen));
+
}
}
-
+
if (verbose)
printf ("Empty space: %d, dirty space: %d\n", empty, dirty);
}
@@ -437,19 +437,19 @@
/*
* Convert endianess
*/
-void do_endianconvert (void)
+void do_endianconvert (void)
{
char *p = data;
union jffs2_node_union *node, newnode;
int fd, len;
jint32_t mode;
uint32_t crc;
-
+
fd = open (cnvfile, O_WRONLY | O_CREAT, 0644);
if (fd < 0) {
fprintf (stderr, "Cannot open / create file: %s\n", cnvfile);
return;
- }
+ }
while ( p < (data + imglen)) {
node = (union jffs2_node_union*) p;
@@ -460,10 +460,10 @@
p += 4;
continue;
}
-
+
if (je16_to_cpu (node->u.magic) != JFFS2_MAGIC_BITMASK) {
printf ("Wrong bitmask at 0x%08x, 0x%04x\n", p - data, je16_to_cpu (node->u.magic));
- newnode.u.magic = cnv_e16 (node->u.magic);
+ newnode.u.magic = cnv_e16 (node->u.magic);
newnode.u.nodetype = cnv_e16 (node->u.nodetype);
write (fd, &newnode, 4);
p += 4;
@@ -479,7 +479,7 @@
case JFFS2_NODETYPE_INODE:
- newnode.i.magic = cnv_e16 (node->i.magic);
+ newnode.i.magic = cnv_e16 (node->i.magic);
newnode.i.nodetype = cnv_e16 (node->i.nodetype);
newnode.i.totlen = cnv_e32 (node->i.totlen);
newnode.i.hdr_crc = cpu_to_e32 (crc32 (0, &newnode, sizeof (struct jffs2_unknown_node) - 4));
@@ -505,15 +505,15 @@
newnode.i.data_crc = cpu_to_e32 ( crc32(0, p + sizeof (struct jffs2_raw_inode), len));
} else
newnode.i.data_crc = cnv_e32 (node->i.data_crc);
-
+
newnode.i.node_crc = cpu_to_e32 (crc32 (0, &newnode, sizeof (struct jffs2_raw_inode) - 8));
-
+
write (fd, &newnode, sizeof (struct jffs2_raw_inode));
write (fd, p + sizeof (struct jffs2_raw_inode), PAD (je32_to_cpu (node->i.totlen) - sizeof (struct jffs2_raw_inode)));
- p += PAD(je32_to_cpu (node->i.totlen));
+ p += PAD(je32_to_cpu (node->i.totlen));
break;
-
+
case JFFS2_NODETYPE_DIRENT:
newnode.d.magic = cnv_e16 (node->d.magic);
newnode.d.nodetype = cnv_e16 (node->d.nodetype);
@@ -535,22 +535,22 @@
write (fd, &newnode, sizeof (struct jffs2_raw_dirent));
write (fd, p + sizeof (struct jffs2_raw_dirent), PAD (je32_to_cpu (node->d.totlen) - sizeof (struct jffs2_raw_dirent)));
- p += PAD(je32_to_cpu (node->d.totlen));
+ p += PAD(je32_to_cpu (node->d.totlen));
break;
-
+
case JFFS2_NODETYPE_CLEANMARKER:
case JFFS2_NODETYPE_PADDING:
newnode.u.magic = cnv_e16 (node->u.magic);
newnode.u.nodetype = cnv_e16 (node->u.nodetype);
newnode.u.totlen = cnv_e32 (node->u.totlen);
newnode.u.hdr_crc = cpu_to_e32 (crc32 (0, &newnode, sizeof (struct jffs2_unknown_node) - 4));
-
+
write (fd, &newnode, sizeof (struct jffs2_unknown_node));
len = PAD(je32_to_cpu (node->u.totlen) - sizeof (struct jffs2_unknown_node));
- if (len > 0)
+ if (len > 0)
write (fd, p + sizeof (struct jffs2_unknown_node), len);
-
- p += PAD(je32_to_cpu (node->u.totlen));
+
+ p += PAD(je32_to_cpu (node->u.totlen));
break;
case JFFS2_NODETYPE_SUMMARY : {
@@ -620,7 +620,7 @@
p += sizeof (struct jffs2_sum_marker);
// generate new crc on sum data
- newnode.s.sum_crc = cpu_to_e32 ( crc32(0, ((char *) node) + sizeof (struct jffs2_raw_summary),
+ newnode.s.sum_crc = cpu_to_e32 ( crc32(0, ((char *) node) + sizeof (struct jffs2_raw_summary),
je32_to_cpu (node->s.totlen) - sizeof (struct jffs2_raw_summary)));
// write out new node header
@@ -652,18 +652,18 @@
write (fd, p, 4);
p += 4;
break;
-
- default:
+
+ default:
printf ("Unknown node type: 0x%04x at 0x%08x, totlen 0x%08x\n", je16_to_cpu (node->u.nodetype), p - data, je32_to_cpu (node->u.totlen));
p += PAD(je32_to_cpu (node->u.totlen));
-
+
}
}
close (fd);
}
-
+
/*
* Main program
*/
@@ -678,7 +678,7 @@
perror("open input file");
exit(1);
}
-
+
// get image length
imglen = lseek(fd, 0, SEEK_END);
lseek (fd, 0, SEEK_SET);
@@ -689,7 +689,7 @@
close (fd);
exit(1);
}
-
+
if (datsize && oobsize) {
int idx = 0;
long len = imglen;
@@ -703,11 +703,11 @@
imglen -= oobsize;
len -= datsize + oobsize;
}
-
+
} else {
// read image data
read (fd, data, imglen);
- }
+ }
// Close the input file
close(fd);
@@ -716,10 +716,10 @@
if (convertendian)
do_endianconvert ();
-
+
// free memory
free (data);
- // Return happy
+ // Return happy
exit (0);
}
Index: jffs2reader.c
===================================================================
RCS file: /home/cvs/mtd/util/jffs2reader.c,v
retrieving revision 1.5
retrieving revision 1.6
diff -u -r1.5 -r1.6
--- jffs2reader.c 8 Feb 2002 00:51:52 -0000 1.5
+++ jffs2reader.c 7 Nov 2005 11:15:12 -0000 1.6
@@ -1,31 +1,31 @@
/* vi: set sw=4 ts=4: */
-/*
- * jffs2reader v0.0.18 A jffs2 image reader
+/*
+ * jffs2reader v0.0.18 A jffs2 image reader
*
* Copyright (c) 2001 Jari Kirma <Jari.Kirma at hut.fi>
- *
+ *
* This software is provided 'as-is', without any express or implied
* warranty. In no event will the author be held liable for any damages
* arising from the use of this software.
- *
+ *
* Permission is granted to anyone to use this software for any
* purpose, including commercial applications, and to alter it and
* redistribute it freely, subject to the following restrictions:
- *
+ *
* 1. The origin of this software must not be misrepresented; you must
* not claim that you wrote the original software. If you use this
* software in a product, an acknowledgment in the product
* documentation would be appreciated but is not required.
- *
+ *
* 2. Altered source versions must be plainly marked as such, and must
* not be misrepresented as being the original software.
- *
+ *
* 3. This notice may not be removed or altered from any source
* distribution.
*
*
*********
- * This code was altered September 2001
+ * This code was altered September 2001
* Changes are Copyright (c) Erik Andersen <andersen at codepoet.org>
*
* In compliance with (2) above, this is hereby marked as an altered
@@ -40,7 +40,7 @@
* *) Several twisty code paths have been fixed so I can understand them.
* -Erik, 1 September 2001
*
- * *) Made it show major/minor numbers for device nodes
+ * *) Made it show major/minor numbers for device nodes
* *) Made it show symlink targets
* -Erik, 13 September 2001
*
@@ -83,7 +83,7 @@
#define SCRATCH_SIZE (5*1024*1024)
#ifndef MAJOR
-/* FIXME: I am using illicit insider knowledge of
+/* FIXME: I am using illicit insider knowledge of
* kernel major/minor representation... */
#define MAJOR(dev) (((dev)>>8)&0xff)
#define MINOR(dev) ((dev)&0xff)
Index: mkfs.ffs2.c
===================================================================
RCS file: /home/cvs/mtd/util/mkfs.ffs2.c,v
retrieving revision 1.4
retrieving revision 1.5
diff -u -r1.4 -r1.5
--- mkfs.ffs2.c 5 May 2004 11:57:55 -0000 1.4
+++ mkfs.ffs2.c 7 Nov 2005 11:15:12 -0000 1.5
@@ -2,14 +2,14 @@
// $Id$
/* ######################################################################
- Microsoft Flash File System 2
-
+ Microsoft Flash File System 2
+
Information for the FFS2.0 was found in Microsoft's knowledge base,
http://msdn.microsoft.com/isapi/msdnlib.idc?theURL=/library/specs/S346A.HTM
Try searching for "Flash File System" if it has been moved
This program creates an empty file system.
-
+
##################################################################### */
#include <unistd.h>
@@ -31,18 +31,18 @@
{
unsigned char Blank[512];
unsigned I;
-
+
memset(Blank,0xFF,sizeof(Blank));
-
+
if (lseek(Fd,BlockSize*Number,SEEK_SET) != BlockSize*Number)
return -1;
-
+
for (I = 0; I*sizeof(Blank) != BlockSize; I++)
{
if (write(Fd,Blank,sizeof(Blank)) != sizeof(Blank))
return -1;
}
-
+
return 0;
}
@@ -55,16 +55,16 @@
unsigned long Length;
unsigned long Spares = 1;
unsigned long Start = 0;
-
+
// Process options
while ((Opt = getopt(argc,argv,"b:s:")) != EOF)
- {
+ {
switch (Opt)
{
case 'b':
BlockSize = strtol(optarg, NULL, 0);
break;
-
+
case 's':
Start = strtol(optarg, NULL, 0);
break;
@@ -76,14 +76,14 @@
// Find the device name
Device = optind;
- for (;Device < argc && (argv[Device][0] == 0 ||
+ for (;Device < argc && (argv[Device][0] == 0 ||
argv[Device][0] == '-'); Device++);
if (Device >= argc)
{
fprintf(stderr,"You must specify a device\n");
return 16;
}
-
+
// Open and size the device
if ((Fd = open(argv[Device],O_RDWR)) < 0)
{
@@ -91,34 +91,34 @@
return 8;
}
if (ioctl(Fd,BLKGETSIZE,&Length) < 0)
- {
+ {
Length = lseek(Fd,0,SEEK_END);
lseek(Fd,0,SEEK_SET);
}
else
Length *= 512;
-
+
if ((Start + 1)*BlockSize > Length)
{
fprintf(stderr,"The flash is not large enough\n");
}
-
+
printf("Total size is %lu, %lu byte erase "
"blocks for %lu blocks with %lu spares.\n",Length,BlockSize,
Length/BlockSize,Spares);
if (Start != 0)
printf("Skiping the first %lu bytes\n",Start*BlockSize);
-
+
if (ioctl(Fd,MEMGETINFO,&meminfo) == 0)
{
struct erase_info erase;
printf("Performing Flash Erase");
fflush(stdout);
-
+
erase.length = Length - Start*BlockSize;
erase.start = Start*BlockSize;
if (ioctl(Fd,MEMERASE,&erase) != 0)
- {
+ {
perror("\nMTD Erase failure");
close(Fd);
return 8;
@@ -132,25 +132,25 @@
printf("Erase %u\r",I);
fflush(stdout);
if (EraseBlock(I) != 0)
- {
+ {
perror(argv[Device]);
close(Fd);
return 8;
}
- }
+ }
}
-
+
for (I = 0; I != Length/BlockSize; I++)
{
struct ffs2_block block;
-
+
// Write the block structure
memset(&block,0xFF,sizeof(block));
block.EraseCount = 1;
block.BlockSeq = I;
block.BlockSeqChecksum = 0xFFFF ^ block.BlockSeq;
block.Status = (block.Status & (~FFS_STATE_MASK)) | FFS_STATE_READY;
-
+
// Is Spare
if (I >= Length/BlockSize - Spares)
{
@@ -158,18 +158,18 @@
block.BlockSeqChecksum = 0xFFFF;
block.Status = (block.Status & (~FFS_STATE_MASK)) | FFS_STATE_SPARE;
}
-
+
// Setup the boot record and the root record
if (I == 0)
{
struct ffs2_bootrecord boot;
- struct ffs2_blockalloc alloc[2];
+ struct ffs2_blockalloc alloc[2];
unsigned char Tmp[300];
struct ffs2_entry *root = (struct ffs2_entry *)Tmp;
-
+
block.BootRecordPtr = 0;
block.Status = (block.Status & (~FFS_BOOTP_MASK)) | FFS_BOOTP_CURRENT;
-
+
boot.Signature = 0xF1A5;
boot.SerialNumber = time(0);
boot.FFSWriteVersion = 0x200;
@@ -195,45 +195,45 @@
alloc[1].Offset[1] = 0;
alloc[1].Offset[2] = 0;
alloc[1].Len = FFS_SIZEOF_BOOT;
-
+
// Root Dir allocation structure
alloc[0].Status = (0xFF & (~FFS_ALLOC_SMASK)) | FFS_ALLOC_ALLOCATED;
alloc[0].Offset[0] = FFS_SIZEOF_BOOT;
alloc[0].Offset[1] = 0;
alloc[0].Offset[2] = 0;
alloc[0].Len = FFS_SIZEOF_ENTRY + root->NameLen;
-
+
// Write the two headers
if (lseek(Fd,BlockSize*(I+Start),SEEK_SET) < 0 ||
write(Fd,&boot,FFS_SIZEOF_BOOT) != FFS_SIZEOF_BOOT ||
write(Fd,root,FFS_SIZEOF_ENTRY + root->NameLen) != FFS_SIZEOF_ENTRY + root->NameLen)
- {
+ {
perror("Failed writing headers");
close(Fd);
return 8;
}
-
+
// And the two allocation structures
if (lseek(Fd,BlockSize*(I+Start+1) - FFS_SIZEOF_BLOCK - sizeof(alloc),
- SEEK_SET) <= 0 ||
+ SEEK_SET) <= 0 ||
write(Fd,alloc,sizeof(alloc)) != sizeof(alloc))
- {
+ {
perror("Failed writing allocations");
close(Fd);
return 8;
- }
+ }
}
-
+
if (lseek(Fd,BlockSize*(I+Start+1) - FFS_SIZEOF_BLOCK,
- SEEK_SET) <= 0 ||
+ SEEK_SET) <= 0 ||
write(Fd,&block,FFS_SIZEOF_BLOCK) != FFS_SIZEOF_BLOCK)
- {
+ {
perror("Failed writing block");
close(Fd);
return 8;
- }
+ }
}
printf("\n");
-
+
return 0;
}
Index: mkfs.jffs.c
===================================================================
RCS file: /home/cvs/mtd/util/mkfs.jffs.c,v
retrieving revision 1.14
retrieving revision 1.15
diff -u -r1.14 -r1.15
--- mkfs.jffs.c 17 Feb 2005 14:55:06 -0000 1.14
+++ mkfs.jffs.c 7 Nov 2005 11:15:13 -0000 1.15
@@ -3,7 +3,7 @@
*
* By default, builds an image that is of the same endianness as the
* host.
- * The -a option can be used when building for a target system which
+ * The -a option can be used when building for a target system which
* has a different endianness than the host.
*/
@@ -202,7 +202,7 @@
fprintf(stderr, "}\n");
}
-static void write_val32(__u32 *adr, __u32 val)
+static void write_val32(__u32 *adr, __u32 val)
{
switch(endian) {
case ENDIAN_HOST:
@@ -217,7 +217,7 @@
}
}
-static void write_val16(__u16 *adr, __u16 val)
+static void write_val16(__u16 *adr, __u16 val)
{
switch(endian) {
case ENDIAN_HOST:
@@ -232,7 +232,7 @@
}
}
-static __u32 read_val32(__u32 *adr)
+static __u32 read_val32(__u32 *adr)
{
__u32 val = 0;
Index: mkfs.jffs2.c
===================================================================
RCS file: /home/cvs/mtd/util/mkfs.jffs2.c,v
retrieving revision 1.46
retrieving revision 1.47
diff -u -r1.46 -r1.47
--- mkfs.jffs2.c 4 Nov 2005 08:06:27 -0000 1.46
+++ mkfs.jffs2.c 7 Nov 2005 11:15:13 -0000 1.47
@@ -26,9 +26,9 @@
*
* Major architectural rewrite by Erik Andersen <andersen at codepoet.org>
* to allow support for making hard links (though hard links support is
- * not yet implemented), and for munging file permissions and ownership
+ * not yet implemented), and for munging file permissions and ownership
* on the fly using --faketime, --squash, --devtable. And I plugged a
- * few memory leaks, adjusted the error handling and fixed some little
+ * few memory leaks, adjusted the error handling and fixed some little
* nits here and there.
*
* I also added a sample device table file. See device_table.txt
@@ -204,10 +204,10 @@
#endif
extern char *xreadlink(const char *path)
-{
+{
static const int GROWBY = 80; /* how large we will grow strings by */
- char *buf = NULL;
+ char *buf = NULL;
int bufsize = 0, readsize = 0;
do {
@@ -217,13 +217,13 @@
perror_msg("%s:%s", app_name, path);
return NULL;
}
- }
+ }
while (bufsize < readsize + 1);
buf[readsize] = '\0';
return buf;
-}
+}
static FILE *xfopen(const char *path, const char *mode)
{
FILE *fp;
@@ -273,7 +273,7 @@
}
static struct filesystem_entry *add_host_filesystem_entry(
- char *name, char *path, unsigned long uid, unsigned long gid,
+ char *name, char *path, unsigned long uid, unsigned long gid,
unsigned long mode, dev_t rdev, struct filesystem_entry *parent)
{
int status;
@@ -373,7 +373,7 @@
perror_msg_and_die("%s", hostpath);
}
- entry = add_host_filesystem_entry(targetpath, hostpath,
+ entry = add_host_filesystem_entry(targetpath, hostpath,
sb.st_uid, sb.st_gid, sb.st_mode, 0, parent);
n = scandir(hostpath, &namelist, 0, alphasort);
@@ -381,11 +381,11 @@
perror_msg_and_die("opening directory %s", hostpath);
}
- for (i=0; i<n; i++)
+ for (i=0; i<n; i++)
{
dp = namelist[i];
- if (dp->d_name[0] == '.' && (dp->d_name[1] == 0 ||
- (dp->d_name[1] == '.' && dp->d_name[2] == 0)))
+ if (dp->d_name[0] == '.' && (dp->d_name[1] == 0 ||
+ (dp->d_name[1] == '.' && dp->d_name[2] == 0)))
{
free(dp);
continue;
@@ -412,7 +412,7 @@
case S_IFLNK:
case S_IFCHR:
case S_IFBLK:
- add_host_filesystem_entry(tpath, hpath, sb.st_uid,
+ add_host_filesystem_entry(tpath, hpath, sb.st_uid,
sb.st_gid, sb.st_mode, sb.st_rdev, entry);
break;
@@ -429,7 +429,7 @@
}
/* the GNU C library has a wonderful scanf("%as", string) which will
- allocate the string with the right size, good to avoid buffer overruns.
+ allocate the string with the right size, good to avoid buffer overruns.
the following macros use it if available or use a hacky workaround...
*/
@@ -457,7 +457,7 @@
<path> <type> <mode> <uid> <gid> <major> <minor> <start> <inc> <count>
/dev/mem c 640 0 0 1 1 0 0 -
- type can be one of:
+ type can be one of:
f A regular file
d Directory
c Character special device file
@@ -480,7 +480,7 @@
if (sscanf (line, "%" SCANF_PREFIX "s %c %lo %lu %lu %lu %lu %lu %lu %lu",
SCANF_STRING(name), &type, &mode, &uid, &gid, &major, &minor,
- &start, &increment, &count) < 0)
+ &start, &increment, &count) < 0)
{
return 1;
}
@@ -513,7 +513,7 @@
}
entry = find_filesystem_entry(root, name, mode);
if (entry) {
- /* Ok, we just need to fixup the existing entry
+ /* Ok, we just need to fixup the existing entry
* and we will be all done... */
entry->sb.st_uid = uid;
entry->sb.st_gid = gid;
@@ -522,7 +522,7 @@
entry->sb.st_rdev = makedev(major, minor);
}
} else {
- /* If parent is NULL (happens with device table entries),
+ /* If parent is NULL (happens with device table entries),
* try and find our parent now) */
tmp = strdup(name);
dir = dirname(tmp);
@@ -556,14 +556,14 @@
asprintf(&dname, "%s%lu", name, i);
asprintf(&hpath, "%s/%s%lu", rootdir, name, i);
rdev = makedev(major, minor + (i * increment - start));
- add_host_filesystem_entry(dname, hpath, uid, gid,
+ add_host_filesystem_entry(dname, hpath, uid, gid,
mode, rdev, parent);
free(dname);
free(hpath);
}
} else {
dev_t rdev = makedev(major, minor);
- add_host_filesystem_entry(name, hostpath, uid, gid,
+ add_host_filesystem_entry(name, hostpath, uid, gid,
mode, rdev, parent);
}
break;
@@ -667,7 +667,7 @@
0xff, 0xff, 0xff, 0xff, 0xff
};
-/* We default to 4096, per x86. When building a fs for
+/* We default to 4096, per x86. When building a fs for
* 64-bit arches and whatnot, use the --pagesize=SIZE option */
int page_size = 4096;
@@ -695,7 +695,7 @@
static void padblock(void)
{
while (out_ofs % erase_block_size) {
- full_write(out_fd, ffbuf, min(sizeof(ffbuf),
+ full_write(out_fd, ffbuf, min(sizeof(ffbuf),
erase_block_size - (out_ofs % erase_block_size)));
}
}
@@ -753,7 +753,7 @@
rd.magic = cpu_to_je16(JFFS2_MAGIC_BITMASK);
rd.nodetype = cpu_to_je16(JFFS2_NODETYPE_DIRENT);
rd.totlen = cpu_to_je32(sizeof(rd) + strlen(name));
- rd.hdr_crc = cpu_to_je32(crc32(0, &rd,
+ rd.hdr_crc = cpu_to_je32(crc32(0, &rd,
sizeof(struct jffs2_unknown_node) - 4));
rd.pino = cpu_to_je32((e->parent) ? e->parent->sb.st_ino : 1);
rd.version = cpu_to_je32(version++);
@@ -793,8 +793,8 @@
}
statbuf->st_ino = ++ino;
- mkfs_debug_msg("writing file '%s' ino=%lu parent_ino=%lu",
- e->name, (unsigned long) statbuf->st_ino,
+ mkfs_debug_msg("writing file '%s' ino=%lu parent_ino=%lu",
+ e->name, (unsigned long) statbuf->st_ino,
(unsigned long) e->parent->sb.st_ino);
write_dirent(e);
@@ -827,7 +827,7 @@
while (len) {
uint32_t dsize, space;
uint16_t compression;
-
+
pad_block_if_less_than(sizeof(ri) + JFFS2_MIN_DATA_LEN);
dsize = len;
@@ -848,7 +848,7 @@
}
ri.totlen = cpu_to_je32(sizeof(ri) + space);
- ri.hdr_crc = cpu_to_je32(crc32(0,
+ ri.hdr_crc = cpu_to_je32(crc32(0,
&ri, sizeof(struct jffs2_unknown_node) - 4));
ri.version = cpu_to_je32(++ver);
@@ -875,7 +875,7 @@
ri.version = cpu_to_je32(++ver);
ri.totlen = cpu_to_je32(sizeof(ri));
- ri.hdr_crc = cpu_to_je32(crc32(0,
+ ri.hdr_crc = cpu_to_je32(crc32(0,
&ri, sizeof(struct jffs2_unknown_node) - 4));
ri.csize = cpu_to_je32(0);
ri.dsize = cpu_to_je32(0);
@@ -896,14 +896,14 @@
statbuf = &(e->sb);
statbuf->st_ino = ++ino;
- mkfs_debug_msg("writing symlink '%s' ino=%lu parent_ino=%lu",
- e->name, (unsigned long) statbuf->st_ino,
+ mkfs_debug_msg("writing symlink '%s' ino=%lu parent_ino=%lu",
+ e->name, (unsigned long) statbuf->st_ino,
(unsigned long) e->parent->sb.st_ino);
write_dirent(e);
len = strlen(e->link);
if (len > JFFS2_MAX_SYMLINK_LEN) {
- error_msg("symlink too large. Truncated to %d chars.",
+ error_msg("symlink too large. Truncated to %d chars.",
JFFS2_MAX_SYMLINK_LEN);
len = JFFS2_MAX_SYMLINK_LEN;
}
@@ -913,7 +913,7 @@
ri.magic = cpu_to_je16(JFFS2_MAGIC_BITMASK);
ri.nodetype = cpu_to_je16(JFFS2_NODETYPE_INODE);
ri.totlen = cpu_to_je32(sizeof(ri) + len);
- ri.hdr_crc = cpu_to_je32(crc32(0,
+ ri.hdr_crc = cpu_to_je32(crc32(0,
&ri, sizeof(struct jffs2_unknown_node) - 4));
ri.ino = cpu_to_je32(statbuf->st_ino);
@@ -944,8 +944,8 @@
statbuf = &(e->sb);
statbuf->st_ino = ++ino;
if (S_ISDIR(statbuf->st_mode)) {
- mkfs_debug_msg("writing dir '%s' ino=%lu parent_ino=%lu",
- e->name, (unsigned long) statbuf->st_ino,
+ mkfs_debug_msg("writing dir '%s' ino=%lu parent_ino=%lu",
+ e->name, (unsigned long) statbuf->st_ino,
(unsigned long) (e->parent) ? e->parent->sb. st_ino : 1);
}
write_dirent(e);
@@ -955,7 +955,7 @@
ri.magic = cpu_to_je16(JFFS2_MAGIC_BITMASK);
ri.nodetype = cpu_to_je16(JFFS2_NODETYPE_INODE);
ri.totlen = cpu_to_je32(sizeof(ri));
- ri.hdr_crc = cpu_to_je32(crc32(0,
+ ri.hdr_crc = cpu_to_je32(crc32(0,
&ri, sizeof(struct jffs2_unknown_node) - 4));
ri.ino = cpu_to_je32(statbuf->st_ino);
@@ -987,7 +987,7 @@
statbuf->st_ino = ++ino;
write_dirent(e);
- kdev = cpu_to_je16((major(statbuf->st_rdev) << 8) +
+ kdev = cpu_to_je16((major(statbuf->st_rdev) << 8) +
minor(statbuf->st_rdev));
memset(&ri, 0, sizeof(ri));
@@ -995,7 +995,7 @@
ri.magic = cpu_to_je16(JFFS2_MAGIC_BITMASK);
ri.nodetype = cpu_to_je16(JFFS2_NODETYPE_INODE);
ri.totlen = cpu_to_je32(sizeof(ri) + sizeof(kdev));
- ri.hdr_crc = cpu_to_je32(crc32(0,
+ ri.hdr_crc = cpu_to_je32(crc32(0,
&ri, sizeof(struct jffs2_unknown_node) - 4));
ri.ino = cpu_to_je32(statbuf->st_ino);
@@ -1126,7 +1126,7 @@
if (ino == 0)
ino = 1;
-
+
root->sb.st_ino = 1;
recursive_populate_directory(root);
@@ -1212,13 +1212,13 @@
static char *revtext = "$Revision$";
int load_next_block() {
-
+
int ret;
ret = read(in_fd, file_buffer, erase_block_size);
-
+
if(verbose)
printf("Load next block : %d bytes read\n",ret);
-
+
return ret;
}
@@ -1228,77 +1228,77 @@
uint16_t type;
int bitchbitmask = 0;
int obsolete;
-
+
char name[256];
-
+
while ( p < (file_buffer + inp_size)) {
-
+
node = (union jffs2_node_union *) p;
-
+
/* Skip empty space */
if (je16_to_cpu (node->u.magic) == 0xFFFF && je16_to_cpu (node->u.nodetype) == 0xFFFF) {
p += 4;
continue;
}
-
+
if (je16_to_cpu (node->u.magic) != JFFS2_MAGIC_BITMASK) {
if (!bitchbitmask++)
printf ("Wrong bitmask at 0x%08x, 0x%04x\n", p - file_buffer, je16_to_cpu (node->u.magic));
p += 4;
continue;
}
-
+
bitchbitmask = 0;
-
+
type = je16_to_cpu(node->u.nodetype);
if ((type & JFFS2_NODE_ACCURATE) != JFFS2_NODE_ACCURATE) {
obsolete = 1;
type |= JFFS2_NODE_ACCURATE;
} else
obsolete = 0;
-
+
node->u.nodetype = cpu_to_je16(type);
-
+
switch(je16_to_cpu(node->u.nodetype)) {
-
+
case JFFS2_NODETYPE_INODE:
if(verbose)
printf ("%8s Inode node at 0x%08x, totlen 0x%08x, #ino %5d, version %5d, isize %8d, csize %8d, dsize %8d, offset %8d\n",
obsolete ? "Obsolete" : "",
p - file_buffer, je32_to_cpu (node->i.totlen), je32_to_cpu (node->i.ino),
- je32_to_cpu ( node->i.version), je32_to_cpu (node->i.isize),
+ je32_to_cpu ( node->i.version), je32_to_cpu (node->i.isize),
je32_to_cpu (node->i.csize), je32_to_cpu (node->i.dsize), je32_to_cpu (node->i.offset));
-
+
if ( je32_to_cpu (node->i.ino) > ino )
ino = je32_to_cpu (node->i.ino);
-
+
p += PAD(je32_to_cpu (node->i.totlen));
break;
-
+
case JFFS2_NODETYPE_DIRENT:
memcpy (name, node->d.name, node->d.nsize);
name [node->d.nsize] = 0x0;
-
+
if(verbose)
printf ("%8s Dirent node at 0x%08x, totlen 0x%08x, #pino %5d, version %5d, #ino %8d, nsize %8d, name %s\n",
obsolete ? "Obsolete" : "",
p - file_buffer, je32_to_cpu (node->d.totlen), je32_to_cpu (node->d.pino),
- je32_to_cpu ( node->d.version), je32_to_cpu (node->d.ino),
+ je32_to_cpu ( node->d.version), je32_to_cpu (node->d.ino),
node->d.nsize, name);
-
- p += PAD(je32_to_cpu (node->d.totlen));
+
+ p += PAD(je32_to_cpu (node->d.totlen));
break;
-
+
case JFFS2_NODETYPE_CLEANMARKER:
if (verbose) {
- printf ("%8s Cleanmarker at 0x%08x, totlen 0x%08x\n",
+ printf ("%8s Cleanmarker at 0x%08x, totlen 0x%08x\n",
obsolete ? "Obsolete" : "",
p - file_buffer, je32_to_cpu (node->u.totlen));
}
-
- p += PAD(je32_to_cpu (node->u.totlen));
+
+ p += PAD(je32_to_cpu (node->u.totlen));
break;
-
+
case JFFS2_NODETYPE_ERASEBLOCK_HEADER:
if (verbose) {
printf ("%8s Eraseblock header at 0x%08x, totlen 0x%08\n",
@@ -1307,52 +1307,52 @@
}
p += PAD(je32_to_cpu (node->eh.totlen));
break;
-
+
case JFFS2_NODETYPE_PADDING:
if (verbose) {
- printf ("%8s Padding node at 0x%08x, totlen 0x%08x\n",
+ printf ("%8s Padding node at 0x%08x, totlen 0x%08x\n",
obsolete ? "Obsolete" : "",
p - file_buffer, je32_to_cpu (node->u.totlen));
}
-
- p += PAD(je32_to_cpu (node->u.totlen));
+
+ p += PAD(je32_to_cpu (node->u.totlen));
break;
-
+
case 0xffff:
p += 4;
break;
-
- default:
+
+ default:
if (verbose) {
- printf ("%8s Unknown node at 0x%08x, totlen 0x%08x\n",
+ printf ("%8s Unknown node at 0x%08x, totlen 0x%08x\n",
obsolete ? "Obsolete" : "",
p - file_buffer, je32_to_cpu (node->u.totlen));
}
-
- p += PAD(je32_to_cpu (node->u.totlen));
- }
+
+ p += PAD(je32_to_cpu (node->u.totlen));
+ }
}
}
void parse_image(){
int ret;
-
+
file_buffer = malloc(erase_block_size);
-
+
if (!file_buffer) {
perror("out of memory");
close (in_fd);
close (out_fd);
exit(1);
}
-
+
while ((ret = load_next_block())) {
- process_buffer(ret);
+ process_buffer(ret);
}
-
+
if (file_buffer)
free(file_buffer);
-
+
close(in_fd);
}
@@ -1368,8 +1368,8 @@
jffs2_compressors_init();
- while ((opt = getopt_long(argc, argv,
- "D:d:r:s:o:qUPfh?vVe:lbp::nc:m:x:X:Lty:i:", long_options, &c)) >= 0)
+ while ((opt = getopt_long(argc, argv,
+ "D:d:r:s:o:qUPfh?vVe:lbp::nc:m:x:X:Lty:i:", long_options, &c)) >= 0)
{
switch (opt) {
case 'D':
@@ -1550,7 +1550,7 @@
if(in_fd != -1)
parse_image();
-
+
root = recursive_add_host_directory(NULL, "/", cwd);
if (devtable)
Index: nanddump.c
===================================================================
RCS file: /home/cvs/mtd/util/nanddump.c,v
retrieving revision 1.28
retrieving revision 1.29
diff -u -r1.28 -r1.29
--- nanddump.c 17 Mar 2005 12:10:30 -0000 1.28
+++ nanddump.c 7 Nov 2005 11:15:13 -0000 1.29
@@ -139,10 +139,10 @@
break;
}
}
-
- if ((argc - optind) != 1 || error)
+
+ if ((argc - optind) != 1 || error)
display_help ();
-
+
mtddev = argv[optind];
}
@@ -172,7 +172,7 @@
exit (1);
}
- /* Fill in MTD device capability structure */
+ /* Fill in MTD device capability structure */
if (ioctl(fd, MEMGETINFO, &meminfo) != 0) {
perror("MEMGETINFO");
close(fd);
@@ -234,7 +234,7 @@
perror("pread");
goto closeall;
}
- }
+ }
/* Write out page data */
if (pretty_print) {
@@ -258,7 +258,7 @@
if (omitoob)
continue;
-
+
if (badblock) {
memset (readbuf, 0xff, meminfo.oobsize);
} else {
Index: nandwrite.c
===================================================================
RCS file: /home/cvs/mtd/util/nandwrite.c,v
retrieving revision 1.31
retrieving revision 1.32
diff -u -r1.31 -r1.32
--- nandwrite.c 31 May 2005 15:47:31 -0000 1.31
+++ nandwrite.c 7 Nov 2005 11:15:13 -0000 1.32
@@ -51,17 +51,17 @@
unsigned char oobreadbuf[MAX_OOB_SIZE];
// oob layouts to pass into the kernel as default
-struct nand_oobinfo none_oobinfo = {
+struct nand_oobinfo none_oobinfo = {
.useecc = MTD_NANDECC_OFF,
};
-struct nand_oobinfo jffs2_oobinfo = {
+struct nand_oobinfo jffs2_oobinfo = {
.useecc = MTD_NANDECC_PLACE,
.eccbytes = 6,
.eccpos = { 0, 1, 2, 3, 6, 7 }
};
-struct nand_oobinfo yaffs_oobinfo = {
+struct nand_oobinfo yaffs_oobinfo = {
.useecc = MTD_NANDECC_PLACE,
.eccbytes = 6,
.eccpos = { 8, 9, 10, 13, 14, 15}
@@ -193,10 +193,10 @@
break;
}
}
-
- if ((argc - optind) != 2 || error)
+
+ if ((argc - optind) != 2 || error)
display_help ();
-
+
mtd_device = argv[optind++];
img = argv[optind];
}
@@ -229,7 +229,7 @@
exit(1);
}
- /* Fill in MTD device capability structure */
+ /* Fill in MTD device capability structure */
if (ioctl(fd, MEMGETINFO, &meminfo) != 0) {
perror("MEMGETINFO");
close(fd);
@@ -238,10 +238,10 @@
/* Set erasesize to specified number of blocks - to match jffs2 (virtual) block size */
meminfo.erasesize *= blockalign;
-
+
/* Make sure device page sizes are valid */
if (!(meminfo.oobsize == 16 && meminfo.oobblock == 512) &&
- !(meminfo.oobsize == 8 && meminfo.oobblock == 256) &&
+ !(meminfo.oobsize == 8 && meminfo.oobblock == 256) &&
!(meminfo.oobsize == 64 && meminfo.oobblock == 2048)) {
fprintf(stderr, "Unknown flash (not normal NAND)\n");
close(fd);
@@ -253,8 +253,8 @@
perror ("MEMGETOOBSEL");
close (fd);
exit (1);
- }
-
+ }
+
// write without ecc ?
if (noecc) {
if (ioctl (fd, MEMSETOOBSEL, &none_oobinfo) != 0) {
@@ -272,14 +272,14 @@
perror ("MEMSETOOBSEL");
close (fd);
exit (1);
- }
+ }
oobinfochanged = 1;
- }
+ }
- /*
+ /*
* force oob layout for jffs2 or yaffs ?
- * Legacy support
- */
+ * Legacy support
+ */
if (forcejffs2 || forceyaffs) {
struct nand_oobinfo *oobsel = forcejffs2 ? &jffs2_oobinfo : &yaffs_oobinfo;
@@ -295,15 +295,15 @@
if (forceyaffs) {
fprintf (stderr, "YAFSS cannot operate on 256 Byte page size");
goto restoreoob;
- }
- /* Adjust number of ecc bytes */
- jffs2_oobinfo.eccbytes = 3;
+ }
+ /* Adjust number of ecc bytes */
+ jffs2_oobinfo.eccbytes = 3;
}
-
+
if (ioctl (fd, MEMSETOOBSEL, oobsel) != 0) {
perror ("MEMSETOOBSEL");
goto restoreoob;
- }
+ }
}
oob.length = meminfo.oobsize;
@@ -320,13 +320,13 @@
lseek (ifd, 0, SEEK_SET);
pagelen = meminfo.oobblock + ((writeoob == 1) ? meminfo.oobsize : 0);
-
+
// Check, if file is pagealigned
if ((!pad) && ((imglen % pagelen) != 0)) {
fprintf (stderr, "Input file is not page aligned\n");
goto closeall;
}
-
+
// Check, if length fits into device
if ( ((imglen / pagelen) * meminfo.oobblock) > (meminfo.size - mtdoffset)) {
fprintf (stderr, "Image %d bytes, NAND page %d bytes, OOB area %u bytes, device size %u bytes\n",
@@ -334,14 +334,14 @@
perror ("Input file does not fit into device");
goto closeall;
}
-
+
/* Get data from input and write to the device */
while (imglen && (mtdoffset < meminfo.size)) {
// new eraseblock , check for bad block(s)
// Stay in the loop to be sure if the mtdoffset changes because
// of a bad block, that the next block that will be written to
- // is also checked. Thus avoiding errors if the block(s) after the
- // skipped block(s) is also bad (number of blocks depending on
+ // is also checked. Thus avoiding errors if the block(s) after the
+ // skipped block(s) is also bad (number of blocks depending on
// the blockalign
while (blockstart != (mtdoffset & (~meminfo.erasesize + 1))) {
blockstart = mtdoffset & (~meminfo.erasesize + 1);
@@ -349,7 +349,7 @@
baderaseblock = 0;
if (!quiet)
fprintf (stdout, "Writing data to block %x\n", blockstart);
-
+
/* Check all the blocks in an erase block for bad blocks */
do {
if ((ret = ioctl(fd, MEMGETBADBLOCK, &offs)) < 0) {
@@ -361,13 +361,13 @@
if (!quiet)
fprintf (stderr, "Bad block at %x, %u block(s) from %x will be skipped\n", (int) offs, blockalign, blockstart);
}
-
- if (baderaseblock) {
+
+ if (baderaseblock) {
mtdoffset = blockstart + meminfo.erasesize;
}
offs += meminfo.erasesize / blockalign ;
} while ( offs < blockstart + meminfo.erasesize );
-
+
}
readlen = meminfo.oobblock;
@@ -393,13 +393,13 @@
}
if (!noecc) {
int i, start, len;
- /*
+ /*
* We use autoplacement and have the oobinfo with the autoplacement
- * information from the kernel available
+ * information from the kernel available
*
* Modified to support out of order oobfree segments,
* such as the layout used by diskonchip.c
- */
+ */
if (!oobinfochanged && (old_oobinfo.useecc == MTD_NANDECC_AUTOPLACE)) {
for (i = 0;old_oobinfo.oobfree[i][1]; i++) {
/* Set the reserved bytes to 0xff */
@@ -426,7 +426,7 @@
}
imglen -= meminfo.oobsize;
}
-
+
/* Write out the Page data */
if (pwrite(fd, writebuf, meminfo.oobblock, mtdoffset) != meminfo.oobblock) {
perror ("pwrite");
@@ -445,7 +445,7 @@
perror ("MEMSETOOBSEL");
close (fd);
exit (1);
- }
+ }
}
close(fd);
Index: nftl_format.c
===================================================================
RCS file: /home/cvs/mtd/util/nftl_format.c,v
retrieving revision 1.23
retrieving revision 1.24
diff -u -r1.23 -r1.24
--- nftl_format.c 5 Aug 2005 10:36:57 -0000 1.23
+++ nftl_format.c 7 Nov 2005 11:15:13 -0000 1.24
@@ -1,4 +1,4 @@
-/*
+/*
* nftl_format.c: Creating a NFTL/INFTL partition on an MTD device
*
*
@@ -78,18 +78,18 @@
{
unsigned char oobbuf[16];
struct mtd_oob_buf oob = { 0, 16, oobbuf };
-
+
oob.start = block * meminfo.erasesize;
if (ioctl(fd, MEMREADOOB, &oob))
return ZONE_BAD_ORIGINAL;
-
+
if(oobbuf[5] == 0)
return ZONE_BAD_ORIGINAL;
oob.start = block * meminfo.erasesize + 512 /* FIXME */;
if (ioctl(fd, MEMREADOOB, &oob))
return ZONE_BAD_ORIGINAL;
-
+
if(oobbuf[5] == 0)
return ZONE_BAD_ORIGINAL;
@@ -160,7 +160,7 @@
status = (do_oobcheck) ? check_block_1(block) : ZONE_GOOD;
erase.start = block * meminfo.erasesize;
-
+
if (status != ZONE_GOOD) {
printf("\rSkipping bad zone (factory marked) #%ld @ 0x%x\n", block, erase.start);
fflush(stdout);
@@ -282,7 +282,7 @@
case 0x8000:
break;
default:
- printf("Unrecognized Erase size, 0x%x - I'm confused\n",
+ printf("Unrecognized Erase size, 0x%x - I'm confused\n",
meminfo.erasesize);
close(fd);
return 1;
@@ -304,7 +304,7 @@
memset(BadUnitTable, ZONE_GOOD, MAX_ERASE_ZONES);
if (part_size == 0 || (part_size > meminfo.size - startofs))
- /* the user doest not or incorrectly specify NFTL partition size */
+ /* the user doest not or incorrectly specify NFTL partition size */
part_size = meminfo.size - startofs;
erase.length = meminfo.erasesize;
@@ -383,9 +383,9 @@
INFTLhdr->Partitions[0].spareUnits = cpu_to_le32(0);
INFTLhdr->Partitions[0].Reserved0 = INFTLhdr->Partitions[0].firstUnit;
INFTLhdr->Partitions[0].Reserved1 = cpu_to_le32(0);
-
+
} else {
-
+
NFTLhdr = (struct NFTLMediaHeader *) (writebuf[0]);
strcpy(NFTLhdr->DataOrgID, "ANAND");
NFTLhdr->NumEraseUnits = cpu_to_le16(part_size / meminfo.erasesize);
Index: nftldump.c
===================================================================
RCS file: /home/cvs/mtd/util/nftldump.c,v
retrieving revision 1.16
retrieving revision 1.17
diff -u -r1.16 -r1.17
--- nftldump.c 5 May 2004 14:48:27 -0000 1.16
+++ nftldump.c 7 Nov 2005 11:15:13 -0000 1.17
@@ -1,4 +1,4 @@
-/*
+/*
* nftldump.c: Dumping the content of NFTL partitions on a "Physical Disk"
*
*
@@ -140,7 +140,7 @@
int i, j;
unsigned long ofs;
- for (i = MedHead[0].FirstPhysicalEUN; i < MedHead[0].FirstPhysicalEUN +
+ for (i = MedHead[0].FirstPhysicalEUN; i < MedHead[0].FirstPhysicalEUN +
MedHead[0].NumEraseUnits; i++) {
/* For each Erase Unit */
ofs = i * meminfo.erasesize;
@@ -193,7 +193,7 @@
if (UCItable[i][0].a.VirtUnitNum == 0xffff)
printf("Unit %d is free\n", i);
else
- printf("Unit %d is in chain %d and %s a replacement\n", i,
+ printf("Unit %d is in chain %d and %s a replacement\n", i,
UCItable[i][0].a.VirtUnitNum & 0x7fff,
UCItable[i][0].a.VirtUnitNum & 0x8000 ? "is" : "is not");
}
@@ -259,7 +259,7 @@
write(ofd, readbuf, 512);
}
-
+
}
}
}
Index: rfddump.c
===================================================================
RCS file: /home/cvs/mtd/util/rfddump.c,v
retrieving revision 1.2
retrieving revision 1.3
diff -u -r1.2 -r1.3
--- rfddump.c 23 Jun 2005 14:50:13 -0000 1.2
+++ rfddump.c 7 Nov 2005 11:15:13 -0000 1.3
@@ -1,4 +1,4 @@
-/*
+/*
* rfddump.c
*
* Copyright (C) 2005 Sean Young <sean at mess.org>
@@ -96,7 +96,7 @@
{ NULL, 0, 0, 0 }
};
- int c = getopt_long(argc, argv, short_options,
+ int c = getopt_long(argc, argv, short_options,
long_options, &option_index);
if (c == EOF)
break;
@@ -132,13 +132,13 @@
int i;
int sectors;
- if (pread(fd, rfd->header, rfd->header_size, block * rfd->block_size)
+ if (pread(fd, rfd->header, rfd->header_size, block * rfd->block_size)
!= rfd->header_size) {
return -1;
}
if (__le16_to_cpu(rfd->header[0]) != RFD_MAGIC) {
- if (rfd->verbose)
+ if (rfd->verbose)
printf("Block #%02d: Magic missing\n", block);
return 0;
@@ -166,7 +166,7 @@
continue;
}
- rfd->sector_map[entry] = rfd->block_size * block +
+ rfd->sector_map[entry] = rfd->block_size * block +
(i + rfd->header_sectors) * SECTOR_SIZE;
sectors++;
}
@@ -221,13 +221,13 @@
return 1;
}
- if (st.st_size % SECTOR_SIZE)
+ if (st.st_size % SECTOR_SIZE)
fprintf(stderr, "%s: warning: not a multiple of sectors (512 bytes)\n", rfd.mtd_filename);
-
+
sectors_per_block = rfd.block_size / SECTOR_SIZE;
- if (st.st_size % rfd.block_size)
- fprintf(stderr, "%s: warning: not a multiple of block size\n", rfd.mtd_filename);
+ if (st.st_size % rfd.block_size)
+ fprintf(stderr, "%s: warning: not a multiple of block size\n", rfd.mtd_filename);
rfd.block_count = st.st_size / rfd.block_size;
@@ -238,14 +238,14 @@
}
}
- rfd.header_sectors =
+ rfd.header_sectors =
((HEADER_MAP_OFFSET + sectors_per_block) *
sizeof(__u16) + SECTOR_SIZE - 1) / SECTOR_SIZE;
rfd.data_sectors = sectors_per_block - rfd.header_sectors;
- cylinders = ((rfd.block_count - 1) * rfd.data_sectors - 1)
+ cylinders = ((rfd.block_count - 1) * rfd.data_sectors - 1)
/ SECTORS_PER_TRACK;
rfd.sector_count = cylinders * SECTORS_PER_TRACK;
- rfd.header_size =
+ rfd.header_size =
(HEADER_MAP_OFFSET + rfd.data_sectors) * sizeof(__u16);
rfd.header = malloc(rfd.header_size);
@@ -269,7 +269,7 @@
for (blocks_found=i=0; i<rfd.block_count; i++) {
rc = build_block_map(&rfd, fd, i);
- if (rc > 0)
+ if (rc > 0)
blocks_found++;
if (rc < 0)
goto err;
@@ -281,7 +281,7 @@
}
for (i=0; i<rfd.sector_count; i++) {
- if (rfd.sector_map[i] != -1)
+ if (rfd.sector_map[i] != -1)
break;
}
@@ -301,7 +301,7 @@
if (rfd.sector_map[i] == -1) {
memset(sector, 0, SECTOR_SIZE);
blank++;
- } else {
+ } else {
if (pread(fd, sector, SECTOR_SIZE, rfd.sector_map[i])
!= SECTOR_SIZE) {
perror(rfd.mtd_filename);
@@ -315,7 +315,7 @@
}
}
- if (rfd.verbose)
+ if (rfd.verbose)
printf("Copied %d sectors (%d blank)\n", rfd.sector_count, blank);
close(out_fd);
Index: rfdformat.c
===================================================================
RCS file: /home/cvs/mtd/util/rfdformat.c,v
retrieving revision 1.2
retrieving revision 1.3
diff -u -r1.2 -r1.3
--- rfdformat.c 23 Jun 2005 14:50:13 -0000 1.2
+++ rfdformat.c 7 Nov 2005 11:15:14 -0000 1.3
@@ -1,4 +1,4 @@
-/*
+/*
* rfdformat.c
*
* Copyright (C) 2005 Sean Young <sean at mess.org>
@@ -10,7 +10,7 @@
*
* $Id$
*
- * This is very easy: just erase all the blocks and put the magic at
+ * This is very easy: just erase all the blocks and put the magic at
* the beginning of each block.
*/
@@ -64,7 +64,7 @@
{ NULL, 0, 0, 0 }
};
- int c = getopt_long(argc, argv, short_options,
+ int c = getopt_long(argc, argv, short_options,
long_options, &option_index);
if (c == EOF)
break;
@@ -145,7 +145,7 @@
return 2;
}
- if (pwrite(fd, magic, sizeof(magic), i * mtd_info.erasesize)
+ if (pwrite(fd, magic, sizeof(magic), i * mtd_info.erasesize)
!= sizeof(magic)) {
snprintf(buf, sizeof(buf), "%s: write", mtd_filename);
perror(buf);
Index: summary.h
===================================================================
RCS file: /home/cvs/mtd/util/summary.h,v
retrieving revision 1.5
retrieving revision 1.6
diff -u -r1.5 -r1.6
--- summary.h 26 Sep 2005 11:49:39 -0000 1.5
+++ summary.h 7 Nov 2005 11:15:14 -0000 1.6
@@ -114,7 +114,7 @@
uint8_t name[0]; /* dirent name */
} __attribute__((packed));
-union jffs2_sum_mem
+union jffs2_sum_mem
{
struct jffs2_sum_unknown_mem u;
struct jffs2_sum_inode_mem i;
Index: sumtool.c
===================================================================
RCS file: /home/cvs/mtd/util/sumtool.c,v
retrieving revision 1.7
retrieving revision 1.8
diff -u -r1.7 -r1.8
--- sumtool.c 26 Sep 2005 11:49:39 -0000 1.7
+++ sumtool.c 7 Nov 2005 11:15:14 -0000 1.8
@@ -6,7 +6,7 @@
* University of Szeged, Hungary
*
* $Id$
- *
+ *
* This program is free software; you can redistribute it and/or
* modify it under the terms of the GNU General Public License
* as published by the Free Software Foundation; either version 2
@@ -22,7 +22,7 @@
* Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
*
* Overview:
- * This is a utility insert summary information into JFFS2 image for
+ * This is a utility insert summary information into JFFS2 image for
* faster mount time
*
*/
@@ -375,7 +375,7 @@
jint32_t magic = cpu_to_je32(JFFS2_SUM_MAGIC);
if (!sum_collected->sum_num || !sum_collected->sum_list_head)
- return;
+ return;
datasize = sum_collected->sum_size + sizeof(struct jffs2_sum_marker);
infosize = sizeof(struct jffs2_raw_summary) + datasize;
@@ -690,7 +690,7 @@
printf ("%8s Inode node at 0x%08x, totlen 0x%08x, #ino %5d, version %5d, isize %8d, csize %8d, dsize %8d, offset %8d\n",
obsolete ? "Obsolete" : "",
p - file_buffer, je32_to_cpu (node->i.totlen), je32_to_cpu (node->i.ino),
- je32_to_cpu ( node->i.version), je32_to_cpu (node->i.isize),
+ je32_to_cpu ( node->i.version), je32_to_cpu (node->i.isize),
je32_to_cpu (node->i.csize), je32_to_cpu (node->i.dsize), je32_to_cpu (node->i.offset));
crc = crc32 (0, node, sizeof (struct jffs2_raw_inode) - 8);
- Previous message: mtd/fs/ffs2 ffs2_fs.h, 1.1, 1.2 ffs2_fs_i.h, 1.1, 1.2 ffs2_fs_sb.h,
1.1, 1.2 io.c, 1.1, 1.2 makefile, 1.1, 1.2 super.c, 1.1, 1.2
- Next message: mtd/html/doc Makefile,1.2,1.3
- Messages sorted by:
[ date ]
[ thread ]
[ subject ]
[ author ]
More information about the linux-mtd-cvs
mailing list