Make things more obvious

This commit is contained in:
topjohnwu 2023-04-05 04:01:07 -07:00
parent 9ea859810d
commit 6c3519923d

View File

@ -77,11 +77,6 @@ public:
using BaseInit::BaseInit; using BaseInit::BaseInit;
}; };
class SARBase : public MagiskInit {
public:
using MagiskInit::MagiskInit;
};
/*************** /***************
* 2 Stage Init * 2 Stage Init
***************/ ***************/
@ -99,17 +94,18 @@ public:
} }
}; };
class SecondStageInit : public SARBase { class SecondStageInit : public MagiskInit {
private: private:
bool prepare(); bool prepare();
public: public:
SecondStageInit(char *argv[]) : SARBase(argv) { SecondStageInit(char *argv[]) : MagiskInit(argv) {
setup_klog(); setup_klog();
LOGD("%s\n", __FUNCTION__); LOGD("%s\n", __FUNCTION__);
}; };
void start() override { void start() override {
if (prepare()) bool is_rootfs = prepare();
if (is_rootfs)
patch_rw_root(); patch_rw_root();
else else
patch_ro_root(); patch_ro_root();
@ -121,17 +117,18 @@ public:
* Legacy SAR * Legacy SAR
*************/ *************/
class LegacySARInit : public SARBase { class LegacySARInit : public MagiskInit {
private: private:
bool mount_system_root(); bool mount_system_root();
void first_stage_prep(); void first_stage_prep();
public: public:
LegacySARInit(char *argv[], BootConfig *config) : SARBase(argv, config) { LegacySARInit(char *argv[], BootConfig *config) : MagiskInit(argv, config) {
LOGD("%s\n", __FUNCTION__); LOGD("%s\n", __FUNCTION__);
}; };
void start() override { void start() override {
prepare_data(); prepare_data();
if (mount_system_root()) bool is_two_stage = mount_system_root();
if (is_two_stage)
first_stage_prep(); first_stage_prep();
else else
patch_ro_root(); patch_ro_root();