summaryrefslogtreecommitdiffstats
path: root/updater/install.c
diff options
context:
space:
mode:
authorEthan Yonker <dees_troy@teamw.in>2015-03-13 19:44:21 +0100
committerEthan Yonker <dees_troy@teamw.in>2015-03-13 19:44:21 +0100
commitf5c2d6ce24d77aa7c38544c6d2f55400237fdbe5 (patch)
tree0022cc15b5011d8eb5940724b3f4cb7acab2594e /updater/install.c
parentAdd UI for entering pattern for device decryption (diff)
parentmerge in lmp-mr1-release history after reset to lmp-mr1-dev (diff)
downloadandroid_bootable_recovery-f5c2d6ce24d77aa7c38544c6d2f55400237fdbe5.tar
android_bootable_recovery-f5c2d6ce24d77aa7c38544c6d2f55400237fdbe5.tar.gz
android_bootable_recovery-f5c2d6ce24d77aa7c38544c6d2f55400237fdbe5.tar.bz2
android_bootable_recovery-f5c2d6ce24d77aa7c38544c6d2f55400237fdbe5.tar.lz
android_bootable_recovery-f5c2d6ce24d77aa7c38544c6d2f55400237fdbe5.tar.xz
android_bootable_recovery-f5c2d6ce24d77aa7c38544c6d2f55400237fdbe5.tar.zst
android_bootable_recovery-f5c2d6ce24d77aa7c38544c6d2f55400237fdbe5.zip
Diffstat (limited to 'updater/install.c')
-rw-r--r--updater/install.c33
1 files changed, 33 insertions, 0 deletions
diff --git a/updater/install.c b/updater/install.c
index 003064799..20ee431de 100644
--- a/updater/install.c
+++ b/updater/install.c
@@ -48,6 +48,7 @@
#include "applypatch/applypatch.h"
#include "flashutils/flashutils.h"
#include "install.h"
+#include "tune2fs.h"
#ifdef USE_EXT4
#include "make_ext4fs.h"
@@ -1489,6 +1490,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);
@@ -1539,4 +1571,5 @@ void RegisterInstallFunctions() {
RegisterFunction("set_stage", SetStageFn);
RegisterFunction("enable_reboot", EnableRebootFn);
+ RegisterFunction("tune2fs", Tune2FsFn);
}