Change some class names
This commit is contained in:
parent
ee0cef06a6
commit
a52a3e38ed
@ -121,7 +121,7 @@ if (!is_lnk("/" #name) && read_dt_fstab(#name, partname, fstype)) { \
|
|||||||
mnt_##name = true; \
|
mnt_##name = true; \
|
||||||
}
|
}
|
||||||
|
|
||||||
void LegacyInit::early_mount() {
|
void RootFSInit::early_mount() {
|
||||||
full_read("/init", self.buf, self.sz);
|
full_read("/init", self.buf, self.sz);
|
||||||
|
|
||||||
LOGD("Reverting /init\n");
|
LOGD("Reverting /init\n");
|
||||||
@ -183,7 +183,7 @@ static void switch_root(const string &path) {
|
|||||||
chroot(".");
|
chroot(".");
|
||||||
}
|
}
|
||||||
|
|
||||||
void SARCommon::backup_files() {
|
void SARBase::backup_files() {
|
||||||
if (access("/overlay.d", F_OK) == 0)
|
if (access("/overlay.d", F_OK) == 0)
|
||||||
cp_afc("/overlay.d", "/dev/overlay.d");
|
cp_afc("/overlay.d", "/dev/overlay.d");
|
||||||
|
|
||||||
|
@ -220,7 +220,7 @@ int main(int argc, char *argv[]) {
|
|||||||
else if (access("/apex", F_OK) == 0)
|
else if (access("/apex", F_OK) == 0)
|
||||||
init = make_unique<AFirstStageInit>(argv, &cmd);
|
init = make_unique<AFirstStageInit>(argv, &cmd);
|
||||||
else
|
else
|
||||||
init = make_unique<LegacyInit>(argv, &cmd);
|
init = make_unique<RootFSInit>(argv, &cmd);
|
||||||
}
|
}
|
||||||
|
|
||||||
// Run the main routine
|
// Run the main routine
|
||||||
|
@ -67,13 +67,13 @@ public:
|
|||||||
MagiskInit(char *argv[], cmdline *cmd) : BaseInit(argv, cmd) {};
|
MagiskInit(char *argv[], cmdline *cmd) : BaseInit(argv, cmd) {};
|
||||||
};
|
};
|
||||||
|
|
||||||
class RootFSInit : public MagiskInit {
|
class RootFSBase : public MagiskInit {
|
||||||
protected:
|
protected:
|
||||||
int root = -1;
|
int root = -1;
|
||||||
|
|
||||||
virtual void setup_rootfs();
|
virtual void setup_rootfs();
|
||||||
public:
|
public:
|
||||||
RootFSInit(char *argv[], cmdline *cmd) : MagiskInit(argv, cmd) {};
|
RootFSBase(char *argv[], cmdline *cmd) : MagiskInit(argv, cmd) {};
|
||||||
void start() override {
|
void start() override {
|
||||||
early_mount();
|
early_mount();
|
||||||
setup_rootfs();
|
setup_rootfs();
|
||||||
@ -81,7 +81,7 @@ public:
|
|||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
|
||||||
class SARCommon : public MagiskInit {
|
class SARBase : public MagiskInit {
|
||||||
protected:
|
protected:
|
||||||
raw_data config;
|
raw_data config;
|
||||||
dev_t system_dev;
|
dev_t system_dev;
|
||||||
@ -89,7 +89,7 @@ protected:
|
|||||||
void backup_files();
|
void backup_files();
|
||||||
void patch_rootdir();
|
void patch_rootdir();
|
||||||
public:
|
public:
|
||||||
SARCommon(char *argv[], cmdline *cmd) : MagiskInit(argv, cmd) {};
|
SARBase(char *argv[], cmdline *cmd) : MagiskInit(argv, cmd) {};
|
||||||
void start() override {
|
void start() override {
|
||||||
early_mount();
|
early_mount();
|
||||||
patch_rootdir();
|
patch_rootdir();
|
||||||
@ -123,46 +123,46 @@ public:
|
|||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
|
||||||
class SecondStageInit : public SARCommon {
|
class SecondStageInit : public SARBase {
|
||||||
protected:
|
protected:
|
||||||
void early_mount() override;
|
void early_mount() override;
|
||||||
void cleanup() override { /* Do not do any cleanup */ }
|
void cleanup() override { /* Do not do any cleanup */ }
|
||||||
public:
|
public:
|
||||||
SecondStageInit(char *argv[]) : SARCommon(argv, nullptr) {};
|
SecondStageInit(char *argv[]) : SARBase(argv, nullptr) {};
|
||||||
};
|
};
|
||||||
|
|
||||||
/* ***********
|
/* ***********
|
||||||
* Legacy SAR
|
* Legacy SAR
|
||||||
* ***********/
|
* ***********/
|
||||||
|
|
||||||
class SARInit : public SARCommon {
|
class SARInit : public SARBase {
|
||||||
protected:
|
protected:
|
||||||
void early_mount() override;
|
void early_mount() override;
|
||||||
public:
|
public:
|
||||||
SARInit(char *argv[], cmdline *cmd) : SARCommon(argv, cmd) {};
|
SARInit(char *argv[], cmdline *cmd) : SARBase(argv, cmd) {};
|
||||||
};
|
};
|
||||||
|
|
||||||
/* **********
|
/* **********
|
||||||
* Initramfs
|
* Initramfs
|
||||||
* **********/
|
* **********/
|
||||||
|
|
||||||
class LegacyInit : public RootFSInit {
|
class RootFSInit : public RootFSBase {
|
||||||
protected:
|
protected:
|
||||||
void early_mount() override;
|
void early_mount() override;
|
||||||
public:
|
public:
|
||||||
LegacyInit(char *argv[], cmdline *cmd) : RootFSInit(argv, cmd) {};
|
RootFSInit(char *argv[], cmdline *cmd) : RootFSBase(argv, cmd) {};
|
||||||
};
|
};
|
||||||
|
|
||||||
/* ****************
|
/* ****************
|
||||||
* Compat-mode SAR
|
* Compat-mode SAR
|
||||||
* ****************/
|
* ****************/
|
||||||
|
|
||||||
class SARCompatInit : public RootFSInit {
|
class SARCompatInit : public RootFSBase {
|
||||||
protected:
|
protected:
|
||||||
void early_mount() override;
|
void early_mount() override;
|
||||||
void setup_rootfs() override;
|
void setup_rootfs() override;
|
||||||
public:
|
public:
|
||||||
SARCompatInit(char *argv[], cmdline *cmd) : RootFSInit(argv, cmd) {};
|
SARCompatInit(char *argv[], cmdline *cmd) : RootFSBase(argv, cmd) {};
|
||||||
};
|
};
|
||||||
|
|
||||||
void load_kernel_info(cmdline *cmd);
|
void load_kernel_info(cmdline *cmd);
|
||||||
|
@ -86,7 +86,7 @@ static void load_overlay_rc(int dirfd) {
|
|||||||
rewinddir(dir);
|
rewinddir(dir);
|
||||||
}
|
}
|
||||||
|
|
||||||
void RootFSInit::setup_rootfs() {
|
void RootFSBase::setup_rootfs() {
|
||||||
if (patch_sepolicy()) {
|
if (patch_sepolicy()) {
|
||||||
char *addr;
|
char *addr;
|
||||||
size_t size;
|
size_t size;
|
||||||
@ -149,7 +149,7 @@ void SARCompatInit::setup_rootfs() {
|
|||||||
clone_dir(system_root, root, false);
|
clone_dir(system_root, root, false);
|
||||||
close(system_root);
|
close(system_root);
|
||||||
|
|
||||||
RootFSInit::setup_rootfs();
|
RootFSBase::setup_rootfs();
|
||||||
}
|
}
|
||||||
|
|
||||||
bool MagiskInit::patch_sepolicy(const char *file) {
|
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);
|
sbin_overlay(self, config);
|
||||||
|
|
||||||
// Mount system_root mirror
|
// Mount system_root mirror
|
||||||
|
Loading…
Reference in New Issue
Block a user