1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
|
/*
* diskdump.h
*
* Copyright (C) 2004, 2005 David Anderson
* Copyright (C) 2004, 2005 Red Hat, Inc. All rights reserved.
* Copyright (C) 2005 FUJITSU LIMITED
* Copyright (C) 2005 NEC Corporation
*
* This software may be freely redistributed under the terms of the
* GNU General Public License.
*
* You should have received a copy of the GNU General Public License
* along with this program; if not, write to the Free Software
* Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
*/
#include <elf.h>
#define divideup(x, y) (((x) + ((y) - 1)) / (y))
#define round(x, y) (((x) / (y)) * (y))
#define roundup(x, y) ((((x) + ((y) - 1)) / (y)) * (y))
#define DUMP_PARTITION_SIGNATURE "diskdump"
#define DISK_DUMP_SIGNATURE "DISKDUMP"
#define KDUMP_SIGNATURE "KDUMP "
#define SIG_LEN (sizeof(DUMP_PARTITION_SIGNATURE) - 1)
#define DUMP_HEADER_COMPLETED 0
#define DUMP_HEADER_INCOMPLETED 1
#define DUMP_HEADER_COMPRESSED 8
struct new_utsname {
char sysname[65];
char nodename[65];
char release[65];
char version[65];
char machine[65];
char domainname[65];
};
struct disk_dump_header {
char signature[SIG_LEN]; /* = "KDUMP " */
int header_version; /* Dump header version */
struct new_utsname utsname; /* copy of system_utsname */
struct timeval timestamp; /* Time stamp */
unsigned int status; /* Above flags */
int block_size; /* Size of a block in byte */
int sub_hdr_size; /* Size of arch dependent
header in blocks */
unsigned int bitmap_blocks; /* Size of Memory bitmap in
block */
unsigned int max_mapnr; /* = max_mapnr */
unsigned int total_ram_blocks;/* Number of blocks should be
written */
unsigned int device_blocks; /* Number of total blocks in
* the dump device */
unsigned int written_blocks; /* Number of written blocks */
unsigned int current_cpu; /* CPU# which handles dump */
int nr_cpus; /* Number of CPUs */
struct task_struct *tasks[0];
};
/*
* Sub header for KDUMP
* But Common header of KDUMP is disk_dump_header of diskdump.
*/
struct kdump_sub_header {
unsigned long phys_base;
int dump_level; /* header_version 1 and later */
};
/* page flags */
#define DUMP_DH_COMPRESSED 0x1 /* page is compressed */
/* descriptor of each page for vmcore */
typedef struct page_desc {
off_t offset; /* the offset of the page data*/
unsigned int size; /* the size of this dump page */
unsigned int flags; /* flags */
unsigned long long page_flags; /* page flags */
} page_desc_t;
#define DISKDUMP_CACHED_PAGES (16)
#define PAGE_VALID (0x1) /* flags */
#define DISKDUMP_VALID_PAGE(flags) ((flags) & PAGE_VALID)
|