[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[Qemu-devel] [PATCH 04/13 v7] dump: add API to write vmcore
From: |
qiaonuohan |
Subject: |
[Qemu-devel] [PATCH 04/13 v7] dump: add API to write vmcore |
Date: |
Fri, 17 Jan 2014 15:46:10 +0800 |
Function is used to write vmcore in flatten format. In flatten format, data is
written block by block, and in front of each block, a struct
MakedumpfileDataHeader is stored there to indicate the offset and size of the
data block.
struct MakedumpfileDataHeader {
int64_t offset;
int64_t buf_size;
};
Signed-off-by: Qiao Nuohan <address@hidden>
Reviewed-by: Laszlo Ersek <address@hidden>
---
dump.c | 21 +++++++++++++++++++++
1 files changed, 21 insertions(+), 0 deletions(-)
diff --git a/dump.c b/dump.c
index f233b3e..238ffa5 100644
--- a/dump.c
+++ b/dump.c
@@ -728,6 +728,27 @@ static int write_end_flat_header(int fd)
return 0;
}
+static int write_buffer(int fd, off_t offset, const void *buf, size_t size)
+{
+ size_t written_size;
+ MakedumpfileDataHeader mdh;
+
+ mdh.offset = cpu_to_be64(offset);
+ mdh.buf_size = cpu_to_be64(size);
+
+ written_size = qemu_write_full(fd, &mdh, sizeof(mdh));
+ if (written_size != sizeof(mdh)) {
+ return -1;
+ }
+
+ written_size = qemu_write_full(fd, buf, size);
+ if (written_size != size) {
+ return -1;
+ }
+
+ return 0;
+}
+
static ram_addr_t get_start_block(DumpState *s)
{
GuestPhysBlock *block;
--
1.7.1
- Re: [Qemu-devel] [PATCH 11/13 v7] dump: add API to write dump pages, (continued)
- [Qemu-devel] [PATCH 03/13 v7] dump: add API to write header of flatten format, qiaonuohan, 2014/01/17
- [Qemu-devel] [PATCH 02/13 v7] dump: add argument to write_elfxx_notes, qiaonuohan, 2014/01/17
- [Qemu-devel] [PATCH 09/13 v7] dump: add API to write dump_bitmap, qiaonuohan, 2014/01/17
- [Qemu-devel] [PATCH 08/13 v7] dump: add API to write dump header, qiaonuohan, 2014/01/17
- [Qemu-devel] [PATCH 04/13 v7] dump: add API to write vmcore,
qiaonuohan <=
- [Qemu-devel] [PATCH 12/13 v7] dump: make kdump-compressed format available for 'dump-guest-memory', qiaonuohan, 2014/01/17
- [Qemu-devel] [PATCH 13/13 v7] dump: add 'query-dump-guest-memory-capability' command, qiaonuohan, 2014/01/17
- Re: [Qemu-devel] [PATCH 00/13 v7] Make 'dump-guest-memory' dump in kdump-compressed format, Christian Borntraeger, 2014/01/17
- Re: [Qemu-devel] [PATCH 00/13 v7] Make 'dump-guest-memory' dump in kdump-compressed format, Qiao Nuohan, 2014/01/21