mirror of
https://github.com/ibm-s390-linux/s390-tools.git
synced 2026-08-05 02:14:52 +00:00
zipl: expand interface of disk_write_block_aligned_base()
Provide helper functions disk_write_block_buffer_align() and add_component_buffer_align() to align offset of the record on specified block size boundary and to save the offset, where the record was made at. This will be used by a later patch. Reviewed-by: Stefan Haberland <sth@linux.ibm.com> Reviewed-by: Peter Oberparleiter <oberpar@linux.ibm.com> Signed-off-by: Eduard Shishkin <edward6@linux.ibm.com> Signed-off-by: Jan Höppner <hoeppner@linux.ibm.com>
This commit is contained in:
committed by
Jan Höppner
parent
2ae44cb794
commit
bbeb0f8445
@@ -372,9 +372,11 @@ add_component_file(int fd, const char *filename, address_t load_address,
|
||||
}
|
||||
|
||||
static int
|
||||
add_component_buffer(int fd, void* buffer, size_t size, component_data data,
|
||||
void* component, struct disk_info* info,
|
||||
struct component_loc *location, int type)
|
||||
add_component_buffer_align(int fd, void *buffer, size_t size,
|
||||
component_data data, void *component,
|
||||
struct disk_info *info,
|
||||
struct component_loc *location, int type,
|
||||
int align, off_t *offset)
|
||||
{
|
||||
struct component_loc loc;
|
||||
disk_blockptr_t segment;
|
||||
@@ -383,7 +385,8 @@ add_component_buffer(int fd, void* buffer, size_t size, component_data data,
|
||||
int rc;
|
||||
|
||||
/* Write buffer */
|
||||
count = disk_write_block_buffer(fd, 0, buffer, size, &list, info);
|
||||
count = disk_write_block_buffer_align(fd, 0, buffer, size, &list, info,
|
||||
align, offset);
|
||||
if (count == 0) {
|
||||
error_text("Could not write to bootmap file");
|
||||
return -1;
|
||||
@@ -410,6 +413,15 @@ add_component_buffer(int fd, void* buffer, size_t size, component_data data,
|
||||
return rc;
|
||||
}
|
||||
|
||||
static int
|
||||
add_component_buffer(int fd, void *buffer, size_t size, component_data data,
|
||||
void *component, struct disk_info *info,
|
||||
struct component_loc *location, int type)
|
||||
{
|
||||
return add_component_buffer_align(fd, buffer, size, data, component,
|
||||
info, location, type,
|
||||
info->phy_block_size, NULL);
|
||||
}
|
||||
|
||||
static int
|
||||
add_dummy_buffer(int fd, size_t size, address_t addr, void *component,
|
||||
|
||||
Reference in New Issue
Block a user