shithub: lwext4

Download patch

ref: 69140168fc01b4bddb8bee96e9e34a238898b2c4
parent: 3a0b63fa2dd085a7b9410678a33b71e0647492d4
author: gkostka <[email protected]>
date: Tue Nov 17 16:24:05 EST 2015

Add block size cli option to mkfs tool

--- a/fs_test/lwext4_mkfs.c
+++ b/fs_test/lwext4_mkfs.c
@@ -52,9 +52,10 @@
 static bool winpart = false;
 
 static struct ext4_fs fs;
+static struct ext4_mkfs_info info = {
+	.block_size = 4096,
+};
 
-static struct ext4_mkfs_info info;
-
 static bool verbose = false;
 
 static const char *usage = "                                    \n\
@@ -64,6 +65,7 @@
 [-i] --input   - input file name (or blockdevice)               \n\
 [-w] --wpart   - windows partition mode                         \n\
 [-v] --verbose - verbose mode		                        \n\
+[-b] --block   - block size: 1024, 2048 ... 65536 (default 4096)\n\
 \n";
 
 
@@ -115,16 +117,20 @@
 
 	static struct option long_options[] = {
 	    {"input", required_argument, 0, 'i'},
+	    {"block", required_argument, 0, 'b'},
 	    {"wpart", no_argument, 0, 'w'},
 	    {"verbose", no_argument, 0, 'v'},
 	    {0, 0, 0, 0}};
 
-	while (-1 != (c = getopt_long(argc, argv, "i:wv",
+	while (-1 != (c = getopt_long(argc, argv, "i:b:wv",
 				      long_options, &option_index))) {
 
 		switch (c) {
 		case 'i':
 			input_name = optarg;
+			break;
+		case 'b':
+			info.block_size = atoi(optarg);
 			break;
 		case 'w':
 			winpart = true;