Change some class names

This commit is contained in:
topjohnwu 2019-09-22 05:20:51 -04:00
parent ee0cef06a6
commit a52a3e38ed
4 changed files with 18 additions and 18 deletions

View File

@ -121,7 +121,7 @@ if (!is_lnk("/" #name) && read_dt_fstab(#name, partname, fstype)) { \
mnt_##name = true; \
}
void LegacyInit::early_mount() {
void RootFSInit::early_mount() {
full_read("/init", self.buf, self.sz);
LOGD("Reverting /init\n");
@ -183,7 +183,7 @@ static void switch_root(const string &path) {
chroot(".");
}
void SARCommon::backup_files() {
void SARBase::backup_files() {
if (access("/overlay.d", F_OK) == 0)
cp_afc("/overlay.d", "/dev/overlay.d");

View File

@ -220,7 +220,7 @@ int main(int argc, char *argv[]) {
else if (access("/apex", F_OK) == 0)
init = make_unique<AFirstStageInit>(argv, &cmd);
else
init = make_unique<LegacyInit>(argv, &cmd);
init = make_unique<RootFSInit>(argv, &cmd);
}
// Run the main routine

View File

@ -67,13 +67,13 @@ public:
MagiskInit(char *argv[], cmdline *cmd) : BaseInit(argv, cmd) {};
};
class RootFSInit : public MagiskInit {
class RootFSBase : public MagiskInit {
protected:
int root = -1;
virtual void setup_rootfs();
public:
RootFSInit(char *argv[], cmdline *cmd) : MagiskInit(argv, cmd) {};
RootFSBase(char *argv[], cmdline *cmd) : MagiskInit(argv, cmd) {};
void start() override {
early_mount();
setup_rootfs();
@ -81,7 +81,7 @@ public:
}
};
class SARCommon : public MagiskInit {
class SARBase : public MagiskInit {
protected:
raw_data config;
dev_t system_dev;
@ -89,7 +89,7 @@ protected:
void backup_files();
void patch_rootdir();
public:
SARCommon(char *argv[], cmdline *cmd) : MagiskInit(argv, cmd) {};
SARBase(char *argv[], cmdline *cmd) : MagiskInit(argv, cmd) {};
void start() override {
early_mount();
patch_rootdir();
@ -123,46 +123,46 @@ public:
}
};
class SecondStageInit : public SARCommon {
class SecondStageInit : public SARBase {
protected:
void early_mount() override;
void cleanup() override { /* Do not do any cleanup */ }
public:
SecondStageInit(char *argv[]) : SARCommon(argv, nullptr) {};
SecondStageInit(char *argv[]) : SARBase(argv, nullptr) {};
};
/* ***********
* Legacy SAR
* ***********/
class SARInit : public SARCommon {
class SARInit : public SARBase {
protected:
void early_mount() override;
public:
SARInit(char *argv[], cmdline *cmd) : SARCommon(argv, cmd) {};
SARInit(char *argv[], cmdline *cmd) : SARBase(argv, cmd) {};
};
/* **********
* Initramfs
* **********/
class LegacyInit : public RootFSInit {
class RootFSInit : public RootFSBase {
protected:
void early_mount() override;
public:
LegacyInit(char *argv[], cmdline *cmd) : RootFSInit(argv, cmd) {};
RootFSInit(char *argv[], cmdline *cmd) : RootFSBase(argv, cmd) {};
};
/* ****************
* Compat-mode SAR
* ****************/
class SARCompatInit : public RootFSInit {
class SARCompatInit : public RootFSBase {
protected:
void early_mount() override;
void setup_rootfs() override;
public:
SARCompatInit(char *argv[], cmdline *cmd) : RootFSInit(argv, cmd) {};
SARCompatInit(char *argv[], cmdline *cmd) : RootFSBase(argv, cmd) {};
};
void load_kernel_info(cmdline *cmd);

View File

@ -86,7 +86,7 @@ static void load_overlay_rc(int dirfd) {
rewinddir(dir);
}
void RootFSInit::setup_rootfs() {
void RootFSBase::setup_rootfs() {
if (patch_sepolicy()) {
char *addr;
size_t size;
@ -149,7 +149,7 @@ void SARCompatInit::setup_rootfs() {
clone_dir(system_root, root, false);
close(system_root);
RootFSInit::setup_rootfs();
RootFSBase::setup_rootfs();
}
bool MagiskInit::patch_sepolicy(const char *file) {
@ -256,7 +256,7 @@ static void magic_mount(int dirfd, const string &path) {
}
}
void SARCommon::patch_rootdir() {
void SARBase::patch_rootdir() {
sbin_overlay(self, config);
// Mount system_root mirror