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

Commit 58d10c20 authored by Jaegeuk Kim's avatar Jaegeuk Kim
Browse files

fastboot: f2fs: handle return code correctly



The f2fs shares the fsck return code for sload.f2fs, since it calls fsck after
loading files.

enum {
	FSCK_SUCCESS                 = 0,
	FSCK_ERROR_CORRECTED         = 1 << 0,
	FSCK_SYSTEM_SHOULD_REBOOT    = 1 << 1,
	FSCK_ERRORS_LEFT_UNCORRECTED = 1 << 2,
	FSCK_OPERATIONAL_ERROR       = 1 << 3,
	FSCK_USAGE_OR_SYNTAX_ERROR   = 1 << 4,
	FSCK_USER_CANCELLED          = 1 << 5,
	FSCK_SHARED_LIB_ERROR        = 1 << 7,
};

Bug: 176471360
Signed-off-by: default avatarJaegeuk Kim <jaegeuk@google.com>
Change-Id: I06289670834f29a59e704e772791f12328a073f8
parent 53296d80
Loading
Loading
Loading
Loading
+18 −1
Original line number Original line Diff line number Diff line
@@ -168,6 +168,19 @@ static int generate_ext4_image(const char* fileName, long long partSize,
    return exec_cmd(e2fsdroid_args[0], e2fsdroid_args.data(), nullptr);
    return exec_cmd(e2fsdroid_args[0], e2fsdroid_args.data(), nullptr);
}
}


enum {
    // clang-format off
    FSCK_SUCCESS                 = 0,
    FSCK_ERROR_CORRECTED         = 1 << 0,
    FSCK_SYSTEM_SHOULD_REBOOT    = 1 << 1,
    FSCK_ERRORS_LEFT_UNCORRECTED = 1 << 2,
    FSCK_OPERATIONAL_ERROR       = 1 << 3,
    FSCK_USAGE_OR_SYNTAX_ERROR   = 1 << 4,
    FSCK_USER_CANCELLED          = 1 << 5,
    FSCK_SHARED_LIB_ERROR        = 1 << 7,
    // clang-format on
};

static int generate_f2fs_image(const char* fileName, long long partSize,
static int generate_f2fs_image(const char* fileName, long long partSize,
                               const std::string& initial_dir, unsigned /* unused */,
                               const std::string& initial_dir, unsigned /* unused */,
                               unsigned /* unused */, const unsigned fsOptions) {
                               unsigned /* unused */, const unsigned fsOptions) {
@@ -216,7 +229,11 @@ static int generate_f2fs_image(const char* fileName, long long partSize,
    std::vector<const char*> sload_args = {sload_path.c_str(), "-S",
    std::vector<const char*> sload_args = {sload_path.c_str(), "-S",
                                       "-f", initial_dir.c_str(), fileName, nullptr};
                                       "-f", initial_dir.c_str(), fileName, nullptr};


    return exec_cmd(sload_args[0], sload_args.data(), nullptr);
    ret = exec_cmd(sload_args[0], sload_args.data(), nullptr);
    if (ret != 0 && ret != FSCK_ERROR_CORRECTED) {
        return -1;
    }
    return 0;
}
}


static const struct fs_generator {
static const struct fs_generator {