zdump: Use global header s390_dump.h

Instead of using its own DF_S390_ constants and df_s390_ structs
in df_s390.h, include those from "dump/s390_dump.h" in order to minimize
duplicates. Adjust the code, where required, to use <stdint> types
instead of those defined in zt_common.h (e.g. use uint64_t instead of u64).

Adjust zdump include statements.

Signed-off-by: Mikhail Zaslonko <zaslonko@linux.ibm.com>
Reviewed-by: Alexander Egorenkov <egorenar@linux.ibm.com>
Signed-off-by: Jan Höppner <hoeppner@linux.ibm.com>
This commit is contained in:
Mikhail Zaslonko
2023-05-26 14:58:03 +02:00
committed by Jan Höppner
parent 775495c7e7
commit 7b68552359
7 changed files with 18 additions and 68 deletions

View File

@@ -22,6 +22,7 @@
#define DF_S390_HDR_SIZE 0x1000
#define DF_S390_EM_SIZE 16
#define DF_S390_EM_MAGIC 0x44554d505f454e44ULL
#define DF_S390_EM_STR "DUMP_END"
#define DF_S390_CPU_MAX 512
#define DF_S390_MAGIC_BLK_ECKD 3
@@ -67,8 +68,11 @@ struct df_s390_hdr {
* End marker: Should be at the end of every valid s390 crash dump
*/
struct df_s390_em {
uint64_t magic;
uint64_t tod;
union {
uint64_t magic;
char str[8];
};
uint64_t tod;
} __packed __aligned(16);
/*
@@ -78,6 +82,7 @@ struct df_s390_dump_segm_hdr {
uint64_t start;
uint64_t len;
uint64_t stop_marker;
};
uint8_t reserved[0x1000 - 24];
} __packed;
#endif /* S390_DUMP_H */

View File

@@ -17,6 +17,8 @@
#include <time.h>
#include <unistd.h>
#include "dump/s390_dump.h"
#include "df_s390.h"
/*

View File

@@ -13,74 +13,11 @@
#define DF_S390_H
#include "lib/zt_common.h"
#include "dump/s390_dump.h"
#include "dt.h"
#include "zg.h"
#define DF_S390_MAGIC 0xa8190173618f23fdULL
#define DF_S390_MAGIC_EXT 0xa8190173618f23feULL
#define DF_S390_HDR_SIZE 0x1000
#define DF_S390_EM_SIZE 16
#define DF_S390_EM_STR "DUMP_END"
#define DF_S390_CPU_MAX 512
#define DF_S390_MAGIC_BLK_ECKD 3
/*
* Architecture of dumped system
*/
enum df_s390_arch {
DF_S390_ARCH_32 = 1,
DF_S390_ARCH_64 = 2,
};
/*
* s390 dump header format
*/
struct df_s390_hdr {
u64 magic; /* 0x000 */
u32 version; /* 0x008 */
u32 hdr_size; /* 0x00c */
u32 dump_level; /* 0x010 */
u32 page_size; /* 0x014 */
u64 mem_size; /* 0x018 */
u64 mem_start; /* 0x020 */
u64 mem_end; /* 0x028 */
u32 num_pages; /* 0x030 */
u32 pad; /* 0x034 */
u64 tod; /* 0x038 */
u64 cpu_id; /* 0x040 */
u32 arch; /* 0x048 */
u32 volnr; /* 0x04c */
u32 build_arch; /* 0x050 */
u64 mem_size_real; /* 0x054 */
u8 mvdump; /* 0x05c */
u16 cpu_cnt; /* 0x05d */
u16 real_cpu_cnt; /* 0x05f */
u8 end_pad1[0x200-0x061]; /* 0x061 */
u64 mvdump_sign; /* 0x200 */
u64 mvdump_zipl_time; /* 0x208 */
u8 end_pad2[0x800-0x210]; /* 0x210 */
u32 lc_vec[DF_S390_CPU_MAX]; /* 0x800 */
} __packed;
/*
* End marker: Should be at the end of every valid s390 crash dump.
*/
struct df_s390_em {
char str[8];
u64 tod;
} __packed;
/*
* Segment header for s390 extended dump format
*/
struct df_s390_dump_segm_hdr {
u64 start;
u64 len;
u64 stop_marker;
u8 reserved[0x1000 - 24];
} __packed;
/*
* Convert DFI arch to s390 arch
*/

View File

@@ -20,6 +20,7 @@
#include <errno.h>
#include "lib/util_log.h"
#include "dump/s390_dump.h"
#include "zgetdump.h"
#include "zg.h"

View File

@@ -24,6 +24,7 @@
#include "lib/util_file.h"
#include "lib/util_path.h"
#include "dump/s390_dump.h"
#include "zgetdump.h"
#include "dt.h"

View File

@@ -19,6 +19,8 @@
#include <unistd.h>
#include <errno.h>
#include "dump/s390_dump.h"
#include "zgetdump.h"
#include "df_s390.h"
#include "dfi.h"

View File

@@ -17,6 +17,8 @@
#include <time.h>
#include <unistd.h>
#include "dump/s390_dump.h"
#include "df_s390.h"
#include "dfi_mem_chunk.h"
#include "dfo_mem_chunk.h"
@@ -69,7 +71,7 @@ static void cpu2lc_32(void *lc_32, struct dfi_cpu *cpu_64)
/*
* Convert timeval to s390 TOD clock
*/
static void timeval2tod(u64 *tod, struct timeval *xtime)
static void timeval2tod(uint64_t *tod, struct timeval *xtime)
{
u64 us = xtime->tv_sec * 1000000 + xtime->tv_usec;
*tod = (us << 12);