|
Packit Service |
501009 |
/*
|
|
Packit Service |
501009 |
* diskdump.h
|
|
Packit Service |
501009 |
*
|
|
Packit Service |
501009 |
* Copyright (C) 2004, 2005, 2006 David Anderson
|
|
Packit Service |
501009 |
* Copyright (C) 2004, 2005, 2006 Red Hat, Inc. All rights reserved.
|
|
Packit Service |
501009 |
* Copyright (C) 2005 FUJITSU LIMITED
|
|
Packit Service |
501009 |
* Copyright (C) 2005 NEC Corporation
|
|
Packit Service |
501009 |
*
|
|
Packit Service |
501009 |
* This program is free software; you can redistribute it and/or modify
|
|
Packit Service |
501009 |
* it under the terms of the GNU General Public License as published by
|
|
Packit Service |
501009 |
* the Free Software Foundation; either version 2 of the License, or
|
|
Packit Service |
501009 |
* (at your option) any later version.
|
|
Packit Service |
501009 |
*
|
|
Packit Service |
501009 |
* This program is distributed in the hope that it will be useful,
|
|
Packit Service |
501009 |
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
|
Packit Service |
501009 |
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
|
Packit Service |
501009 |
* GNU General Public License for more details.
|
|
Packit Service |
501009 |
*/
|
|
Packit Service |
501009 |
|
|
Packit Service |
501009 |
#include <elf.h>
|
|
Packit Service |
501009 |
|
|
Packit Service |
501009 |
#define divideup(x, y) (((x) + ((y) - 1)) / (y))
|
|
Packit Service |
501009 |
#define round(x, y) (((x) / (y)) * (y))
|
|
Packit Service |
501009 |
|
|
Packit Service |
501009 |
#define DUMP_PARTITION_SIGNATURE "diskdump"
|
|
Packit Service |
501009 |
#define SIG_LEN (sizeof(DUMP_PARTITION_SIGNATURE) - 1)
|
|
Packit Service |
501009 |
#define DISK_DUMP_SIGNATURE "DISKDUMP"
|
|
Packit Service |
501009 |
#define KDUMP_SIGNATURE "KDUMP "
|
|
Packit Service |
501009 |
|
|
Packit Service |
501009 |
#define DUMP_HEADER_COMPLETED 0
|
|
Packit Service |
501009 |
#define DUMP_HEADER_INCOMPLETED 1
|
|
Packit Service |
501009 |
#define DUMP_HEADER_COMPRESSED 8
|
|
Packit Service |
501009 |
|
|
Packit Service |
501009 |
struct disk_dump_header {
|
|
Packit Service |
501009 |
char signature[SIG_LEN]; /* = "DISKDUMP" */
|
|
Packit Service |
501009 |
int header_version; /* Dump header version */
|
|
Packit Service |
501009 |
struct new_utsname utsname; /* copy of system_utsname */
|
|
Packit Service |
501009 |
struct timeval timestamp; /* Time stamp */
|
|
Packit Service |
501009 |
unsigned int status; /* Above flags */
|
|
Packit Service |
501009 |
int block_size; /* Size of a block in byte */
|
|
Packit Service |
501009 |
int sub_hdr_size; /* Size of arch dependent
|
|
Packit Service |
501009 |
header in blocks */
|
|
Packit Service |
501009 |
unsigned int bitmap_blocks; /* Size of Memory bitmap in
|
|
Packit Service |
501009 |
block */
|
|
Packit Service |
501009 |
unsigned int max_mapnr; /* = max_mapnr, OBSOLETE!
|
|
Packit Service |
501009 |
32bit only, full 64bit
|
|
Packit Service |
501009 |
in sub header. */
|
|
Packit Service |
501009 |
unsigned int total_ram_blocks;/* Number of blocks should be
|
|
Packit Service |
501009 |
written */
|
|
Packit Service |
501009 |
unsigned int device_blocks; /* Number of total blocks in
|
|
Packit Service |
501009 |
* the dump device */
|
|
Packit Service |
501009 |
unsigned int written_blocks; /* Number of written blocks */
|
|
Packit Service |
501009 |
unsigned int current_cpu; /* CPU# which handles dump */
|
|
Packit Service |
501009 |
int nr_cpus; /* Number of CPUs */
|
|
Packit Service |
501009 |
struct task_struct *tasks[0];
|
|
Packit Service |
501009 |
};
|
|
Packit Service |
501009 |
|
|
Packit Service |
501009 |
struct disk_dump_sub_header {
|
|
Packit Service |
501009 |
long elf_regs;
|
|
Packit Service |
501009 |
};
|
|
Packit Service |
501009 |
|
|
Packit Service |
501009 |
struct kdump_sub_header {
|
|
Packit Service |
501009 |
unsigned long phys_base;
|
|
Packit Service |
501009 |
int dump_level; /* header_version 1 and later */
|
|
Packit Service |
501009 |
int split; /* header_version 2 and later */
|
|
Packit Service |
501009 |
unsigned long start_pfn; /* header_version 2 and later,
|
|
Packit Service |
501009 |
OBSOLETE! 32bit only, full 64bit
|
|
Packit Service |
501009 |
in start_pfn_64. */
|
|
Packit Service |
501009 |
unsigned long end_pfn; /* header_version 2 and later,
|
|
Packit Service |
501009 |
OBSOLETE! 32bit only, full 64bit
|
|
Packit Service |
501009 |
in end_pfn_64. */
|
|
Packit Service |
501009 |
off_t offset_vmcoreinfo; /* header_version 3 and later */
|
|
Packit Service |
501009 |
unsigned long size_vmcoreinfo; /* header_version 3 and later */
|
|
Packit Service |
501009 |
off_t offset_note; /* header_version 4 and later */
|
|
Packit Service |
501009 |
unsigned long size_note; /* header_version 4 and later */
|
|
Packit Service |
501009 |
off_t offset_eraseinfo; /* header_version 5 and later */
|
|
Packit Service |
501009 |
unsigned long size_eraseinfo; /* header_version 5 and later */
|
|
Packit Service |
501009 |
unsigned long long start_pfn_64; /* header_version 6 and later */
|
|
Packit Service |
501009 |
unsigned long long end_pfn_64; /* header_version 6 and later */
|
|
Packit Service |
501009 |
unsigned long long max_mapnr_64; /* header_version 6 and later */
|
|
Packit Service |
501009 |
};
|
|
Packit Service |
501009 |
|
|
Packit Service |
501009 |
/* page flags */
|
|
Packit Service |
501009 |
#define DUMP_DH_COMPRESSED_ZLIB 0x1 /* page is compressed with zlib */
|
|
Packit Service |
501009 |
#define DUMP_DH_COMPRESSED_LZO 0x2 /* page is compressed with lzo */
|
|
Packit Service |
501009 |
#define DUMP_DH_COMPRESSED_SNAPPY 0x4 /* page is compressed with snappy */
|
|
Packit Service |
501009 |
#define DUMP_DH_COMPRESSED_INCOMPLETE 0x8 /* dumpfile is incomplete */
|
|
Packit Service |
501009 |
#define DUMP_DH_EXCLUDED_VMEMMAP 0x10 /* unused vmemmap pages are excluded */
|
|
Packit Service |
501009 |
|
|
Packit Service |
501009 |
/* descriptor of each page for vmcore */
|
|
Packit Service |
501009 |
typedef struct page_desc {
|
|
Packit Service |
501009 |
off_t offset; /* the offset of the page data*/
|
|
Packit Service |
501009 |
unsigned int size; /* the size of this dump page */
|
|
Packit Service |
501009 |
unsigned int flags; /* flags */
|
|
Packit Service |
501009 |
unsigned long long page_flags; /* page flags */
|
|
Packit Service |
501009 |
} page_desc_t;
|
|
Packit Service |
501009 |
|
|
Packit Service |
501009 |
#define DISKDUMP_CACHED_PAGES (16)
|
|
Packit Service |
501009 |
#define PAGE_VALID (0x1) /* flags */
|
|
Packit Service |
501009 |
#define DISKDUMP_VALID_PAGE(flags) ((flags) & PAGE_VALID)
|
|
Packit Service |
501009 |
|