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

Commit 02e89ecd authored by Wei Wang's avatar Wei Wang
Browse files

fsmgr: print unabbreviated log when exec child commands

logs need to be printed at time when it is generated by the child
process which is very useful to understand the boottime impact of
those blocking commands.

Bug: 149418646
Test: boot
Change-Id: Ibee343af6088d57b2976bceb812abb58f3b3f610
parent e6f2b7d8
Loading
Loading
Loading
Loading
+6 −5
Original line number Diff line number Diff line
@@ -234,10 +234,11 @@ static void check_fs(const std::string& blk_device, const std::string& fs_type,
            LINFO << "Running " << E2FSCK_BIN << " on " << realpath(blk_device);
            if (should_force_check(*fs_stat)) {
                ret = logwrap_fork_execvp(ARRAY_SIZE(e2fsck_forced_argv), e2fsck_forced_argv,
                                          &status, false, LOG_KLOG | LOG_FILE, true, FSCK_LOG_FILE);
                                          &status, false, LOG_KLOG | LOG_FILE, false,
                                          FSCK_LOG_FILE);
            } else {
                ret = logwrap_fork_execvp(ARRAY_SIZE(e2fsck_argv), e2fsck_argv, &status, false,
                                          LOG_KLOG | LOG_FILE, true, FSCK_LOG_FILE);
                                          LOG_KLOG | LOG_FILE, false, FSCK_LOG_FILE);
            }

            if (ret < 0) {
@@ -256,11 +257,11 @@ static void check_fs(const std::string& blk_device, const std::string& fs_type,
        if (should_force_check(*fs_stat)) {
            LINFO << "Running " << F2FS_FSCK_BIN << " -f " << realpath(blk_device);
            ret = logwrap_fork_execvp(ARRAY_SIZE(f2fs_fsck_forced_argv), f2fs_fsck_forced_argv,
                                      &status, false, LOG_KLOG | LOG_FILE, true, FSCK_LOG_FILE);
                                      &status, false, LOG_KLOG | LOG_FILE, false, FSCK_LOG_FILE);
        } else {
            LINFO << "Running " << F2FS_FSCK_BIN << " -a " << realpath(blk_device);
            ret = logwrap_fork_execvp(ARRAY_SIZE(f2fs_fsck_argv), f2fs_fsck_argv, &status, false,
                                      LOG_KLOG | LOG_FILE, true, FSCK_LOG_FILE);
                                      LOG_KLOG | LOG_FILE, false, FSCK_LOG_FILE);
        }
        if (ret < 0) {
            /* No need to check for error in fork, we can't really handle it now */
@@ -338,7 +339,7 @@ static bool tune2fs_available(void) {
static bool run_tune2fs(const char* argv[], int argc) {
    int ret;

    ret = logwrap_fork_execvp(argc, argv, nullptr, false, LOG_KLOG, true, nullptr);
    ret = logwrap_fork_execvp(argc, argv, nullptr, false, LOG_KLOG, false, nullptr);
    return ret == 0;
}

+4 −4
Original line number Diff line number Diff line
@@ -86,8 +86,8 @@ static int format_ext4(const std::string& fs_blkdev, const std::string& fs_mnt_p
    mke2fs_args.push_back(fs_blkdev.c_str());
    mke2fs_args.push_back(size_str.c_str());

    rc = logwrap_fork_execvp(mke2fs_args.size(), mke2fs_args.data(), nullptr, false, LOG_KLOG, true,
                             nullptr);
    rc = logwrap_fork_execvp(mke2fs_args.size(), mke2fs_args.data(), nullptr, false, LOG_KLOG,
                             false, nullptr);
    if (rc) {
        LERROR << "mke2fs returned " << rc;
        return rc;
@@ -97,7 +97,7 @@ static int format_ext4(const std::string& fs_blkdev, const std::string& fs_mnt_p
            "/system/bin/e2fsdroid", "-e", "-a", fs_mnt_point.c_str(), fs_blkdev.c_str(), nullptr};

    rc = logwrap_fork_execvp(arraysize(e2fsdroid_args), e2fsdroid_args, nullptr, false, LOG_KLOG,
                             true, nullptr);
                             false, nullptr);
    if (rc) {
        LERROR << "e2fsdroid returned " << rc;
    }
@@ -135,7 +135,7 @@ static int format_f2fs(const std::string& fs_blkdev, uint64_t dev_sz, bool crypt
    args.push_back(fs_blkdev.c_str());
    args.push_back(size_str.c_str());

    return logwrap_fork_execvp(args.size(), args.data(), nullptr, false, LOG_KLOG, true, nullptr);
    return logwrap_fork_execvp(args.size(), args.data(), nullptr, false, LOG_KLOG, false, nullptr);
}

int fs_mgr_do_format(const FstabEntry& entry, bool crypt_footer) {