You've already forked ReZygisk
mirror of
https://github.com/PerformanC/ReZygisk.git
synced 2025-09-06 06:37:01 +00:00
24 lines
680 B
C++
24 lines
680 B
C++
#include <sys/mount.h>
|
|
|
|
#include "logging.h"
|
|
#include "misc.hpp"
|
|
#include "zygisk.hpp"
|
|
|
|
using namespace std::string_view_literals;
|
|
|
|
static void lazy_unmount(const char* mountpoint) {
|
|
if (umount2(mountpoint, MNT_DETACH) != -1)
|
|
LOGD("Unmounted (%s)", mountpoint);
|
|
}
|
|
|
|
#define OVERLAY_MNT(dir) (mentry->mnt_type == "overlay"sv && std::string_view(mentry->mnt_dir).starts_with("/" #dir))
|
|
|
|
void revert_unmount() {
|
|
parse_mnt("/proc/self/mounts", [](mntent* mentry) {
|
|
if (OVERLAY_MNT("system") || OVERLAY_MNT("vendor") || OVERLAY_MNT("product") || OVERLAY_MNT("system_ext")) {
|
|
lazy_unmount(mentry->mnt_fsname);
|
|
}
|
|
return true;
|
|
});
|
|
}
|