Donate to e Foundation | Murena handsets with /e/OS | Own a part of Murena! Learn more

Commit 8243f665 authored by Mark Salyzyn's avatar Mark Salyzyn
Browse files

fs_mgr: __mount better detail for ENOENT

By telling us that the target or source is missing for ENOENT, we
can triage whether it is a build/configuration problem or a driver
problem.  Two engineers spend more than a few hours investigating
a build problem rationalizing adding this instrumentation.

Test: compile
Bug: 109821005
Change-Id: I1ecc6230ebee128c0963d6020787230c1e2fb8c1
parent db8b2afe
Loading
Loading
Loading
Loading
+12 −2
Original line number Diff line number Diff line
@@ -529,8 +529,18 @@ static int __mount(const char *source, const char *target, const struct fstab_re
    errno = 0;
    ret = mount(source, target, rec->fs_type, mountflags, rec->fs_options);
    save_errno = errno;
    PINFO << __FUNCTION__ << "(source=" << source << ",target=" << target
          << ",type=" << rec->fs_type << ")=" << ret;
    const char* target_missing = "";
    const char* source_missing = "";
    if (save_errno == ENOENT) {
        if (access(target, F_OK)) {
            target_missing = "(missing)";
        } else if (access(source, F_OK)) {
            source_missing = "(missing)";
        }
        errno = save_errno;
    }
    PINFO << __FUNCTION__ << "(source=" << source << source_missing << ",target=" << target
          << target_missing << ",type=" << rec->fs_type << ")=" << ret;
    if ((ret == 0) && (mountflags & MS_RDONLY) != 0) {
        fs_mgr_set_blk_ro(source);
    }