Files
s390-tools/zdump/dt_ngdump.c
Alexander Egorenkov 0466760ec1 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>
2022-06-20 13:14:05 +02:00

64 lines
1.2 KiB
C

/*
* 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,
};