zdump: Drop support of non-extended single volume DASD dumpers

Since DASD standalone dumper does not support non-extended s390 dump
format for years, drop zgetdump support of non-extended s390 single volume
DASD dump-tool:
- Merge dt_390sv_ext.c and dt_s390sv.c counterparts.
- Update DT vector of supported dump tools removing dt_s390sv entry and
  keeping dt_s390sv_ext entry for s390 single volume extended dump tool.
- Remove dt_s390sv.c source and update the Makefile accordingly.
- Remove magic constants relevant to non-extended s390 single volume DASD
  dumper.
- Drop s390 single volume DASD dumper version 5 in df_s390_dumper_read().

Note: We still need support of non-extended s390 dump format since such
output dump files can be produced by 'zgetdump -f s390' via dfo_s390. Thus,
both dfi_s390 and dfi_s390_ext DFI vector entries remain in order to
process s390 dumps files as well as s390_ext dumps on the DASD partition.

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
2025-01-22 20:54:41 +01:00
committed by Jan Höppner
parent 2c5d4073a7
commit 6f82c5792a
9 changed files with 85 additions and 153 deletions

View File

@@ -27,9 +27,7 @@
#define DF_S390_CPU_MAX 512 #define DF_S390_CPU_MAX 512
#define DF_S390_MAGIC_BLK_ECKD 3 #define DF_S390_MAGIC_BLK_ECKD 3
#define DF_S390_DUMPER_MAGIC_SIZE 7 #define DF_S390_DUMPER_MAGIC_SIZE 7
#define DF_S390_DUMPER_MAGIC64 "ZECKD64"
#define DF_S390_DUMPER_MAGIC_EXT "XECKD64" #define DF_S390_DUMPER_MAGIC_EXT "XECKD64"
#define DF_S390_DUMPER_MAGIC64_FBA "ZDFBA64"
#define DF_S390_DUMPER_MAGIC_FBA_EXT "XDFBA64" #define DF_S390_DUMPER_MAGIC_FBA_EXT "XDFBA64"
#define DF_S390_DUMPER_MAGIC_MV "ZMULT64" #define DF_S390_DUMPER_MAGIC_MV "ZMULT64"
#define DF_S390_DUMPER_MAGIC_MV_EXT "XMULT64" #define DF_S390_DUMPER_MAGIC_MV_EXT "XMULT64"

View File

@@ -73,7 +73,7 @@ OBJECTS = zgetdump.o opts.o zg.o zg_error.o zg_print.o \
dfi_devmem.o dfo.o dfo_mem_chunk.o \ dfi_devmem.o dfo.o dfo_mem_chunk.o \
dfo_elf.o dfo_s390.o \ dfo_elf.o dfo_s390.o \
df_elf.o df_s390.o \ df_elf.o df_s390.o \
dt.o dt_s390sv.o dt_s390sv_ext.o \ dt.o dt_s390sv_ext.o \
dt_s390mv.o dt_s390mv_ext.o \ dt_s390mv.o dt_s390mv_ext.o \
dt_scsi.o output.o \ dt_scsi.o output.o \
ngdump.o dt_ngdump.o dfi_ngdump.o dfi_vmdump.o \ ngdump.o dt_ngdump.o dfi_ngdump.o dfi_vmdump.o \

View File

@@ -169,9 +169,7 @@ int df_s390_dumper_read(struct zg_fh *fh, int blk_size,
dumper->size = STAGE2_DUMPER_SIZE_MV; dumper->size = STAGE2_DUMPER_SIZE_MV;
break; break;
case 5: case 5:
if (strncmp(dumper->magic, DF_S390_DUMPER_MAGIC64, if (strncmp(dumper->magic, DF_S390_DUMPER_MAGIC_MV,
DF_S390_DUMPER_MAGIC_SIZE) == 0 ||
strncmp(dumper->magic, DF_S390_DUMPER_MAGIC_MV,
DF_S390_DUMPER_MAGIC_SIZE) == 0) DF_S390_DUMPER_MAGIC_SIZE) == 0)
dumper->size = STAGE2_DUMPER_SIZE_SV; dumper->size = STAGE2_DUMPER_SIZE_SV;
break; break;

View File

@@ -59,7 +59,6 @@ extern int df_s390_dumper_read(struct zg_fh *fh, int32_t blk_size,
/* /*
* DASD dt and dfi functions * DASD dt and dfi functions
*/ */
extern int dt_s390sv_init_gen(bool extended);
extern int dt_s390mv_init_gen(bool extended); extern int dt_s390mv_init_gen(bool extended);
extern void dt_s390mv_info(void); extern void dt_s390mv_info(void);

View File

@@ -20,7 +20,6 @@ static struct dt *dt_vec[] = {
&dt_s390mv_ext, &dt_s390mv_ext,
&dt_s390mv, &dt_s390mv,
&dt_s390sv_ext, &dt_s390sv_ext,
&dt_s390sv,
&dt_scsi, &dt_scsi,
&dt_ngdump, &dt_ngdump,
NULL, NULL,

View File

@@ -38,7 +38,6 @@ void dt_attr_dasd_type_set(const char *dasd_type);
*/ */
extern struct dt dt_s390mv; extern struct dt dt_s390mv;
extern struct dt dt_s390mv_ext; extern struct dt dt_s390mv_ext;
extern struct dt dt_s390sv;
extern struct dt dt_s390sv_ext; extern struct dt dt_s390sv_ext;
extern struct dt dt_scsi; extern struct dt dt_scsi;
extern struct dt dt_ngdump; extern struct dt dt_ngdump;

View File

@@ -1,140 +0,0 @@
/*
* zgetdump - Tool for copying and converting System z dumps
*
* S390 single-volume DASD dump tool
*
* Copyright IBM Corp. 2001, 2018
*
* s390-tools is free software; you can redistribute it and/or modify
* it under the terms of the MIT license. See LICENSE for details.
*/
#include <errno.h>
#include <linux/fs.h>
#include "zgetdump.h"
#include "zg.h"
#include "dt.h"
#include "df_s390.h"
/*
* File local static data
*/
static struct {
struct df_s390_dumper dumper;
enum dfi_arch dumper_arch;
bool extended; /* Extended dump-tool */
} l;
/*
* Read dump tool from ECKD DASD device
*/
static int dumper_read_eckd(int blk_size)
{
if (df_s390_dumper_read(g.fh, blk_size, &l.dumper))
return -ENODEV;
if (l.extended) {
if (strncmp(l.dumper.magic, DF_S390_DUMPER_MAGIC_EXT,
DF_S390_DUMPER_MAGIC_SIZE) != 0)
return -ENODEV;
} else {
if (strncmp(l.dumper.magic, DF_S390_DUMPER_MAGIC64,
DF_S390_DUMPER_MAGIC_SIZE) != 0)
return -ENODEV;
}
l.dumper_arch = DFI_ARCH_64;
return 0;
}
/*
* Check FBA dump tool magic number and set architecture attribute
*/
static int dumper_check_fba(struct df_s390_dumper *dumper)
{
if (l.extended) {
if (strncmp(dumper->magic, DF_S390_DUMPER_MAGIC_FBA_EXT,
DF_S390_DUMPER_MAGIC_SIZE) != 0)
return -ENODEV;
} else {
if (strncmp(dumper->magic, DF_S390_DUMPER_MAGIC64_FBA,
DF_S390_DUMPER_MAGIC_SIZE) != 0)
return -ENODEV;
}
l.dumper_arch = DFI_ARCH_64;
return 0;
}
/*
* Read dump tool on FBA disk and check its magic number
*/
static int dumper_read_fba(void)
{
struct df_s390_dumper *dumper = &l.dumper;
int bytes_to_read;
/*
* On FBA device the dumper is written at the end of the volume because
* there is not enough space to place it at the beginning due to the
* linux disk layout.
* First read 2 fields at the start of the dumper. The magic number
* and the version.
*/
zg_seek_end(g.fh, -STAGE2_DUMPER_SIZE_SV, ZG_CHECK);
bytes_to_read = offsetof(struct df_s390_dumper, size);
zg_read(g.fh, dumper, bytes_to_read, ZG_CHECK);
if (dumper_check_fba(dumper) != 0)
return -ENODEV;
dumper->size = STAGE2_DUMPER_SIZE_SV;
/* Read force and mem fields in the end of the dumper */
bytes_to_read = sizeof(dumper->force) + sizeof(dumper->mem);
zg_seek_end(g.fh, -bytes_to_read, ZG_CHECK);
zg_read(g.fh, &dumper->force, bytes_to_read, ZG_CHECK);
return 0;
}
/*
* Read single volume dumper from disk
*/
static int sv_dumper_read(void)
{
int blk_size;
if (zg_type(g.fh) == ZG_TYPE_DASD_PART)
return -ENODEV;
zg_ioctl(g.fh, BLKSSZGET, &blk_size, "BLKSSZGET", ZG_CHECK);
if (dumper_read_eckd(blk_size) == 0) {
dt_attr_dasd_type_set("ECKD");
return 0;
}
if (dumper_read_fba() == 0) {
dt_attr_dasd_type_set("FBA");
return 0;
}
return -ENODEV;
}
/*
* Initialize s390 single-volume dump tool (for -d option)
*/
int dt_s390sv_init_gen(bool extended)
{
l.extended = extended;
if (sv_dumper_read() != 0)
return -ENODEV;
dt_arch_set(l.dumper_arch);
dt_version_set(l.dumper.version);
dt_attr_mem_limit_set(l.dumper.mem);
return 0;
}
static int dt_s390sv_init(void)
{
return dt_s390sv_init_gen(DUMP_NON_EXTENDED);
}
/*
* s390 single-volume DT (non-extended) operations
*/
struct dt dt_s390sv = {
.desc = "Single-volume DASD dump tool",
.init = dt_s390sv_init,
};

View File

@@ -3,7 +3,7 @@
* *
* S390 single-volume DASD dump tool (extended) * S390 single-volume DASD dump tool (extended)
* *
* Copyright IBM Corp. 2001, 2018 * Copyright IBM Corp. 2001, 2025
* *
* s390-tools is free software; you can redistribute it and/or modify * s390-tools is free software; you can redistribute it and/or modify
* it under the terms of the MIT license. See LICENSE for details. * it under the terms of the MIT license. See LICENSE for details.
@@ -11,15 +11,95 @@
#include <linux/fs.h> #include <linux/fs.h>
#include "zgetdump.h"
#include "zg.h"
#include "dt.h" #include "dt.h"
#include "df_s390.h" #include "df_s390.h"
/*
* File local static data
*/
static struct {
struct df_s390_dumper dumper;
enum dfi_arch dumper_arch;
} l;
/*
* Read dump tool from ECKD DASD device
*/
static int dumper_read_eckd(int blk_size)
{
if (df_s390_dumper_read(g.fh, blk_size, &l.dumper))
return -ENODEV;
if (strncmp(l.dumper.magic, DF_S390_DUMPER_MAGIC_EXT,
DF_S390_DUMPER_MAGIC_SIZE) != 0)
return -ENODEV;
return 0;
}
/*
* Read dump tool on FBA disk and check its magic number
*/
static int dumper_read_fba(void)
{
struct df_s390_dumper *dumper = &l.dumper;
int bytes_to_read;
/*
* On FBA device the dumper is written at the end of the volume because
* there is not enough space to place it at the beginning due to the
* linux disk layout.
* First read 2 fields at the start of the dumper. The magic number
* and the version.
*/
zg_seek_end(g.fh, -STAGE2_DUMPER_SIZE_SV, ZG_CHECK);
bytes_to_read = offsetof(struct df_s390_dumper, size);
zg_read(g.fh, dumper, bytes_to_read, ZG_CHECK);
if (strncmp(dumper->magic, DF_S390_DUMPER_MAGIC_FBA_EXT,
DF_S390_DUMPER_MAGIC_SIZE) != 0)
return -ENODEV;
dumper->size = STAGE2_DUMPER_SIZE_SV;
/* Read force and mem fields in the end of the dumper */
bytes_to_read = sizeof(dumper->force) + sizeof(dumper->mem);
zg_seek_end(g.fh, -bytes_to_read, ZG_CHECK);
zg_read(g.fh, &dumper->force, bytes_to_read, ZG_CHECK);
return 0;
}
/*
* Read single volume dumper from disk
*/
static int sv_dumper_read(void)
{
int blk_size;
if (zg_type(g.fh) == ZG_TYPE_DASD_PART)
return -ENODEV;
zg_ioctl(g.fh, BLKSSZGET, &blk_size, "BLKSSZGET", ZG_CHECK);
if (dumper_read_eckd(blk_size) == 0) {
dt_attr_dasd_type_set("ECKD");
return 0;
}
if (dumper_read_fba() == 0) {
dt_attr_dasd_type_set("FBA");
return 0;
}
return -ENODEV;
}
/* /*
* Initialize s390 single-volume extended dump tool (for -d option) * Initialize s390 single-volume extended dump tool (for -d option)
*/ */
static int dt_s390sv_ext_init(void) static int dt_s390sv_ext_init(void)
{ {
return dt_s390sv_init_gen(DUMP_EXTENDED); if (sv_dumper_read() != 0)
return -ENODEV;
l.dumper_arch = DFI_ARCH_64;
dt_arch_set(l.dumper_arch);
dt_version_set(l.dumper.version);
dt_attr_mem_limit_set(l.dumper.mem);
return 0;
} }
/* /*

View File

@@ -367,8 +367,7 @@ static int clear_ccw_dumper(const struct disk_info *info, int fd)
/* /*
* Check if the dump tool is present and clear its first block with zeroes. * Check if the dump tool is present and clear its first block with zeroes.
*/ */
if (strncmp(dumper_magic, DF_S390_DUMPER_MAGIC64, sizeof(dumper_magic)) == 0 || if (strncmp(dumper_magic, DF_S390_DUMPER_MAGIC_EXT, sizeof(dumper_magic)) == 0 ||
strncmp(dumper_magic, DF_S390_DUMPER_MAGIC_EXT, sizeof(dumper_magic)) == 0 ||
strncmp(dumper_magic, DF_S390_DUMPER_MAGIC_MV, sizeof(dumper_magic)) == 0 || strncmp(dumper_magic, DF_S390_DUMPER_MAGIC_MV, sizeof(dumper_magic)) == 0 ||
strncmp(dumper_magic, DF_S390_DUMPER_MAGIC_MV_EXT, sizeof(dumper_magic)) == 0) { strncmp(dumper_magic, DF_S390_DUMPER_MAGIC_MV_EXT, sizeof(dumper_magic)) == 0) {
if (misc_seek(fd, ECKD_CDL_DUMP_REC * info->phy_block_size)) if (misc_seek(fd, ECKD_CDL_DUMP_REC * info->phy_block_size))