mirror of
https://github.com/ibm-s390-linux/s390-tools.git
synced 2026-08-05 02:14:52 +00:00
zipl/src: Reuse data of file components in bootmap
If the option '--add-files' is specified, don't duplicate data of components added via add_component_file() and friends to bootmap file for each mirror. Instead, reuse the data that were added when preparing a program table for the first mirror to create metadata (block lists, program tables, etc) specific for other mirrors. Signed-off-by: Eduard Shishkin <edward6@linux.ibm.com> Reviewed-by: Stefan Haberland <sth@linux.ibm.com> Signed-off-by: Steffen Eiden <seiden@linux.ibm.com>
This commit is contained in:
committed by
Steffen Eiden
parent
731f00202c
commit
431e4542ca
@@ -80,6 +80,7 @@ struct install_set {
|
|||||||
int nr_menu_entries;
|
int nr_menu_entries;
|
||||||
struct misc_fd mfd;
|
struct misc_fd mfd;
|
||||||
struct install_set_mirror mirrors[MAX_TARGETS];
|
struct install_set_mirror mirrors[MAX_TARGETS];
|
||||||
|
struct file_range comp_reg[NR_PROGRAM_COMPONENTS];
|
||||||
char *filename;
|
char *filename;
|
||||||
unsigned int skip_prepare_device:1;
|
unsigned int skip_prepare_device:1;
|
||||||
unsigned int tmp_filename_created:1;
|
unsigned int tmp_filename_created:1;
|
||||||
|
|||||||
@@ -376,15 +376,26 @@ static int add_component_file_range(struct install_set *bis,
|
|||||||
}
|
}
|
||||||
size -= trailer;
|
size -= trailer;
|
||||||
/* Write buffer */
|
/* Write buffer */
|
||||||
*count = disk_write_block_buffer(&bis->mfd, 0, buffer,
|
*count = disk_write_block_buffer_align(&bis->mfd,
|
||||||
size, list,
|
0 /* not a base disk */,
|
||||||
bis->info->fs_block_size,
|
buffer, size, list,
|
||||||
info);
|
bis->info->fs_block_size,
|
||||||
|
info,
|
||||||
|
info->phy_block_size,
|
||||||
|
/*
|
||||||
|
* save component offset
|
||||||
|
*/
|
||||||
|
&bis->comp_reg
|
||||||
|
[comp_id].offset);
|
||||||
free(buffer);
|
free(buffer);
|
||||||
if (*count == 0) {
|
if (*count == 0) {
|
||||||
error_text("Could not write to bootmap file");
|
error_text("Could not write to bootmap file");
|
||||||
return -1;
|
return -1;
|
||||||
}
|
}
|
||||||
|
/* zero offset is occupied by bootmap header */
|
||||||
|
assert(bis->comp_reg[comp_id].offset > 0);
|
||||||
|
/* save component size */
|
||||||
|
bis->comp_reg[comp_id].len = size;
|
||||||
} else {
|
} else {
|
||||||
if (!file_is_on_device(filename, bis->info)) {
|
if (!file_is_on_device(filename, bis->info)) {
|
||||||
error_reason("File is not on target device");
|
error_reason("File is not on target device");
|
||||||
@@ -423,7 +434,20 @@ static int add_component_file(struct install_set *bis, const char *filename,
|
|||||||
void *component, int add_files, int comp_id,
|
void *component, int add_files, int comp_id,
|
||||||
int menu_idx, int mirror_id, int program_table_id)
|
int menu_idx, int mirror_id, int program_table_id)
|
||||||
{
|
{
|
||||||
return add_component_file_range(bis, filename, NULL, load_address,
|
struct file_range *reg = NULL;
|
||||||
|
|
||||||
|
if (add_files &&
|
||||||
|
bis->comp_reg[comp_id].offset > 0) {
|
||||||
|
/*
|
||||||
|
* The file has been already written to the bootmap.
|
||||||
|
* Use the respective region in the bootmap file to
|
||||||
|
* add the component
|
||||||
|
*/
|
||||||
|
filename = bis->filename;
|
||||||
|
reg = &bis->comp_reg[comp_id];
|
||||||
|
add_files = 0;
|
||||||
|
}
|
||||||
|
return add_component_file_range(bis, filename, reg, load_address,
|
||||||
trailer, component, add_files,
|
trailer, component, add_files,
|
||||||
comp_id, menu_idx, mirror_id,
|
comp_id, menu_idx, mirror_id,
|
||||||
program_table_id);
|
program_table_id);
|
||||||
|
|||||||
Reference in New Issue
Block a user