summaryrefslogtreecommitdiff
path: root/ext4_utils/make_ext4fs_main.c
diff options
context:
space:
mode:
authorMohamad Ayyash <mkayyash@google.com>2016-02-20 03:46:00 +0000
committerMohamad Ayyash <mkayyash@google.com>2016-02-23 22:53:47 +0000
commit9579198cd7d5b88b3508f1b00ddd77bd8da60682 (patch)
tree8a2de266a9e6beb821d74c9a3fee1c770d517dfb /ext4_utils/make_ext4fs_main.c
parent18785a86a30135ac65b88db9886bfc22d6608849 (diff)
downloadextras-9579198cd7d5b88b3508f1b00ddd77bd8da60682.tar.gz
Redesign make_ext4fs to incrementally generate ext4 images
Allows passing a base fs mapping file through -d which preserves the location of those mapping in existing files Internal Design Doc: go/incremental-ext4 BUG: 26839493 Change-Id: I05e296693429d39466d257d1d0a3daf00510dc26 Signed-off-by: Mohamad Ayyash <mkayyash@google.com>
Diffstat (limited to 'ext4_utils/make_ext4fs_main.c')
-rw-r--r--ext4_utils/make_ext4fs_main.c26
1 files changed, 24 insertions, 2 deletions
diff --git a/ext4_utils/make_ext4fs_main.c b/ext4_utils/make_ext4fs_main.c
index 03872db6..56ced5b5 100644
--- a/ext4_utils/make_ext4fs_main.c
+++ b/ext4_utils/make_ext4fs_main.c
@@ -57,6 +57,7 @@ static void usage(char *path)
fprintf(stderr, " [ -L <label> ] [ -f ] [ -a <android mountpoint> ] [ -u ]\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, " [ -d <base_alloc_file_in> ] [ -D <base_alloc_file_out> ]\n");
fprintf(stderr, " <filename> [[<directory>] <target_out_directory>]\n");
}
@@ -80,11 +81,13 @@ int main(int argc, char **argv)
time_t fixed_time = -1;
struct selabel_handle *sehnd = NULL;
FILE* block_list_file = NULL;
+ FILE* base_alloc_file_in = NULL;
+ FILE* base_alloc_file_out = NULL;
#ifndef USE_MINGW
struct selinux_opt seopts[] = { { SELABEL_OPT_PATH, "" } };
#endif
- while ((opt = getopt(argc, argv, "l:j:b:g:i:I:L:a:S:T:C:B:fwzJsctvu")) != -1) {
+ while ((opt = getopt(argc, argv, "l:j:b:g:i:I:L:a:S:T:C:B:d:D:fwzJsctvu")) != -1) {
switch (opt) {
case 'l':
info.len = parse_num(optarg);
@@ -166,6 +169,20 @@ int main(int argc, char **argv)
exit(EXIT_FAILURE);
}
break;
+ case 'd':
+ base_alloc_file_in = fopen(optarg, "r");
+ if (base_alloc_file_in == NULL) {
+ fprintf(stderr, "failed to open base_alloc_file_in: %s\n", strerror(errno));
+ exit(EXIT_FAILURE);
+ }
+ break;
+ case 'D':
+ base_alloc_file_out = fopen(optarg, "w");
+ if (base_alloc_file_out == NULL) {
+ fprintf(stderr, "failed to open base_alloc_file_out: %s\n", strerror(errno));
+ exit(EXIT_FAILURE);
+ }
+ break;
default: /* '?' */
usage(argv[0]);
exit(EXIT_FAILURE);
@@ -237,10 +254,15 @@ int main(int argc, char **argv)
}
exitcode = make_ext4fs_internal(fd, directory, target_out_directory, mountpoint, fs_config_func, gzip,
- sparse, crc, wipe, real_uuid, sehnd, verbose, fixed_time, block_list_file);
+ sparse, crc, wipe, real_uuid, sehnd, verbose, fixed_time,
+ block_list_file, base_alloc_file_in, base_alloc_file_out);
close(fd);
if (block_list_file)
fclose(block_list_file);
+ if (base_alloc_file_out)
+ fclose(base_alloc_file_out);
+ if (base_alloc_file_in)
+ fclose(base_alloc_file_in);
if (exitcode && strcmp(filename, "-"))
unlink(filename);
return exitcode;