diff options
author | Hung-Te Lin <hungte@chromium.org> | 2019-11-22 08:29:37 +0800 |
---|---|---|
committer | Commit Bot <commit-bot@chromium.org> | 2019-11-22 22:09:24 +0000 |
commit | 16c91aa86c73b9013d6e1397b7d0267a74f9540a (patch) | |
tree | 2d2db2a7df5a2bef986d6ca7cfb7f720555a290b /futility/updater_quirks.c | |
parent | 10c0559dd45092c26fbab9d2c9663c2d51382bae (diff) | |
download | vboot-16c91aa86c73b9013d6e1397b7d0267a74f9540a.tar.gz |
futility: updater: refactor: isolate tempfile functions from updater_config
The updater_utils.c should not deal with updater_config directly.
Currently everything relates to generating temporary files will need
updater_config due to updater_create_temp_file. By moving that out (let
every caller to pass &cfg->tempfiles) we can detach updater_utils.c from
updater_config.
BRANCH=none
BUG=chromium:1024401
TEST=make clean && make runtests
Change-Id: I44bc4df0152596a822b1e0672f41c16825472249
Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/platform/vboot_reference/+/1928358
Tested-by: Hung-Te Lin <hungte@chromium.org>
Reviewed-by: Joel Kitching <kitching@chromium.org>
Reviewed-by: Hung-Te Lin <hungte@chromium.org>
Commit-Queue: Hung-Te Lin <hungte@chromium.org>
Auto-Submit: Hung-Te Lin <hungte@chromium.org>
Diffstat (limited to 'futility/updater_quirks.c')
-rw-r--r-- | futility/updater_quirks.c | 16 |
1 files changed, 9 insertions, 7 deletions
diff --git a/futility/updater_quirks.c b/futility/updater_quirks.c index aba07359..7defd577 100644 --- a/futility/updater_quirks.c +++ b/futility/updater_quirks.c @@ -107,7 +107,7 @@ static int is_ec_software_sync_enabled(struct updater_config *cfg) */ static int ec_ro_software_sync(struct updater_config *cfg) { - const char *tmp_path = updater_create_temp_file(cfg); + const char *tmp_path = create_temp_file(&cfg->tempfiles); const char *ec_ro_path; uint8_t *ec_ro_data; uint32_t ec_ro_len; @@ -124,7 +124,8 @@ static int ec_ro_software_sync(struct updater_config *cfg) ERROR("EC image has invalid section '%s'.\n", "EC_RO"); return 1; } - ec_ro_path = cbfs_extract_file(cfg, tmp_path, FMAP_RO_SECTION, "ecro"); + ec_ro_path = cbfs_extract_file(tmp_path, FMAP_RO_SECTION, "ecro", + &cfg->tempfiles); if (!ec_ro_path || !cbfs_file_exists(tmp_path, FMAP_RO_SECTION, "ecro.hash")) { INFO("No valid EC RO for software sync in AP firmware.\n"); @@ -181,7 +182,7 @@ static int quirk_enlarge_image(struct updater_config *cfg) if (image_from->size <= image_to->size) return 0; - tmp_path = updater_create_temp_file(cfg); + tmp_path = create_temp_file(&cfg->tempfiles); if (!tmp_path) return -1; @@ -348,7 +349,8 @@ static int quirk_daisy_snow_dual_model(struct updater_config *cfg) cfg->image.rw_version_a = strdup(cfg->image.rw_version_b); /* Need to use RO from current system. */ if (!cfg->image_current.data && - load_system_firmware(cfg, &cfg->image_current) != 0) { + load_system_firmware(&cfg->image_current, &cfg->tempfiles, + cfg->verbosity) != 0) { ERROR("Cannot get system RO contents\n"); return -1; } @@ -375,15 +377,15 @@ static int quirk_daisy_snow_dual_model(struct updater_config *cfg) static int quirk_eve_smm_store(struct updater_config *cfg) { const char *smm_store_name = "smm_store"; - const char *temp_image = updater_create_temp_file(cfg); + const char *temp_image = create_temp_file(&cfg->tempfiles); const char *old_store; char *command; if (write_image(temp_image, &cfg->image_current) != VB2_SUCCESS) return -1; - old_store = cbfs_extract_file(cfg, temp_image, FMAP_RW_LEGACY, - smm_store_name); + old_store = cbfs_extract_file(temp_image, FMAP_RW_LEGACY, + smm_store_name, &cfg->tempfiles); if (!old_store) { VB2_DEBUG("cbfstool failure or SMM store not available. " "Don't preserve.\n"); |