Allow specifying reserved blocks percentage
[project/make_ext4fs.git] / make_ext4fs_main.c
index ebfe813..88254c3 100644 (file)
@@ -25,7 +25,6 @@
 #include <sys/disk.h>
 #endif
 
-#include "make_ext4fs.h"
 #include "ext4_utils.h"
 #include "canned_fs_config.h"
 
@@ -36,7 +35,7 @@ static void usage(char *path)
 {
        fprintf(stderr, "%s [ -l <len> ] [ -j <journal size> ] [ -b <block_size> ]\n", basename(path));
        fprintf(stderr, "    [ -g <blocks per group> ] [ -i <inodes> ] [ -I <inode size> ]\n");
-       fprintf(stderr, "    [ -L <label> ] [ -f ] [ -a <android mountpoint> ]\n");
+       fprintf(stderr, "    [ -m <reserved blocks percent> ] [ -L <label> ] [ -f ]\n");
        fprintf(stderr, "    [ -S file_contexts ] [ -C fs_config ] [ -T timestamp ]\n");
        fprintf(stderr, "    [ -z | -s ] [ -w ] [ -c ] [ -J ] [ -v ] [ -B <block_list_file> ]\n");
        fprintf(stderr, "    <filename> [<directory>]\n");
@@ -47,7 +46,6 @@ int main(int argc, char **argv)
        int opt;
        const char *filename = NULL;
        const char *directory = NULL;
-       char *mountpoint = NULL;
        fs_config_func_t fs_config_func = NULL;
        const char *fs_config_file = NULL;
        int gzip = 0;
@@ -60,7 +58,7 @@ int main(int argc, char **argv)
        time_t fixed_time = -1;
        FILE* block_list_file = NULL;
 
-       while ((opt = getopt(argc, argv, "l:j:b:g:i:I:L:T:C:B:fwzJsctv")) != -1) {
+       while ((opt = getopt(argc, argv, "l:j:b:g:i:I:L:T:C:B:m:fwzJsctv")) != -1) {
                switch (opt) {
                case 'l':
                        info.len = parse_num(optarg);
@@ -120,6 +118,9 @@ int main(int argc, char **argv)
                                exit(EXIT_FAILURE);
                        }
                        break;
+               case 'm':
+                       info.reserve_pcnt = strtoul(optarg, NULL, 0);
+                       break;
                default: /* '?' */
                        usage(argv[0]);
                        exit(EXIT_FAILURE);
@@ -173,7 +174,7 @@ int main(int argc, char **argv)
                fd = STDOUT_FILENO;
        }
 
-       exitcode = make_ext4fs_internal(fd, directory, mountpoint, fs_config_func, gzip,
+       exitcode = make_ext4fs_internal(fd, directory, fs_config_func, gzip,
                sparse, crc, wipe, verbose, fixed_time, block_list_file);
        close(fd);
        if (block_list_file)