|
|
9ae3a8 |
From f1155542d2e8ce5192a4001b1156b9d3bff4a398 Mon Sep 17 00:00:00 2001
|
|
|
9ae3a8 |
From: Laszlo Ersek <lersek@redhat.com>
|
|
|
9ae3a8 |
Date: Fri, 7 Nov 2014 17:17:53 +0100
|
|
|
9ae3a8 |
Subject: [PATCH 06/41] dump: add API to write vmcore
|
|
|
9ae3a8 |
|
|
|
9ae3a8 |
Message-id: <1415380693-16593-7-git-send-email-lersek@redhat.com>
|
|
|
9ae3a8 |
Patchwork-id: 62192
|
|
|
9ae3a8 |
O-Subject: [RHEL-7.1 qemu-kvm PATCH 06/26] dump: add API to write vmcore
|
|
|
9ae3a8 |
Bugzilla: 1157798
|
|
|
9ae3a8 |
RH-Acked-by: Stefan Hajnoczi <stefanha@redhat.com>
|
|
|
9ae3a8 |
RH-Acked-by: Luiz Capitulino <lcapitulino@redhat.com>
|
|
|
9ae3a8 |
RH-Acked-by: dgibson <dgibson@redhat.com>
|
|
|
9ae3a8 |
|
|
|
9ae3a8 |
From: qiaonuohan <qiaonuohan@cn.fujitsu.com>
|
|
|
9ae3a8 |
|
|
|
9ae3a8 |
Function is used to write vmcore in flatten format. In flatten format, data is
|
|
|
9ae3a8 |
written block by block, and in front of each block, a struct
|
|
|
9ae3a8 |
MakedumpfileDataHeader is stored there to indicate the offset and size of the
|
|
|
9ae3a8 |
data block.
|
|
|
9ae3a8 |
|
|
|
9ae3a8 |
struct MakedumpfileDataHeader {
|
|
|
9ae3a8 |
int64_t offset;
|
|
|
9ae3a8 |
int64_t buf_size;
|
|
|
9ae3a8 |
};
|
|
|
9ae3a8 |
|
|
|
9ae3a8 |
Signed-off-by: Qiao Nuohan <qiaonuohan@cn.fujitsu.com>
|
|
|
9ae3a8 |
Reviewed-by: Laszlo Ersek <lersek@redhat.com>
|
|
|
9ae3a8 |
Signed-off-by: Luiz Capitulino <lcapitulino@redhat.com>
|
|
|
9ae3a8 |
(cherry picked from commit 5d31babe5c7d854d6b8470bc9fa67a698926e65d)
|
|
|
9ae3a8 |
Signed-off-by: Laszlo Ersek <lersek@redhat.com>
|
|
|
9ae3a8 |
Signed-off-by: Miroslav Rezanina <mrezanin@redhat.com>
|
|
|
9ae3a8 |
---
|
|
|
9ae3a8 |
dump.c | 21 +++++++++++++++++++++
|
|
|
9ae3a8 |
1 file changed, 21 insertions(+)
|
|
|
9ae3a8 |
|
|
|
9ae3a8 |
diff --git a/dump.c b/dump.c
|
|
|
9ae3a8 |
index 6c902e5..710893f 100644
|
|
|
9ae3a8 |
--- a/dump.c
|
|
|
9ae3a8 |
+++ b/dump.c
|
|
|
9ae3a8 |
@@ -734,6 +734,27 @@ static int write_end_flat_header(int fd)
|
|
|
9ae3a8 |
return 0;
|
|
|
9ae3a8 |
}
|
|
|
9ae3a8 |
|
|
|
9ae3a8 |
+static int write_buffer(int fd, off_t offset, const void *buf, size_t size)
|
|
|
9ae3a8 |
+{
|
|
|
9ae3a8 |
+ size_t written_size;
|
|
|
9ae3a8 |
+ MakedumpfileDataHeader mdh;
|
|
|
9ae3a8 |
+
|
|
|
9ae3a8 |
+ mdh.offset = cpu_to_be64(offset);
|
|
|
9ae3a8 |
+ mdh.buf_size = cpu_to_be64(size);
|
|
|
9ae3a8 |
+
|
|
|
9ae3a8 |
+ written_size = qemu_write_full(fd, &mdh, sizeof(mdh));
|
|
|
9ae3a8 |
+ if (written_size != sizeof(mdh)) {
|
|
|
9ae3a8 |
+ return -1;
|
|
|
9ae3a8 |
+ }
|
|
|
9ae3a8 |
+
|
|
|
9ae3a8 |
+ written_size = qemu_write_full(fd, buf, size);
|
|
|
9ae3a8 |
+ if (written_size != size) {
|
|
|
9ae3a8 |
+ return -1;
|
|
|
9ae3a8 |
+ }
|
|
|
9ae3a8 |
+
|
|
|
9ae3a8 |
+ return 0;
|
|
|
9ae3a8 |
+}
|
|
|
9ae3a8 |
+
|
|
|
9ae3a8 |
static ram_addr_t get_start_block(DumpState *s)
|
|
|
9ae3a8 |
{
|
|
|
9ae3a8 |
GuestPhysBlock *block;
|
|
|
9ae3a8 |
--
|
|
|
9ae3a8 |
1.8.3.1
|
|
|
9ae3a8 |
|