mtd/util mkfs.jffs2.c,1.39,1.40
David Woodhouse
dwmw2 at infradead.org
Sun Feb 15 12:22:01 EST 2004
Update of /home/cvs/mtd/util
In directory phoenix.infradead.org:/tmp/cvs-serv8228
Modified Files:
mkfs.jffs2.c
Log Message:
Recognise KiB/MiB in erasesize arg.
Index: mkfs.jffs2.c
===================================================================
RCS file: /home/cvs/mtd/util/mkfs.jffs2.c,v
retrieving revision 1.39
retrieving revision 1.40
diff -u -r1.39 -r1.40
--- mkfs.jffs2.c 12 Sep 2003 09:09:37 -0000 1.39
+++ mkfs.jffs2.c 15 Feb 2004 17:21:58 -0000 1.40
@@ -1284,17 +1284,37 @@
error_msg_and_die("revision %.*s\n",
(int) strlen(revtext) - 13, revtext + 11);
- case 'e':
- erase_block_size = strtol(optarg, NULL, 0);
- /* If it's less than 4096, assume they meant KiB */
- if (erase_block_size && erase_block_size < 0x1000)
- erase_block_size *= 1024;
+ case 'e': {
+ char *next;
+ unsigned units = 0;
+ erase_block_size = strtol(optarg, &next, 0);
+ if (!erase_block_size)
+ error_msg_and_die("Unrecognisable erase size\n");
+
+ if (*next) {
+ if (!strcmp(next, "KiB")) {
+ units = 1024;
+ } else if (!strcmp(next, "MiB")) {
+ units = 1024 * 1024;
+ } else {
+ error_msg_and_die("Unknown units in erasesize\n");
+ }
+ } else {
+ if (erase_block_size < 0x1000)
+ units = 1024;
+ else
+ units = 1;
+ }
+ erase_block_size *= units;
+
/* If it's less than 8KiB, they're not allowed */
if (erase_block_size < 0x2000) {
- fprintf(stderr, "Increasing erase size to 8KiB minimum\n");
+ fprintf(stderr, "Erase size 0x%x too small. Increasing to 8KiB minimum\n",
+ erase_block_size);
erase_block_size = 0x2000;
}
break;
+ }
case 'l':
target_endian = __LITTLE_ENDIAN;
More information about the linux-mtd-cvs
mailing list