From 953af2cc67272442b9dea34f1fc95ff1555f5901 Mon Sep 17 00:00:00 2001 From: Alexander Egorenkov Date: Wed, 1 Jun 2022 07:22:44 +0200 Subject: [PATCH] zipl/boot: move SCSI MBR struct definition to boot_defs.h for reuse MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit To reduce duplication of definitions and facilitate reuse between zipl and zgetdump. Signed-off-by: Alexander Egorenkov Reviewed-by: Mikhail Zaslonko Signed-off-by: Jan Höppner --- include/boot/boot_defs.h | 11 +++++++++++ zipl/include/zipl.h | 1 - zipl/src/install.c | 12 +----------- 3 files changed, 12 insertions(+), 12 deletions(-) diff --git a/include/boot/boot_defs.h b/include/boot/boot_defs.h index b3fbbcdb..2116f99b 100644 --- a/include/boot/boot_defs.h +++ b/include/boot/boot_defs.h @@ -168,4 +168,15 @@ struct boot_info { } bp; } __packed; +#define DISK_LAYOUT_ID 0x00000001 + +struct scsi_mbr { + uint8_t magic[4]; + uint32_t version_id; + uint8_t reserved[8]; + struct linear_blockptr program_table_pointer; + uint8_t reserved2[0x50]; + struct boot_info boot_info; +} __packed; + #endif /* BOOT_DEFS_H */ diff --git a/zipl/include/zipl.h b/zipl/include/zipl.h index c299ec0e..50003a9d 100644 --- a/zipl/include/zipl.h +++ b/zipl/include/zipl.h @@ -19,7 +19,6 @@ #define ZIPL_MAGIC "zIPL" #define ZIPL_MAGIC_SIZE 4 -#define DISK_LAYOUT_ID 0x00000001 #define ADDRESS_LIMIT 0x80000000UL #define UNSPECIFIED_ADDRESS -1UL diff --git a/zipl/src/install.c b/zipl/src/install.c index 50cb59b1..6cad861c 100644 --- a/zipl/src/install.c +++ b/zipl/src/install.c @@ -70,9 +70,6 @@ get_scsi_layout(unsigned char* bootblock) return scsi_layout_unknown; } - -#define DISK_LAYOUT_ID 0x00000001 - static int overwrite_partition_start(int fd, struct disk_info* info, int mv_dump_magic); @@ -83,14 +80,7 @@ static int update_scsi_mbr(void* bootblock, disk_blockptr_t* table, struct disk_info* info, disk_blockptr_t* scsi_dump_sb_blockptr) { - struct scsi_mbr { - uint8_t magic[4]; - uint32_t version_id; - uint8_t reserved[8]; - uint8_t program_table_pointer[16]; - uint8_t reserved2[0x50]; - struct boot_info boot_info; - } __packed* mbr; + struct scsi_mbr *mbr; struct scsi_dump_param param; void* buffer;