Skip to content

Commit 76e56e4

Browse files
tomchyde-nordic
authored andcommitted
loader: Rename boot_version_cmp
Rename boot_version_cmp(..) to boot_compare_version(..). Reason: most of the boot APIs use verb as the second part of the function name. Signed-off-by: Tomasz Chyrowicz <tomasz.chyrowicz@nordicsemi.no>
1 parent 524b80b commit 76e56e4

File tree

1 file changed

+7
-7
lines changed

1 file changed

+7
-7
lines changed

boot/bootutil/src/loader.c

Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -246,8 +246,7 @@ fill_rsp(struct boot_loader_state *state, struct boot_rsp *rsp)
246246
* @retval 1 If ver1 is greater than ver2.
247247
*/
248248
static int
249-
boot_version_cmp(const struct image_version *ver1,
250-
const struct image_version *ver2)
249+
boot_compare_version(const struct image_version *ver1, const struct image_version *ver2)
251250
{
252251
#if !defined(MCUBOOT_VERSION_CMP_USE_BUILD_NUMBER)
253252
BOOT_LOG_DBG("boot_version_cmp: ver1 %u.%u.%u vs ver2 %u.%u.%u",
@@ -330,7 +329,7 @@ boot_verify_slot_dependency(struct boot_loader_state *state,
330329

331330
dep_version = &state->imgs[dep->image_id][dep_slot].hdr.ih_ver;
332331

333-
rc = boot_version_cmp(dep_version, &dep->image_min_version);
332+
rc = boot_compare_version(dep_version, &dep->image_min_version);
334333
#if !defined(MCUBOOT_DIRECT_XIP) && !defined(MCUBOOT_RAM_LOAD)
335334
if (rc < 0) {
336335
/* Dependency not satisfied.
@@ -917,7 +916,7 @@ boot_validate_slot(struct boot_loader_state *state, int slot,
917916
int rc;
918917

919918
/* Check if version of secondary slot is sufficient */
920-
rc = boot_version_cmp(
919+
rc = boot_compare_version(
921920
&boot_img_hdr(state, BOOT_SLOT_SECONDARY)->ih_ver,
922921
&boot_img_hdr(state, BOOT_SLOT_PRIMARY)->ih_ver);
923922
if (rc < 0 && boot_check_header_erased(state, BOOT_SLOT_PRIMARY)) {
@@ -2156,8 +2155,9 @@ check_downgrade_prevention(struct boot_loader_state *state)
21562155
}
21572156
}
21582157
else {
2159-
rc = boot_version_cmp(&boot_img_hdr(state, BOOT_SLOT_SECONDARY)->ih_ver,
2160-
&boot_img_hdr(state, BOOT_SLOT_PRIMARY)->ih_ver);
2158+
rc = boot_compare_version(
2159+
&boot_img_hdr(state, BOOT_SLOT_SECONDARY)->ih_ver,
2160+
&boot_img_hdr(state, BOOT_SLOT_PRIMARY)->ih_ver);
21612161
}
21622162
if (rc < 0) {
21632163
/* Image in slot 0 prevents downgrade, delete image in slot 1 */
@@ -2586,7 +2586,7 @@ find_slot_with_highest_version(struct boot_loader_state *state)
25862586
if (candidate_slot == BOOT_SLOT_NONE) {
25872587
candidate_slot = slot;
25882588
} else {
2589-
rc = boot_version_cmp(
2589+
rc = boot_compare_version(
25902590
&boot_img_hdr(state, slot)->ih_ver,
25912591
&boot_img_hdr(state, candidate_slot)->ih_ver);
25922592
if (rc == 1) {

0 commit comments

Comments
 (0)