summaryrefslogtreecommitdiff
path: root/ext4_utils/make_ext4fs_main.c
diff options
context:
space:
mode:
authorKenny Root <kroot@google.com>2012-03-29 14:43:22 -0700
committerKenny Root <kroot@google.com>2012-03-29 14:43:22 -0700
commit68e3dfd81ddb9367a0c3e0c72148c23a3227ed48 (patch)
tree39315ef958b1501e8083a00c1d3988f8eda13817 /ext4_utils/make_ext4fs_main.c
parent8d502bc82f31f340b15be7a65fd540127e99b51f (diff)
downloadextras-68e3dfd81ddb9367a0c3e0c72148c23a3227ed48.tar.gz
make_ext4fs: Allow custom filesystem configs
Before we used the "fs_config" function from android_filesystem_config.h, but we want to use make_ext4fs with ASEC containers which will not always be mounted in the same place. Bug: 6258335 Change-Id: Icf62e3c46425f01434bf92a9823f8d542b0fa5b1
Diffstat (limited to 'ext4_utils/make_ext4fs_main.c')
-rw-r--r--ext4_utils/make_ext4fs_main.c16
1 files changed, 13 insertions, 3 deletions
diff --git a/ext4_utils/make_ext4fs_main.c b/ext4_utils/make_ext4fs_main.c
index d9e1de7a..3aab7954 100644
--- a/ext4_utils/make_ext4fs_main.c
+++ b/ext4_utils/make_ext4fs_main.c
@@ -24,6 +24,10 @@
#include <sys/disk.h>
#endif
+#ifdef ANDROID
+#include <private/android_filesystem_config.h>
+#endif
+
#include "make_ext4fs.h"
#ifndef USE_MINGW /* O_BINARY is windows-specific flag */
@@ -48,7 +52,7 @@ int main(int argc, char **argv)
const char *filename = NULL;
const char *directory = NULL;
char *mountpoint = "";
- int android = 0;
+ fs_config_func_t fs_config_func = NULL;
int gzip = 0;
int sparse = 0;
int crc = 0;
@@ -84,8 +88,14 @@ int main(int argc, char **argv)
force = 1;
break;
case 'a':
- android = 1;
+#ifdef ANDROID
+ fs_config_func = fs_config;
mountpoint = optarg;
+#else
+ fprintf(stderr, "can't set android permissions - built without android support\n");
+ usage(argv[0]);
+ exit(EXIT_FAILURE);
+#endif
break;
case 'w':
wipe = 1;
@@ -156,7 +166,7 @@ int main(int argc, char **argv)
fd = STDOUT_FILENO;
}
- exitcode = make_ext4fs_internal(fd, directory, mountpoint, android, gzip,
+ exitcode = make_ext4fs_internal(fd, directory, mountpoint, fs_config_func, gzip,
sparse, crc, wipe, init_itabs);
close(fd);