File: diskdump.h

package info (click to toggle)
libkdumpfile 0.5.4-3
  • links: PTS, VCS
  • area: main
  • in suites: sid, trixie
  • size: 3,800 kB
  • sloc: ansic: 34,639; sh: 3,853; python: 1,490; makefile: 755
file content (169 lines) | stat: -rw-r--r-- 4,303 bytes parent folder | download | duplicates (2)
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
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
/* DISKDUMP/KDUMP format definitions.
   Copyright (C) 2016 Petr Tesarik <ptesarik@suse.cz>

   This file is free software; you can redistribute it and/or modify
   it under the terms of either

     * the GNU Lesser General Public License as published by the Free
       Software Foundation; either version 3 of the License, or (at
       your option) any later version

   or

     * the GNU General Public License as published by the Free
       Software Foundation; either version 2 of the License, or (at
       your option) any later version

   or both in parallel, as here.

   libkdumpfile is distributed in the hope that it will be useful, but
   WITHOUT ANY WARRANTY; without even the implied warranty of
   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
   General Public License for more details.

   You should have received copies of the GNU General Public License and
   the GNU Lesser General Public License along with this program.  If
   not, see <http://www.gnu.org/licenses/>.
*/

#ifndef _DISKDUMP_H
#define _DISKDUMP_H 1

#include <stdint.h>

#define MDF_SIGNATURE		"makedumpfile"
#define MDF_SIG_LEN		16
#define MDF_TYPE_FLAT_HEADER	1
#define MDF_VERSION_FLAT_HEADER	1
#define MDF_HEADER_SIZE		4096

/* Flattened format header. */
struct makedumpfile_header {
	char	signature[MDF_SIG_LEN];
	int64_t	type;
	int64_t	version;
} __attribute__((packed));

/* Flattened segment header */
struct makedumpfile_data_header {
        int64_t offset;
        int64_t buf_size;
} __attribute__((packed));

#define MDF_OFFSET_END_FLAG	(-(int64_t)1)

#define DISKDUMP_SIGNATURE		"DISKDUMP"
#define KDUMP_SIGNATURE			"KDUMP   "
#define SIGNATURE_LEN			8
#define DISKDUMP_HEADER_BLOCKS		1

#define DUMP_HEADER_COMPLETED	0
#define DUMP_HEADER_INCOMPLETED 1
#define DUMP_HEADER_COMPRESSED  8

struct disk_dump_header_32 {
	char    signature[SIGNATURE_LEN];
	int32_t header_version;
	char    utsname_sysname[65];
	char    utsname_nodename[65];
	char    utsname_release[65];
	char    utsname_version[65];
	char    utsname_machine[65];
	char    utsname_domainname[65];
	char    _pad[2];
	struct {
		uint32_t tv_sec;
		uint32_t tv_usec;
	} timestamp;
	uint32_t status;
	int32_t  block_size;
	int32_t  sub_hdr_size;
	uint32_t bitmap_blocks;
	uint32_t max_mapnr;
	uint32_t total_ram_blocks;
	uint32_t device_blocks;
	uint32_t written_blocks;
	uint32_t current_cpu;
	int32_t  nr_cpus;
}  __attribute__((packed));

struct disk_dump_header_64 {
	char    signature[SIGNATURE_LEN];
	int32_t header_version;
	char    utsname_sysname[65];
	char    utsname_nodename[65];
	char    utsname_release[65];
	char    utsname_version[65];
	char    utsname_machine[65];
	char    utsname_domainname[65];
	char    _pad[6];
	struct {
		uint64_t tv_sec;
		uint64_t tv_usec;
	} timestamp;
	uint32_t status;
	int32_t  block_size;
	int32_t  sub_hdr_size;
	uint32_t bitmap_blocks;
	uint32_t max_mapnr;
	uint32_t total_ram_blocks;
	uint32_t device_blocks;
	uint32_t written_blocks;
	uint32_t current_cpu;
	int32_t  nr_cpus;
} __attribute__((packed));

struct kdump_sub_header_32 {
	uint32_t phys_base;
	int32_t  dump_level;
	int32_t  split;
	uint32_t start_pfn;
	uint32_t end_pfn;
	uint64_t offset_vmcoreinfo;
	uint32_t size_vmcoreinfo;
	uint64_t offset_note;
	uint32_t size_note;
	uint64_t offset_eraseinfo;
	uint32_t size_eraseinfo;
	uint64_t start_pfn_64;
	uint64_t end_pfn_64;
	uint64_t max_mapnr_64;
} __attribute__((packed));

struct kdump_sub_header_64 {
	uint64_t phys_base;
	int32_t  dump_level;
	int32_t  split;
	uint64_t start_pfn;
	uint64_t end_pfn;
	uint64_t offset_vmcoreinfo;
	uint64_t size_vmcoreinfo;
	uint64_t offset_note;
	uint64_t size_note;
	uint64_t offset_eraseinfo;
	uint64_t size_eraseinfo;
	uint64_t start_pfn_64;
	uint64_t end_pfn_64;
	uint64_t max_mapnr_64;
} __attribute__((packed));

#define DUMP_DH_COMPRESSED_ZLIB		0x1
#define DUMP_DH_COMPRESSED_LZO		0x2
#define DUMP_DH_COMPRESSED_SNAPPY	0x4
#define DUMP_DH_COMPRESSED_INCOMPLETE	0x8
#define DUMP_DH_EXCLUDED_VMEMMAP	0x10
#define DUMP_DH_COMPRESSED_ZSTD		0x20

#define DUMP_DH_COMPRESSED			\
	(DUMP_DH_COMPRESSED_ZLIB |		\
	 DUMP_DH_COMPRESSED_LZO |		\
	 DUMP_DH_COMPRESSED_SNAPPY)

struct page_desc {
	uint64_t offset;
	uint32_t size;
	uint32_t flags;
	uint64_t page_flags;
} __attribute__((packed));

#endif	/* diskdump.h */