diff options
author | Michael Runge <mrunge@google.com> | 2014-11-21 09:12:28 +0100 |
---|---|---|
committer | Michael Runge <mrunge@google.com> | 2014-11-21 22:02:03 +0100 |
commit | b278c252e148798346f85fc92eeea6afeb33fbf0 (patch) | |
tree | 1ffe681a0ce3d4788210d401ef53304724cc104b /updater/install.c | |
parent | Byte swap to support BGRA in recovery mode (diff) | |
download | android_bootable_recovery-b278c252e148798346f85fc92eeea6afeb33fbf0.tar android_bootable_recovery-b278c252e148798346f85fc92eeea6afeb33fbf0.tar.gz android_bootable_recovery-b278c252e148798346f85fc92eeea6afeb33fbf0.tar.bz2 android_bootable_recovery-b278c252e148798346f85fc92eeea6afeb33fbf0.tar.lz android_bootable_recovery-b278c252e148798346f85fc92eeea6afeb33fbf0.tar.xz android_bootable_recovery-b278c252e148798346f85fc92eeea6afeb33fbf0.tar.zst android_bootable_recovery-b278c252e148798346f85fc92eeea6afeb33fbf0.zip |
Diffstat (limited to 'updater/install.c')
-rw-r--r-- | updater/install.c | 33 |
1 files changed, 33 insertions, 0 deletions
diff --git a/updater/install.c b/updater/install.c index ff7de4793..2b2ffb0c5 100644 --- a/updater/install.c +++ b/updater/install.c @@ -46,6 +46,7 @@ #include "mtdutils/mtdutils.h" #include "updater.h" #include "install.h" +#include "tune2fs.h" #ifdef USE_EXT4 #include "make_ext4fs.h" @@ -1539,6 +1540,37 @@ Value* EnableRebootFn(const char* name, State* state, int argc, Expr* argv[]) { return StringValue(strdup("t")); } +Value* Tune2FsFn(const char* name, State* state, int argc, Expr* argv[]) { + if (argc == 0) { + return ErrorAbort(state, "%s() expects args, got %d", name, argc); + } + + char** args = ReadVarArgs(state, argc, argv); + if (args == NULL) { + return ErrorAbort(state, "%s() could not read args", name); + } + + int i; + char** args2 = malloc(sizeof(char*) * (argc+1)); + // Tune2fs expects the program name as its args[0] + args2[0] = strdup(name); + for (i = 0; i < argc; ++i) { + args2[i + 1] = args[i]; + } + int result = tune2fs_main(argc + 1, args2); + for (i = 0; i < argc; ++i) { + free(args[i]); + } + free(args); + + free(args2[0]); + free(args2); + if (result != 0) { + return ErrorAbort(state, "%s() returned error code %d", name, result); + } + return StringValue(strdup("t")); +} + void RegisterInstallFunctions() { RegisterFunction("mount", MountFn); RegisterFunction("is_mounted", IsMountedFn); @@ -1589,4 +1621,5 @@ void RegisterInstallFunctions() { RegisterFunction("set_stage", SetStageFn); RegisterFunction("enable_reboot", EnableRebootFn); + RegisterFunction("tune2fs", Tune2FsFn); } |