mirror of
https://github.com/ibm-s390-linux/s390-tools.git
synced 2026-08-05 02:14:52 +00:00
zdump: Implement DT interface for NGDump
The NGDump DT interface enables zgetdump to display various meta information contained within a dump partition prepared for NGDump stand-alone dump. Usage example: -------------- No dump yet made ---------------- $ zgetdump -d /dev/nvme0n1 Dump device info: Dump tool.........: Next Generation (NGDump) dump tool Version...........: 1 Architecture......: s390x (64 bit) Partition info: Partition number..: 1 Dump present ------------ $ zgetdump -d /dev/nvme0n1 Dump device info: Dump tool.........: Next Generation (NGDump) dump tool Version...........: 1 Architecture......: s390x (64 bit) Partition info: Partition number..: 1 Meta info: File..............: dump.elf Alternative disk path --------------------- $ zgetdump -d /dev/disk/by-id/nvme-eui.01000000010000005cd2e4c5bc845051 Dump device info: Dump tool.........: Next Generation (NGDump) dump tool Version...........: 1 Architecture......: s390x (64 bit) Partition info: Partition number..: 1 Meta info: File..............: dump.elf Signed-off-by: Alexander Egorenkov <egorenar@linux.ibm.com> Reviewed-by: Alexander Gordeev <agordeev@linux.ibm.com> Reviewed-by: Mikhail Zaslonko <zaslonko@linux.ibm.com> Tested-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
8ddc31ea77
commit
0466760ec1
@@ -54,7 +54,7 @@ OBJECTS = zgetdump.o opts.o zg.o zg_error.o zg_print.o \
|
||||
dt.o dt_s390sv.o dt_s390sv_ext.o \
|
||||
dt_s390mv.o dt_s390mv_ext.o \
|
||||
dt_scsi.o output.o \
|
||||
ngdump.o
|
||||
ngdump.o dt_ngdump.o
|
||||
|
||||
ifeq ("$(HAVE_FUSE)","0")
|
||||
FUSE_CFLAGS = -DHAVE_FUSE=0 -D_FILE_OFFSET_BITS=64
|
||||
|
||||
@@ -22,6 +22,7 @@ static struct dt *dt_vec[] = {
|
||||
&dt_s390sv_ext,
|
||||
&dt_s390sv,
|
||||
&dt_scsi,
|
||||
&dt_ngdump,
|
||||
NULL,
|
||||
};
|
||||
|
||||
@@ -55,8 +56,8 @@ void dt_init(void)
|
||||
while ((dt = dt_vec[i])) {
|
||||
g.fh = zg_open(g.opts.device, O_RDONLY, ZG_CHECK);
|
||||
if (!S_ISBLK(g.fh->sb.st_mode))
|
||||
ERR_EXIT("Please specify DASD or SCSI device node"
|
||||
"(e.g. /dev/dasdd or /dev/sda )");
|
||||
ERR_EXIT("Please specify DASD, SCSI or NVMe device node"
|
||||
"(e.g. /dev/dasdd, /dev/sda or /dev/nvme0n1 )");
|
||||
if (dt->init() == 0) {
|
||||
l.dt = dt;
|
||||
return;
|
||||
|
||||
@@ -41,5 +41,6 @@ extern struct dt dt_s390mv_ext;
|
||||
extern struct dt dt_s390sv;
|
||||
extern struct dt dt_s390sv_ext;
|
||||
extern struct dt dt_scsi;
|
||||
extern struct dt dt_ngdump;
|
||||
|
||||
#endif
|
||||
|
||||
63
zdump/dt_ngdump.c
Normal file
63
zdump/dt_ngdump.c
Normal file
@@ -0,0 +1,63 @@
|
||||
/*
|
||||
* zgetdump - Tool for copying and converting System z dumps
|
||||
*
|
||||
* NGDump dump tool
|
||||
*
|
||||
* Copyright IBM Corp. 2021
|
||||
*
|
||||
* 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"
|
||||
#include "zg.h"
|
||||
#include "dt.h"
|
||||
#include "ngdump.h"
|
||||
|
||||
/*
|
||||
* File local static data
|
||||
*/
|
||||
static struct {
|
||||
int part_num;
|
||||
struct ngdump_meta meta;
|
||||
} l;
|
||||
|
||||
static int dt_ngdump_init(void)
|
||||
{
|
||||
char *part_path = NULL;
|
||||
int rc;
|
||||
|
||||
l.part_num = ngdump_get_dump_part(g.fh);
|
||||
if (l.part_num <= 0)
|
||||
return -1;
|
||||
if (ngdump_get_disk_part_path(g.fh->path, l.part_num, &part_path) < 0)
|
||||
return -1;
|
||||
rc = ngdump_read_meta_from_device(part_path, &l.meta);
|
||||
free(part_path);
|
||||
if (rc)
|
||||
return -1;
|
||||
|
||||
dt_arch_set(DFI_ARCH_64);
|
||||
dt_version_set(l.meta.version);
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
static void dt_ngdump_info(void)
|
||||
{
|
||||
STDERR("Partition info:\n");
|
||||
STDERR(" Partition number..: %d\n", l.part_num);
|
||||
if (!l.meta.file)
|
||||
return;
|
||||
STDERR("Meta info:\n");
|
||||
STDERR(" File..............: %s\n", l.meta.file);
|
||||
}
|
||||
|
||||
/*
|
||||
* NGDump DT operations
|
||||
*/
|
||||
struct dt dt_ngdump = {
|
||||
.desc = "Next Generation (NGDump) dump tool",
|
||||
.init = dt_ngdump_init,
|
||||
.info = dt_ngdump_info,
|
||||
};
|
||||
Reference in New Issue
Block a user