From 7301883e695fc2f8feaccb0a847f3d164bac1a65 Mon Sep 17 00:00:00 2001 From: Sven Schnelle Date: Fri, 21 Apr 2023 07:14:59 +0000 Subject: [PATCH] zipl: add skip_prepare flag to struct install_set Instead of depending on array index to decide whether we did already the preparation work for installing the bootloader, add an explicit skip_prepare flag to struct install_set. Signed-off-by: Sven Schnelle Acked-by: Eduard Shishkin Acked-by: Stefan Haberland Signed-off-by: Steffen Eiden --- zipl/include/install.h | 1 + zipl/src/bootmap.c | 20 +++++++++----------- 2 files changed, 10 insertions(+), 11 deletions(-) diff --git a/zipl/include/install.h b/zipl/include/install.h index 84566fb4..a1bd49e0 100644 --- a/zipl/include/install.h +++ b/zipl/include/install.h @@ -69,6 +69,7 @@ struct install_set { char *dump_mount_point; unsigned int dump_tmp_dir_created:1; unsigned int dump_mounted:1; + unsigned int skip_prepare:1; struct disk_info *info; disk_blockptr_t scsi_dump_sb_blockptr; }; diff --git a/zipl/src/bootmap.c b/zipl/src/bootmap.c index 2b9ab9c5..b083830c 100644 --- a/zipl/src/bootmap.c +++ b/zipl/src/bootmap.c @@ -321,7 +321,7 @@ static int add_component_file_range(struct install_set *bis, size_t size; int rc; - if (program_table_id) + if (bis->skip_prepare) /* skip the preparation work */ goto write_segment_table; if (add_files) { @@ -402,7 +402,7 @@ static int add_component_buffer_align(struct install_set *bis, void *buffer, disk_blockptr_t segment; int rc; - if (program_table_id) + if (bis->skip_prepare) /* skip the preparation work */ goto write_segment_table; /* Write buffer */ @@ -1449,12 +1449,11 @@ static void set_nr_tables(struct job_data *job, struct install_set *bis) * Prepare resources to build a program table */ static int prepare_build_program_table_device(struct job_data *job, - struct install_set *bis, - int program_table_id) + struct install_set *bis) { ulong unused_size; - if (program_table_id) + if (bis->skip_prepare) /* skip the preparation work */ return 0; /* Get full path of bootmap file */ @@ -1530,7 +1529,7 @@ static int prepare_build_program_table_device(struct job_data *job, static int bootmap_create_device(struct job_data *job, struct install_set *bis, int program_table_id) { - if (prepare_build_program_table_device(job, bis, program_table_id)) + if (prepare_build_program_table_device(job, bis)) return -1; if (build_program_table(job, bis, program_table_id)) return -1; @@ -1547,10 +1546,9 @@ static int bootmap_create_device(struct job_data *job, struct install_set *bis, */ static int prepare_build_program_table_file(struct job_data *job, char *bootmap_dir, - struct install_set *bis, - int program_table_id) + struct install_set *bis) { - if (program_table_id) + if (bis->skip_prepare) /* skip the preparation work */ return 0; /* Create temporary bootmap file */ @@ -1631,8 +1629,7 @@ static int finalize_create_file(char *bootmap_dir, struct install_set *bis) static int bootmap_create_file(struct job_data *job, char *bootmap_dir, struct install_set *bis, int program_table_id) { - if (prepare_build_program_table_file(job, bootmap_dir, bis, - program_table_id)) + if (prepare_build_program_table_file(job, bootmap_dir, bis)) return -1; if (build_program_table(job, bis, program_table_id)) return -1; @@ -1806,6 +1803,7 @@ int prepare_bootloader(struct job_data *job, struct install_set *bis) if (rc) return rc; for (i = 0;; i++) { + bis->skip_prepare = i > 0; rc = bootmap_create(job, bis, i); if (rc || is_last_table(bis, i)) break;