From 1058aeb04f03c863b70278f4e72cdcbea411b028 Mon Sep 17 00:00:00 2001 From: topjohnwu Date: Sat, 22 Jun 2019 03:18:45 -0700 Subject: [PATCH] Label current SAR impl as compat The current system-as-root magiskinit implementation (converting root directory in system partition to legacy rootfs setup) is now considered as backwards compatible only. The new implementation that is hide and Android Q friendly is coming soon. --- native/jni/init/early_mount.cpp | 2 +- native/jni/init/init.cpp | 8 ++++---- native/jni/init/init.h | 4 ++-- 3 files changed, 7 insertions(+), 7 deletions(-) diff --git a/native/jni/init/early_mount.cpp b/native/jni/init/early_mount.cpp index 30c501675..3682da96b 100644 --- a/native/jni/init/early_mount.cpp +++ b/native/jni/init/early_mount.cpp @@ -118,7 +118,7 @@ void LegacyInit::early_mount() { mount_root(odm); } -void SARInit::early_mount() { +void SARCompatInit::early_mount() { char partname[32]; char fstype[32]; char block_dev[64]; diff --git a/native/jni/init/init.cpp b/native/jni/init/init.cpp index acad2f4e1..c86b8ff9b 100644 --- a/native/jni/init/init.cpp +++ b/native/jni/init/init.cpp @@ -132,7 +132,7 @@ void LegacyInit::preset() { rename("/.backup/init", "/init"); } -void SARInit::preset() { +void SARCompatInit::preset() { full_read("/init", &self.buf, &self.sz); LOGD("Cleaning rootfs\n"); @@ -168,9 +168,9 @@ public: } }; -class TestInit : public SARInit { +class TestInit : public SARCompatInit { public: - TestInit(char *argv[], cmdline *cmd) : SARInit(argv, cmd) {}; + TestInit(char *argv[], cmdline *cmd) : SARCompatInit(argv, cmd) {}; void start() override { preset(); early_mount(); @@ -219,7 +219,7 @@ int main(int argc, char *argv[]) { if (run_test) { init = make_unique(argv, &cmd); } else if (cmd.system_as_root) { - init = make_unique(argv, &cmd); + init = make_unique(argv, &cmd); } else { decompress_ramdisk(); if (access("/sbin/recovery", F_OK) == 0) diff --git a/native/jni/init/init.h b/native/jni/init/init.h index 2302a3112..3fa6e9490 100644 --- a/native/jni/init/init.h +++ b/native/jni/init/init.h @@ -52,12 +52,12 @@ public: LegacyInit(char *argv[], cmdline *cmd) : MagiskInit(argv, cmd) {}; }; -class SARInit : public MagiskInit { +class SARCompatInit : public MagiskInit { protected: void preset() override; void early_mount() override; public: - SARInit(char *argv[], cmdline *cmd) : MagiskInit(argv, cmd) {}; + SARCompatInit(char *argv[], cmdline *cmd) : MagiskInit(argv, cmd) {}; }; static inline bool is_lnk(const char *name) {