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 = "";
50 while ((opt = getopt(argc, argv, "l:j:b:g:i:I:L:a:fzJs")) != -1) {
53 info.len = parse_num(optarg);
56 info.journal_blocks = parse_num(optarg);
59 info.block_size = parse_num(optarg);
62 info.blocks_per_group = parse_num(optarg);
65 info.inodes = parse_num(optarg);
68 info.inode_size = parse_num(optarg);
96 fprintf(stderr, "Cannot specify both gzip and sparse\n");
101 if (optind >= argc) {
102 fprintf(stderr, "Expected filename after options\n");
107 filename = argv[optind++];
110 directory = argv[optind++];
113 fprintf(stderr, "Unexpected argument: %s\n", argv[optind]);
118 return make_ext4fs(filename, directory, mountpoint, android, gzip, sparse);