2 * Copyright (C) 2010 The Android Open Source Project
4 * Licensed under the Apache License, Version 2.0 (the "License");
5 * you may not use this file except in compliance with the License.
6 * You may obtain a copy of the License at
8 * http://www.apache.org/licenses/LICENSE-2.0
10 * Unless required by applicable law or agreed to in writing, software
11 * distributed under the License is distributed on an "AS IS" BASIS,
12 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13 * See the License for the specific language governing permissions and
14 * limitations under the License.
20 #if defined(__linux__)
22 #elif defined(__APPLE__) && defined(__MACH__)
26 #include "make_ext4fs.h"
28 extern struct fs_info info;
31 static void usage(char *path)
33 fprintf(stderr, "%s [ -l <len> ] [ -j <journal size> ] [ -b <block_size> ]\n", basename(path));
34 fprintf(stderr, " [ -g <blocks per group> ] [ -i <inodes> ] [ -I <inode size> ]\n");
35 fprintf(stderr, " [ -L <label> ] [ -f ] [ -a <android mountpoint> ]\n");
36 fprintf(stderr, " [ -z | -s ] [ -J ]\n");
37 fprintf(stderr, " <filename> [<directory>]\n");
40 int main(int argc, char **argv)
43 const char *filename = NULL;
44 const char *directory = NULL;
45 char *mountpoint = "";
51 while ((opt = getopt(argc, argv, "l:j:b:g:i:I:L:a:fzJsc")) != -1) {
54 info.len = parse_num(optarg);
57 info.journal_blocks = parse_num(optarg);
60 info.block_size = parse_num(optarg);
63 info.blocks_per_group = parse_num(optarg);
66 info.inodes = parse_num(optarg);
69 info.inode_size = parse_num(optarg);
100 fprintf(stderr, "Cannot specify both gzip and sparse\n");
105 if (optind >= argc) {
106 fprintf(stderr, "Expected filename after options\n");
111 filename = argv[optind++];
114 directory = argv[optind++];
117 fprintf(stderr, "Unexpected argument: %s\n", argv[optind]);
122 return make_ext4fs_internal(filename, directory, mountpoint, android, gzip,