Skip to content

Commit

Permalink
Rename and expose detect_and_mount_boot
Browse files Browse the repository at this point in the history
  • Loading branch information
silkeh committed Aug 21, 2022
1 parent 357f1e4 commit 1cc4150
Show file tree
Hide file tree
Showing 4 changed files with 12 additions and 5 deletions.
6 changes: 3 additions & 3 deletions src/bootman/bootman.c
Original file line number Diff line number Diff line change
Expand Up @@ -329,7 +329,7 @@ bool boot_manager_remove_kernel(BootManager *self, const Kernel *kernel)
return self->bootloader->remove_kernel(self, kernel);
}

int detect_and_mount_boot(BootManager *self, char **boot_dir) {
int boot_manager_detect_and_mount_boot(BootManager *self, char **boot_dir) {
autofree(char) *boot_dev = NULL;
const char *prefix;
int wanted_boot_mask;
Expand Down Expand Up @@ -370,7 +370,7 @@ bool boot_manager_set_default_kernel(BootManager *self, const Kernel *kernel)
CHECK_ERR_RET_VAL(!kernels || kernels->len == 0, false,
"No kernels discovered in %s, bailing", self->kernel_dir);

did_mount = detect_and_mount_boot(self, &boot_dir);
did_mount = boot_manager_detect_and_mount_boot(self, &boot_dir);
CHECK_DBG_RET_VAL(did_mount < 0, false, "Boot was not mounted");

for (uint16_t i = 0; i < kernels->len; i++) {
Expand Down Expand Up @@ -566,7 +566,7 @@ char **boot_manager_list_kernels(BootManager *self)
/* Sort them to ensure static ordering */
nc_array_qsort(kernels, kernel_compare_reverse);

did_mount = detect_and_mount_boot(self, &boot_dir);
did_mount = boot_manager_detect_and_mount_boot(self, &boot_dir);
if (did_mount >= 0) {
default_kernel = boot_manager_get_default_kernel(self);
if (did_mount > 0) {
Expand Down
7 changes: 7 additions & 0 deletions src/bootman/bootman.h
Original file line number Diff line number Diff line change
Expand Up @@ -287,6 +287,13 @@ bool boot_manager_set_default_kernel(BootManager *manager, const Kernel *kernel)
*/
char *boot_manager_get_default_kernel(BootManager *manager);

/**
* Detect and mount the boot directory.
* @param boot_dir Path indicating the mounted boot directory.
* @return an integer value, indicating success or failure.
*/
int boot_manager_detect_and_mount_boot(BootManager *self, char **boot_dir);

/**
* Return the CbmDeviceProbe for the root partition
*
Expand Down
2 changes: 1 addition & 1 deletion src/bootman/bootman_private.h
Original file line number Diff line number Diff line change
Expand Up @@ -70,7 +70,7 @@ int mount_boot(BootManager *self, char **boot_directory);
*
* @see mount_boot() for return and error conditions.
*/
int detect_and_mount_boot(BootManager *self, char **boot_dir);
int boot_manager_detect_and_mount_boot(BootManager *self, char **boot_dir);

/**
* Internal function to sort by Kernel structs by release number (highest first)
Expand Down
2 changes: 1 addition & 1 deletion src/bootman/update.c
Original file line number Diff line number Diff line change
Expand Up @@ -41,7 +41,7 @@ bool boot_manager_update(BootManager *self)
return boot_manager_update_image(self);
}

did_mount = detect_and_mount_boot(self, &boot_dir);
did_mount = boot_manager_detect_and_mount_boot(self, &boot_dir);
if (did_mount >= 0) {
/* Do a native update */
ret = boot_manager_update_native(self);
Expand Down

0 comments on commit 1cc4150

Please sign in to comment.