MCPcopy Create free account
hub / github.com/MhmRdd/NoHello / remount

Function remount

module/src/main/cpp/nohello.cpp:244–285  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

242}
243
244static void remount(const std::vector<MountInfo>& mounts) {
245 for (const auto& mount : mounts) {
246 if (mount.getMountPoint() == "/data") {
247 const auto& mntopts = mount.getMountOptions();
248 const auto& fm = mntopts.flagmap;
249 if (!fm.count("errors"))
250 break;
251 auto errors = getExternalErrorBehaviour(mount);
252 if (!errors || fm.at("errors") == *errors)
253 break;
254 auto mntflags = mount.getFlags();
255 unsigned int flags = MS_REMOUNT;
256 if (mntflags & MountFlags::NOSUID) {
257 flags |= MS_NOSUID;
258 }
259 if (mntflags & MountFlags::NODEV) {
260 flags |= MS_NODEV;
261 }
262 if (mntflags & MountFlags::NOEXEC) {
263 flags |= MS_NOEXEC;
264 }
265 if (mntflags & MountFlags::NOATIME) {
266 flags |= MS_NOATIME;
267 }
268 if (mntflags & MountFlags::NODIRATIME) {
269 flags |= MS_NODIRATIME;
270 }
271 if (mntflags & MountFlags::RELATIME) {
272 flags |= MS_RELATIME;
273 }
274 if (mntflags & MountFlags::NOSYMFOLLOW) {
275 flags |= MS_NOSYMFOLLOW;
276 }
277 int res;
278 if ((res = ::mount(nullptr, "/data", nullptr, flags, (std::string("errors=") + *errors).c_str())) == 0)
279 LOGD("mount(nullptr, \"/data\", nullptr, 0x%x, \"errors=%s\"): returned 0: 0 (Success)", flags, errors->c_str());
280 else
281 LOGW("mount(NULL, \"/data\", NULL, 0x%x, \"errors=%s\"): returned %d: %d (%s)", flags, errors->c_str(), res, errno, strerror(errno));
282 break;
283 }
284 }
285}
286
287int (*ar_unshare)(int) = nullptr;
288

Callers 1

NoRootFunction · 0.85

Calls 2

getFlagsMethod · 0.45

Tested by

no test coverage detected