summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorMichael Runge <mrunge@google.com>2014-10-23 23:56:52 +0200
committerAndroid Git Automerger <android-git-automerger@android.com>2014-10-23 23:56:52 +0200
commitda500cecf5b004498c0dd17bc27a30eb4b0b9a2d (patch)
tree621c1ae0e6ce71749fb773feb8c6efef21c9a3ee
parentam 473967d8: Merge "Log to UI any metadata setting errors" into lmp-dev (diff)
parentAllow passing of mount args to mountFn (diff)
downloadandroid_bootable_recovery-da500cecf5b004498c0dd17bc27a30eb4b0b9a2d.tar
android_bootable_recovery-da500cecf5b004498c0dd17bc27a30eb4b0b9a2d.tar.gz
android_bootable_recovery-da500cecf5b004498c0dd17bc27a30eb4b0b9a2d.tar.bz2
android_bootable_recovery-da500cecf5b004498c0dd17bc27a30eb4b0b9a2d.tar.lz
android_bootable_recovery-da500cecf5b004498c0dd17bc27a30eb4b0b9a2d.tar.xz
android_bootable_recovery-da500cecf5b004498c0dd17bc27a30eb4b0b9a2d.tar.zst
android_bootable_recovery-da500cecf5b004498c0dd17bc27a30eb4b0b9a2d.zip
Diffstat (limited to '')
-rw-r--r--updater/install.c23
1 files changed, 18 insertions, 5 deletions
diff --git a/updater/install.c b/updater/install.c
index 17ea4c2b5..282a6188b 100644
--- a/updater/install.c
+++ b/updater/install.c
@@ -91,16 +91,27 @@ char* PrintSha1(const uint8_t* digest) {
// fs_type="ext4" partition_type="EMMC" location=device
Value* MountFn(const char* name, State* state, int argc, Expr* argv[]) {
char* result = NULL;
- if (argc != 4) {
- return ErrorAbort(state, "%s() expects 4 args, got %d", name, argc);
+ if (argc != 4 && argc != 5) {
+ return ErrorAbort(state, "%s() expects 4-5 args, got %d", name, argc);
}
char* fs_type;
char* partition_type;
char* location;
char* mount_point;
- if (ReadArgs(state, argv, 4, &fs_type, &partition_type,
+ char* mount_options;
+ bool has_mount_options;
+ if (argc == 5) {
+ has_mount_options = true;
+ if (ReadArgs(state, argv, 5, &fs_type, &partition_type,
+ &location, &mount_point, &mount_options) < 0) {
+ return NULL;
+ }
+ } else {
+ has_mount_options = false;
+ if (ReadArgs(state, argv, 4, &fs_type, &partition_type,
&location, &mount_point) < 0) {
- return NULL;
+ return NULL;
+ }
}
if (strlen(fs_type) == 0) {
@@ -154,7 +165,8 @@ Value* MountFn(const char* name, State* state, int argc, Expr* argv[]) {
result = mount_point;
} else {
if (mount(location, mount_point, fs_type,
- MS_NOATIME | MS_NODEV | MS_NODIRATIME, "") < 0) {
+ MS_NOATIME | MS_NODEV | MS_NODIRATIME,
+ has_mount_options ? mount_options : "") < 0) {
printf("%s: failed to mount %s at %s: %s\n",
name, location, mount_point, strerror(errno));
result = strdup("");
@@ -168,6 +180,7 @@ done:
free(partition_type);
free(location);
if (result != mount_point) free(mount_point);
+ if (has_mount_options) free(mount_options);
return StringValue(result);
}