mirror of
https://github.com/ibm-s390-linux/s390-tools.git
synced 2026-08-05 02:14:52 +00:00
zgetdump: Update zgetdump to process the new dump tool
Update 'zgetdump -d' to process the new DASD dump tool installed (single volume or multi-volume). Signed-off-by: Mikhail Zaslonko <zaslonko@linux.ibm.com> Signed-off-by: Jan Höppner <hoeppner@linux.ibm.com>
This commit is contained in:
committed by
Jan Höppner
parent
aade05b01d
commit
26d636f234
+9
-5
@@ -41,12 +41,16 @@ all: check_dep_fuse check_dep_zlib zgetdump
|
||||
|
||||
OBJECTS = zgetdump.o opts.o zg.o \
|
||||
dfi.o dfi_vmcoreinfo.o \
|
||||
dfi_lkcd.o dfi_elf.o dfi_s390.o dfi_s390mv.o dfi_s390tape.o \
|
||||
dfi_kdump.o dfi_devmem.o \
|
||||
dfo.o dfo_elf.o dfo_s390.o \
|
||||
dfi_lkcd.o dfi_elf.o \
|
||||
dfi_s390.o \
|
||||
dfi_s390mv.o \
|
||||
dfi_s390tape.o dfi_kdump.o \
|
||||
dfi_devmem.o dfo.o \
|
||||
dfo_elf.o dfo_s390.o \
|
||||
df_s390.o \
|
||||
dt.o dt_s390sv.o dt_s390mv.o dt_scsi.o \
|
||||
stdout.o
|
||||
dt.o dt_s390sv.o dt_s390sv_ext.o \
|
||||
dt_s390mv.o dt_s390mv_ext.o \
|
||||
dt_scsi.o stdout.o \
|
||||
|
||||
ifeq ("$(HAVE_FUSE)","0")
|
||||
FUSE_CFLAGS = -DHAVE_FUSE=0 -D_FILE_OFFSET_BITS=64
|
||||
|
||||
+3
-2
@@ -131,9 +131,10 @@ extern void df_s390_dumper_read(struct zg_fh *fh, int32_t blk_size,
|
||||
struct df_s390_dumper *dumper);
|
||||
|
||||
/*
|
||||
* DASD multi-volume dumper functions
|
||||
* DASD dt and dfi functions
|
||||
*/
|
||||
extern int dt_s390mv_init(void);
|
||||
extern int dt_s390sv_init_gen(bool extended);
|
||||
extern int dt_s390mv_init_gen(bool extended);
|
||||
extern void dt_s390mv_info(void);
|
||||
|
||||
#endif /* DF_S390_H */
|
||||
|
||||
+19
-51
@@ -21,52 +21,7 @@
|
||||
#include <unistd.h>
|
||||
|
||||
#include "zgetdump.h"
|
||||
|
||||
#define SYSFS_BUSDIR "/sys/bus/ccw/devices"
|
||||
#define MAX_VOLUMES 32
|
||||
|
||||
/*
|
||||
* Parameter for DASD multi-volume dump
|
||||
*/
|
||||
struct vol_parm {
|
||||
u16 devno;
|
||||
u32 start_blk;
|
||||
u32 end_blk;
|
||||
u8 blk_size;
|
||||
u8 end_sec;
|
||||
u8 num_heads;
|
||||
} __attribute__ ((packed));
|
||||
|
||||
struct vol_parm_table {
|
||||
u64 timestamp;
|
||||
u16 vol_cnt;
|
||||
struct vol_parm vol_parm[MAX_VOLUMES];
|
||||
u8 ssid[MAX_VOLUMES];
|
||||
} __attribute__ ((packed));
|
||||
|
||||
/*
|
||||
* Device signature
|
||||
*/
|
||||
enum dev_sign {
|
||||
SIGN_INVALID = 0, /* No dumper installed */
|
||||
SIGN_VALID = 1, /* dumper installed, but volume not used */
|
||||
SIGN_ACTIVE = 2, /* dumper installed and volume userd */
|
||||
};
|
||||
|
||||
static char *dev_sign_str[] = {"invalid", "valid", "active"};
|
||||
#define dev_sign_str(x) (dev_sign_str[x])
|
||||
|
||||
/*
|
||||
* Device status
|
||||
*/
|
||||
enum dev_status {
|
||||
DEV_ONLINE = 0,
|
||||
DEV_OFFLINE = 1,
|
||||
DEV_UNDEFINED = 2,
|
||||
};
|
||||
|
||||
static char *dev_status_str[] = {"online", "offline", "undefined"};
|
||||
#define dev_status_str(x) (dev_status_str[x])
|
||||
#include "dfi_s390mv.h"
|
||||
|
||||
/*
|
||||
* Volume information
|
||||
@@ -99,6 +54,8 @@ static struct {
|
||||
int blk_size;
|
||||
struct df_s390_dumper dumper;
|
||||
int dump_incomplete;
|
||||
bool extended;
|
||||
char dumper_magic[7]; /* Reference value to compare with */
|
||||
} l;
|
||||
|
||||
/*
|
||||
@@ -262,7 +219,7 @@ static void vol_init(struct vol *vol, struct vol_parm *vol_parm, int ssid,
|
||||
l.dump_incomplete = 1;
|
||||
}
|
||||
|
||||
if (strncmp(vol->dumper.magic, DF_S390_DUMPER_MAGIC_MV, 7) != 0) {
|
||||
if (strncmp(vol->dumper.magic, l.dumper_magic, 7) != 0) {
|
||||
vol->sign = SIGN_INVALID;
|
||||
l.dump_incomplete = 1;
|
||||
}
|
||||
@@ -270,6 +227,9 @@ static void vol_init(struct vol *vol, struct vol_parm *vol_parm, int ssid,
|
||||
if (vol->nr == 0)
|
||||
l.hdr = vol->hdr;
|
||||
|
||||
if (l.extended)
|
||||
return;
|
||||
|
||||
if (*mem_off == l.hdr.mem_size) {
|
||||
/* Unused volume */
|
||||
vol->mem_start = 0;
|
||||
@@ -444,7 +404,7 @@ static int mv_dumper_read(void)
|
||||
ZG_CHECK_NONE) == -1)
|
||||
return -ENODEV;
|
||||
df_s390_dumper_read(g.fh, l.blk_size, &l.dumper);
|
||||
if (memcmp(l.dumper.magic, DF_S390_DUMPER_MAGIC_MV, 7) != 0)
|
||||
if (strncmp(l.dumper.magic, l.dumper_magic, 7) != 0)
|
||||
return -ENODEV;
|
||||
table_read(g.fh, l.blk_size, &l.table);
|
||||
return 0;
|
||||
@@ -465,6 +425,8 @@ static void volumes_init(void)
|
||||
vol_init(&l.vol_vec[i], &l.table.vol_parm[i], l.table.ssid[i],
|
||||
&mem_off);
|
||||
}
|
||||
if (l.extended)
|
||||
return;
|
||||
if (mem_off != l.hdr.mem_size)
|
||||
l.dump_incomplete = 1;
|
||||
}
|
||||
@@ -475,7 +437,7 @@ static void volumes_init(void)
|
||||
static int open_dump(void)
|
||||
{
|
||||
const struct stat *stat = zg_stat(g.fh);
|
||||
unsigned dev_minor;
|
||||
unsigned int dev_minor;
|
||||
enum zg_type type;
|
||||
char *path;
|
||||
|
||||
@@ -520,10 +482,16 @@ static int dfi_s390mv_init(void)
|
||||
}
|
||||
|
||||
/*
|
||||
* Initialize s390 multi-volume dump tool (for -d option)
|
||||
* Initialize s390 multi-volume dump tool generic function
|
||||
*/
|
||||
int dt_s390mv_init(void)
|
||||
int dt_s390mv_init_gen(bool extended)
|
||||
{
|
||||
l.extended = extended;
|
||||
/* Specify dumper magic value for further validation */
|
||||
if (extended)
|
||||
strncpy(l.dumper_magic, DF_S390_DUMPER_MAGIC_MV_EXT, 7);
|
||||
else
|
||||
strncpy(l.dumper_magic, DF_S390_DUMPER_MAGIC_MV, 7);
|
||||
if (open_dump() != 0)
|
||||
return -ENODEV;
|
||||
volumes_init();
|
||||
|
||||
@@ -0,0 +1,62 @@
|
||||
/*
|
||||
* zgetdump - Tool for copying and converting System z dumps
|
||||
*
|
||||
* S390 multi-volume dump input format common structures
|
||||
*
|
||||
* 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.
|
||||
*/
|
||||
#ifndef DFI_S390MV_H
|
||||
#define DFI_S390MV_H
|
||||
|
||||
#include "lib/zt_common.h"
|
||||
|
||||
#define SYSFS_BUSDIR "/sys/bus/ccw/devices"
|
||||
#define MAX_VOLUMES 32
|
||||
|
||||
/*
|
||||
* Parameter for DASD multi-volume dump
|
||||
*/
|
||||
struct vol_parm {
|
||||
u16 devno;
|
||||
u32 start_blk;
|
||||
u32 end_blk;
|
||||
u8 blk_size;
|
||||
u8 end_sec;
|
||||
u8 num_heads;
|
||||
} __attribute__ ((packed));
|
||||
|
||||
struct vol_parm_table {
|
||||
u64 timestamp;
|
||||
u16 vol_cnt;
|
||||
struct vol_parm vol_parm[MAX_VOLUMES];
|
||||
u8 ssid[MAX_VOLUMES];
|
||||
} __attribute__ ((packed));
|
||||
|
||||
/*
|
||||
* Device signature
|
||||
*/
|
||||
enum dev_sign {
|
||||
SIGN_INVALID = 0, /* No dumper installed */
|
||||
SIGN_VALID = 1, /* dumper installed, but volume not used */
|
||||
SIGN_ACTIVE = 2, /* dumper installed and volume userd */
|
||||
};
|
||||
|
||||
static char *dev_sign_str[] = {"invalid", "valid", "active"};
|
||||
#define dev_sign_str(x) (dev_sign_str[x])
|
||||
|
||||
/*
|
||||
* Device status
|
||||
*/
|
||||
enum dev_status {
|
||||
DEV_ONLINE = 0,
|
||||
DEV_OFFLINE = 1,
|
||||
DEV_UNDEFINED = 2,
|
||||
};
|
||||
|
||||
static char *dev_status_str[] = {"online", "offline", "undefined"};
|
||||
#define dev_status_str(x) (dev_status_str[x])
|
||||
|
||||
#endif /* DFI_S390MV_H */
|
||||
+3
-1
@@ -3,7 +3,7 @@
|
||||
*
|
||||
* Dump tool info generic functions
|
||||
*
|
||||
* Copyright IBM Corp. 2001, 2017
|
||||
* 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.
|
||||
@@ -15,7 +15,9 @@
|
||||
* Supported dump tools
|
||||
*/
|
||||
static struct dt *dt_vec[] = {
|
||||
&dt_s390mv_ext,
|
||||
&dt_s390mv,
|
||||
&dt_s390sv_ext,
|
||||
&dt_s390sv,
|
||||
&dt_scsi,
|
||||
NULL,
|
||||
|
||||
@@ -13,6 +13,10 @@
|
||||
#define DT_H
|
||||
|
||||
#include "dfi.h"
|
||||
#include <stdbool.h>
|
||||
|
||||
#define DUMP_EXTENDED true
|
||||
#define DUMP_NON_EXTENDED false
|
||||
|
||||
struct dt {
|
||||
const char *desc;
|
||||
|
||||
+9
-1
@@ -12,7 +12,15 @@
|
||||
#include "zgetdump.h"
|
||||
|
||||
/*
|
||||
* DT operations
|
||||
* Initialize s390 multi-volume dump tool (for -d option)
|
||||
*/
|
||||
static int dt_s390mv_init(void)
|
||||
{
|
||||
return dt_s390mv_init_gen(DUMP_NON_EXTENDED);
|
||||
}
|
||||
|
||||
/*
|
||||
* Dump Tool operations
|
||||
*/
|
||||
struct dt dt_s390mv = {
|
||||
.desc = "Multi-volume DASD dump tool",
|
||||
|
||||
@@ -0,0 +1,29 @@
|
||||
/*
|
||||
* zgetdump - Tool for copying and converting System z dumps
|
||||
*
|
||||
* S390x multi-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 "zgetdump.h"
|
||||
|
||||
/*
|
||||
* Initialize s390 multi-volume dump tool (extedend) for -d option
|
||||
*/
|
||||
static int dt_s390mv_ext_init(void)
|
||||
{
|
||||
return dt_s390mv_init_gen(DUMP_EXTENDED);
|
||||
}
|
||||
|
||||
/*
|
||||
* Dump Tool (extedned) operations
|
||||
*/
|
||||
struct dt dt_s390mv_ext = {
|
||||
.desc = "Multi-volume DASD dump tool (extended)",
|
||||
.init = dt_s390mv_ext_init,
|
||||
.info = dt_s390mv_info,
|
||||
};
|
||||
+21
-2
@@ -18,6 +18,7 @@
|
||||
static struct {
|
||||
struct df_s390_dumper dumper;
|
||||
enum dfi_arch dumper_arch;
|
||||
bool extended; /* Extended dump-tool */
|
||||
} l;
|
||||
|
||||
/*
|
||||
@@ -27,6 +28,12 @@ static int dumper_read_eckd(int blk_size)
|
||||
{
|
||||
df_s390_dumper_read(g.fh, blk_size, &l.dumper);
|
||||
|
||||
if (l.extended) {
|
||||
if (strncmp(l.dumper.magic, DF_S390_DUMPER_MAGIC_EXT, 7) != 0)
|
||||
return -ENODEV;
|
||||
l.dumper_arch = DFI_ARCH_64;
|
||||
return 0;
|
||||
}
|
||||
if (strncmp(l.dumper.magic, DF_S390_DUMPER_MAGIC64, 7) == 0) {
|
||||
l.dumper_arch = DFI_ARCH_64;
|
||||
} else if (strncmp(l.dumper.magic, DF_S390_DUMPER_MAGIC32, 7) == 0) {
|
||||
@@ -46,6 +53,13 @@ static int dumper_read_eckd(int blk_size)
|
||||
*/
|
||||
static int dumper_check_fba(struct df_s390_dumper *dumper)
|
||||
{
|
||||
if (l.extended) {
|
||||
if (strncmp(dumper->magic, DF_S390_DUMPER_MAGIC_FBA_EXT, 7)
|
||||
!= 0)
|
||||
return -ENODEV;
|
||||
l.dumper_arch = DFI_ARCH_64;
|
||||
return 0;
|
||||
}
|
||||
if (strncmp(dumper->magic, DF_S390_DUMPER_MAGIC64_FBA, 7) == 0) {
|
||||
l.dumper_arch = DFI_ARCH_64;
|
||||
} else if (strncmp(dumper->magic, DF_S390_DUMPER_MAGIC32_FBA, 7) == 0) {
|
||||
@@ -123,8 +137,9 @@ static int sv_dumper_read(void)
|
||||
/*
|
||||
* Initialize s390 single-volume dump tool (for -d option)
|
||||
*/
|
||||
static int dt_s390sv_init(void)
|
||||
int dt_s390sv_init_gen(bool extended)
|
||||
{
|
||||
l.extended = extended;
|
||||
if (sv_dumper_read() != 0)
|
||||
return -ENODEV;
|
||||
dt_arch_set(l.dumper_arch);
|
||||
@@ -133,8 +148,12 @@ static int dt_s390sv_init(void)
|
||||
return 0;
|
||||
}
|
||||
|
||||
static int dt_s390sv_init(void)
|
||||
{
|
||||
return dt_s390sv_init_gen(DUMP_NON_EXTENDED);
|
||||
}
|
||||
/*
|
||||
* s390 single-volume DT operations
|
||||
* s390 single-volume DT (non-extended) operations
|
||||
*/
|
||||
struct dt dt_s390sv = {
|
||||
.desc = "Single-volume DASD dump tool",
|
||||
|
||||
@@ -0,0 +1,29 @@
|
||||
/*
|
||||
* zgetdump - Tool for copying and converting System z dumps
|
||||
*
|
||||
* S390 single-volume DASD dump tool (extended)
|
||||
*
|
||||
* 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 <linux/fs.h>
|
||||
#include "zgetdump.h"
|
||||
|
||||
/*
|
||||
* Initialize s390 single-volume extended dump tool (for -d option)
|
||||
*/
|
||||
static int dt_s390sv_ext_init(void)
|
||||
{
|
||||
return dt_s390sv_init_gen(DUMP_EXTENDED);
|
||||
}
|
||||
|
||||
/*
|
||||
* s390 single-volume DT (extended) operations
|
||||
*/
|
||||
struct dt dt_s390sv_ext = {
|
||||
.desc = "Single-volume DASD dump tool (extended)",
|
||||
.init = dt_s390sv_ext_init,
|
||||
};
|
||||
+3
-1
@@ -3,7 +3,7 @@
|
||||
*
|
||||
* Main include file - Should be included by all source files
|
||||
*
|
||||
* Copyright IBM Corp. 2001, 2017
|
||||
* 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.
|
||||
@@ -92,7 +92,9 @@ extern struct dfo dfo_elf;
|
||||
* Supported s390 dumpers
|
||||
*/
|
||||
extern struct dt dt_s390mv;
|
||||
extern struct dt dt_s390mv_ext;
|
||||
extern struct dt dt_s390sv;
|
||||
extern struct dt dt_s390sv_ext;
|
||||
extern struct dt dt_scsi;
|
||||
|
||||
#endif /* ZGETDUMP_H */
|
||||
|
||||
Reference in New Issue
Block a user