zgetdump: Add 'Dump file size' field for zgetdump -i output

Add 'Dump file size' field for zgetdump -i output to show the actual size
of dump file in s390 extended format on disk in megabytes.

Signed-off-by: Mikhail Zaslonko <zaslonko@linux.ibm.com>
Signed-off-by: Jan Höppner <hoeppner@linux.ibm.com>
This commit is contained in:
Mikhail Zaslonko
2018-03-01 16:58:28 +01:00
committed by Jan Höppner
parent 15c22ec742
commit cf99ea019e
4 changed files with 31 additions and 3 deletions

View File

@@ -72,6 +72,7 @@ struct attr {
u32 *real_cpu_cnt;
struct new_utsname *utsname;
char *dump_method;
u64 *file_size;
};
/*
@@ -262,6 +263,9 @@ void dfi_info_print(void)
if (l.attr.mem_size_real)
STDERR(" Real memory range..: %lld MB\n",
TO_MIB(*l.attr.mem_size_real));
if (l.attr.file_size)
STDERR(" Dump file size.....: %lld MB\n",
TO_MIB(*l.attr.file_size));
if (dfi_mem_range())
mem_map_print();
if (l.dfi->info_dump) {
@@ -776,6 +780,21 @@ u64 *dfi_attr_mem_size_real(void)
return l.attr.mem_size_real;
}
/*
* Attribute: Dump file size
*/
void dfi_attr_file_size_set(u64 file_size)
{
l.attr.file_size = zg_alloc(sizeof(*l.attr.file_size));
*l.attr.file_size = file_size;
}
u64 *dfi_attr_file_size(void)
{
return l.attr.file_size;
}
/*
* Attribute: Build architecture
*/

View File

@@ -209,7 +209,10 @@ extern void dfi_attr_dump_method_set(char *dump_method);
extern char *dfi_attr_dump_method(void);
extern void dfi_attr_mem_size_real_set(u64 mem_size_real);
extern u64 *dfi_attr_mem_size_real();
extern u64 *dfi_attr_mem_size_real(void);
extern void dfi_attr_file_size_set(u64 dump_size);
extern u64 *dfi_attr_file_size(void);
extern void dfi_attr_vol_nr_set(unsigned int vol_nr);
extern unsigned int *dfi_attr_vol_nr(void);

View File

@@ -113,7 +113,7 @@ static int mem_chunks_add(void)
static int mem_chunks_add_ext(void)
{
struct df_s390_dump_segm_hdr dump_segm;
u64 rc, *off_ptr, old = 0;
u64 rc, *off_ptr, old = 0, dump_size = 0;
off_ptr = zg_alloc(sizeof(*off_ptr));
*off_ptr = zg_seek(g.fh, DF_S390_HDR_SIZE, ZG_CHECK_NONE);
@@ -131,6 +131,7 @@ static int mem_chunks_add_ext(void)
dfi_mem_chunk_add(dump_segm.start, dump_segm.len, off_ptr,
dfi_s390_ext_mem_chunk_read, zg_free);
old = dump_segm.start + dump_segm.len;
dump_size += dump_segm.len;
off_ptr = zg_alloc(sizeof(*off_ptr));
*off_ptr = zg_seek_cur(g.fh, dump_segm.len, ZG_CHECK_NONE);
if (dump_segm.stop_marker)
@@ -139,6 +140,8 @@ static int mem_chunks_add_ext(void)
/* Add zero memory chunk at the end */
dfi_mem_chunk_add(old, l.hdr.mem_size - old, NULL,
dfi_mem_chunk_read_zero, NULL);
/* Set the actual size of the dump file */
dfi_attr_file_size_set(dump_size);
/* Check if the last dump segment found */
if (!dump_segm.stop_marker)
return -EINVAL;

View File

@@ -318,7 +318,7 @@ static void mem_chunks_add(void)
*/
static int mem_chunks_add_ext(void)
{
u64 off, rc, part_end, old = 0;
u64 off, rc, part_end, old = 0, dump_size = 0;
struct df_s390_dump_segm_hdr dump_segm;
struct vol_mem_chunk *vol_mem_chunk;
unsigned int i;
@@ -357,6 +357,7 @@ static int mem_chunks_add_ext(void)
dfi_s390mv_ext_mem_read, NULL,
vol->nr);
old = dump_segm.start + dump_segm.len;
dump_size += dump_segm.len;
off = zg_seek_cur(vol->fh, dump_segm.len,
ZG_CHECK_NONE);
if (dump_segm.stop_marker)
@@ -367,6 +368,8 @@ static int mem_chunks_add_ext(void)
dfi_mem_chunk_add_vol(old, l.hdr.mem_size - old, NULL,
dfi_mem_chunk_read_zero, NULL,
vol->nr);
/* Set the actual size of the dump file */
dfi_attr_file_size_set(dump_size);
/* Read and verify the end marker */
rc = zg_read(vol->fh, &l.em, sizeof(l.em), ZG_CHECK);
if (rc != sizeof(l.em) ||