From 244bf4e550889d4a7dcbb0e50f13ced3c3d65a0f Mon Sep 17 00:00:00 2001 From: Philipp Rudo Date: Tue, 8 Oct 2019 18:16:41 +0200 Subject: [PATCH] zdump: Make use of __packed macro MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Make use of the pre-defined __packed macro throughout zdump. Signed-off-by: Philipp Rudo Reviewed-by: Stefan Haberland Signed-off-by: Jan Höppner --- zdump/df_elf.h | 6 ++++-- zdump/df_lkcd.h | 8 +++++--- zdump/df_s390.h | 10 ++++++---- zdump/dfi.h | 5 ++++- zdump/dfi_s390mv.h | 4 ++-- zdump/dfi_vmcoreinfo.c | 5 ++++- zdump/dt_scsi.c | 14 ++++++++------ 7 files changed, 33 insertions(+), 19 deletions(-) diff --git a/zdump/df_elf.h b/zdump/df_elf.h index 38f86c64..6e95606e 100644 --- a/zdump/df_elf.h +++ b/zdump/df_elf.h @@ -15,6 +15,8 @@ #include #include +#include "lib/zt_common.h" + #include "dfo.h" #include "zg.h" @@ -80,7 +82,7 @@ struct nt_prstatus_64 { u64 orig_gpr2; u32 pr_fpvalid; u8 pad3[4]; -} __attribute__ ((packed)); +} __packed; /* * fpregset ELF Note @@ -89,7 +91,7 @@ struct nt_fpregset_64 { u32 fpc; u32 pad; u64 fprs[16]; -} __attribute__ ((packed)); +} __packed; /* * prpsinfo ELF Note diff --git a/zdump/df_lkcd.h b/zdump/df_lkcd.h index 3ba7c260..d3b1fc80 100644 --- a/zdump/df_lkcd.h +++ b/zdump/df_lkcd.h @@ -12,6 +12,8 @@ #ifndef DF_LKCD_H #define DF_LKCD_H +#include "lib/zt_common.h" + #define DF_LKCD_MAGIC 0xa8190173618f23edULL #define DF_LKCD_MAGIC_ASM 0x733339302d64756dULL #define DF_LKCD_VERSION 0x8 /* dump version number */ @@ -53,7 +55,7 @@ struct df_lkcd_hdr { u32 dump_compress; u32 dump_flags; u32 dump_device; -} __attribute__((packed)); +} __packed; /* * s390 LKCD asm header @@ -65,7 +67,7 @@ struct df_lkcd_hdr_asm { u16 cpu_cnt; u16 real_cpu_cnt; u32 lc_vec[512]; -} __attribute__((packed)); +} __packed; /* * Page header @@ -74,6 +76,6 @@ struct df_lkcd_pg_hdr { u64 addr; /* Address of dump page */ u32 size; /* Size of dump page */ u32 flags; /* flags (DF_LKCD_COMPRESSED, DF_LKCD_RAW,...) */ -} __attribute__((packed)); +} __packed; #endif /* DF_LKCD_H */ diff --git a/zdump/df_s390.h b/zdump/df_s390.h index dd272176..1cb3707f 100644 --- a/zdump/df_s390.h +++ b/zdump/df_s390.h @@ -12,6 +12,8 @@ #ifndef DF_S390_H #define DF_S390_H +#include "lib/zt_common.h" + #include "dt.h" #include "zg.h" @@ -59,7 +61,7 @@ struct df_s390_hdr { u64 mvdump_zipl_time; /* 0x208 */ u8 end_pad2[0x800-0x210]; /* 0x210 */ u32 lc_vec[DF_S390_CPU_MAX]; /* 0x800 */ -} __attribute__((packed)); +} __packed; /* * End marker: Should be at the end of every valid s390 crash dump. @@ -67,7 +69,7 @@ struct df_s390_hdr { struct df_s390_em { char str[8]; u64 tod; -} __attribute__((packed)); +} __packed; /* * Segment header for s390 extended dump format @@ -77,7 +79,7 @@ struct df_s390_dump_segm_hdr { u64 len; u64 stop_marker; u8 reserved[0x1000 - 24]; -} __attribute__((packed)); +} __packed; /* * Convert DFI arch to s390 arch @@ -118,7 +120,7 @@ struct df_s390_dumper { u32 size; u8 force; u64 mem; -} __attribute__ ((packed)); +} __packed; /* * s390 dump helpers diff --git a/zdump/dfi.h b/zdump/dfi.h index e9698f3c..5ccc274b 100644 --- a/zdump/dfi.h +++ b/zdump/dfi.h @@ -13,7 +13,10 @@ #define DFI_H #include + +#include "lib/zt_common.h" #include "lib/util_list.h" + #include "zg.h" /* @@ -68,7 +71,7 @@ struct dfi_lowcore_64 { u32 access_regs_save_area[16]; /* 0x1340 */ u64 cregs_save_area[16]; /* 0x1380 */ u8 pad_0x1400[0x2000-0x1400]; /* 0x1400 */ -} __attribute__((packed)); +} __packed; static inline u64 dfi_lc_size(enum dfi_arch arch) { diff --git a/zdump/dfi_s390mv.h b/zdump/dfi_s390mv.h index 5a41d20a..7f2b765f 100644 --- a/zdump/dfi_s390mv.h +++ b/zdump/dfi_s390mv.h @@ -26,14 +26,14 @@ struct vol_parm { u8 blk_size; u8 end_sec; u8 num_heads; -} __attribute__ ((packed)); +} __packed; struct vol_parm_table { u64 timestamp; u16 vol_cnt; struct vol_parm vol_parm[MAX_VOLUMES]; u8 ssid[MAX_VOLUMES]; -} __attribute__ ((packed)); +} __packed; /* * Device signature diff --git a/zdump/dfi_vmcoreinfo.c b/zdump/dfi_vmcoreinfo.c index 3ef20b45..12fb16ee 100644 --- a/zdump/dfi_vmcoreinfo.c +++ b/zdump/dfi_vmcoreinfo.c @@ -10,6 +10,9 @@ */ #include + +#include "lib/zt_common.h" + #include "zgetdump.h" #ifdef __s390x__ @@ -38,7 +41,7 @@ struct os_info { u64 init_fn_size; u32 init_fn_csum; u8 reserved[4004]; -} __attribute__ ((packed)); +} __packed; /* * File local static data diff --git a/zdump/dt_scsi.c b/zdump/dt_scsi.c index f4197818..ce030582 100644 --- a/zdump/dt_scsi.c +++ b/zdump/dt_scsi.c @@ -12,7 +12,9 @@ #include #include +#include "lib/zt_common.h" #include "lib/util_part.h" + #include "zgetdump.h" /* @@ -28,7 +30,7 @@ struct scsi_dump_sb { uint64_t csum_off; uint64_t csum_size; uint64_t csum; -} __attribute((packed)); +} __packed; /* * File local static data @@ -46,7 +48,7 @@ struct scsi_blockptr { uint16_t size; uint16_t blockct; uint8_t reserved[4]; -} __attribute__((__packed__)); +} __packed; enum component_entry_type { component_execute = 0x01, @@ -61,7 +63,7 @@ struct component_entry { uint64_t load_address; uint64_t load_psw; } address; -} __attribute__((__packed__)); +} __packed; enum component_header_type { component_header_ipl = 0x00, @@ -72,7 +74,7 @@ struct component_header { uint8_t magic[4]; uint8_t type; uint8_t reserved[27]; -} __attribute__((__packed__)); +} __packed; struct boot_info { char magic[4]; @@ -81,7 +83,7 @@ struct boot_info { uint8_t dev_type; uint8_t flags; uint64_t sb_off; -} __attribute__ ((packed)); +} __packed; struct scsi_mbr { char magic[4]; @@ -90,7 +92,7 @@ struct scsi_mbr { struct scsi_blockptr blockptr; uint8_t reserved2[0x50]; struct boot_info boot_info; -} __attribute__((__packed__)); +} __packed; #define BOOT_INFO_VERSION 1 #define BOOT_INFO_MAGIC "zIPL"