mirror of
https://github.com/topjohnwu/Magisk.git
synced 2026-01-02 16:00:47 -08:00
Rename dir name
This commit is contained in:
@@ -100,8 +100,6 @@ static dev_t setup_block() {
|
||||
return 0;
|
||||
}
|
||||
|
||||
#define PREINITMNT MIRRDIR "/preinit"
|
||||
|
||||
static void mount_preinit_dir(string preinit_dev) {
|
||||
if (preinit_dev.empty()) return;
|
||||
strcpy(blk_info.partname, preinit_dev.data());
|
||||
@@ -111,13 +109,13 @@ static void mount_preinit_dir(string preinit_dev) {
|
||||
LOGE("Cannot find preinit %s, abort!\n", preinit_dev.data());
|
||||
return;
|
||||
}
|
||||
xmkdir(PREINITMNT, 0);
|
||||
xmkdir(MIRRDIR, 0);
|
||||
bool mounted = false;
|
||||
// First, find if it is already mounted
|
||||
std::string mnt_point;
|
||||
if (rust::is_device_mounted(dev, mnt_point)) {
|
||||
// Already mounted, just bind mount
|
||||
xmount(mnt_point.data(), PREINITMNT, nullptr, MS_BIND, nullptr);
|
||||
xmount(mnt_point.data(), MIRRDIR, nullptr, MS_BIND, nullptr);
|
||||
mounted = true;
|
||||
}
|
||||
|
||||
@@ -125,9 +123,9 @@ static void mount_preinit_dir(string preinit_dev) {
|
||||
// as read-only, or else the kernel might crash due to crappy drivers.
|
||||
// After the device boots up, magiskd will properly bind mount the correct partition
|
||||
// on to PREINITMIRR as writable. For more details, check bootstages.cpp
|
||||
if (mounted || mount(PREINITDEV, PREINITMNT, "ext4", MS_RDONLY, nullptr) == 0 ||
|
||||
mount(PREINITDEV, PREINITMNT, "f2fs", MS_RDONLY, nullptr) == 0) {
|
||||
string preinit_dir = resolve_preinit_dir(PREINITMNT);
|
||||
if (mounted || mount(PREINITDEV, MIRRDIR, "ext4", MS_RDONLY, nullptr) == 0 ||
|
||||
mount(PREINITDEV, MIRRDIR, "f2fs", MS_RDONLY, nullptr) == 0) {
|
||||
string preinit_dir = resolve_preinit_dir(MIRRDIR);
|
||||
// Create bind mount
|
||||
xmkdirs(PREINITMIRR, 0);
|
||||
if (access(preinit_dir.data(), F_OK)) {
|
||||
@@ -136,7 +134,7 @@ static void mount_preinit_dir(string preinit_dev) {
|
||||
LOGD("preinit: %s\n", preinit_dir.data());
|
||||
xmount(preinit_dir.data(), PREINITMIRR, nullptr, MS_BIND, nullptr);
|
||||
}
|
||||
xumount2(PREINITMNT, MNT_DETACH);
|
||||
xumount2(MIRRDIR, MNT_DETACH);
|
||||
} else {
|
||||
PLOGE("Failed to mount preinit %s\n", preinit_dev.data());
|
||||
unlink(PREINITDEV);
|
||||
@@ -237,9 +235,7 @@ void MagiskInit::setup_tmp(const char *path) {
|
||||
chdir("/data");
|
||||
|
||||
xmkdir(INTLROOT, 0711);
|
||||
xmkdir(MIRRDIR, 0);
|
||||
xmkdir(BLOCKDIR, 0);
|
||||
xmkdir(WORKERDIR, 0);
|
||||
xmkdir(DEVICEDIR, 0711);
|
||||
|
||||
mount_preinit_dir(preinit_dev);
|
||||
|
||||
|
||||
Reference in New Issue
Block a user