From: qiaonuohan <qiaonuohan@cn.fujitsu.com>
To: lcapitulino@redhat.com, qemu-devel@nongnu.org
Cc: qiaonuohan <qiaonuohan@cn.fujitsu.com>
Subject: [Qemu-devel] [PATCH v9 04/14] dump: add API to write vmcore
Date: Tue, 18 Feb 2014 14:11:28 +0800 [thread overview]
Message-ID: <1392703898-20083-5-git-send-email-qiaonuohan@cn.fujitsu.com> (raw)
In-Reply-To: <1392703898-20083-1-git-send-email-qiaonuohan@cn.fujitsu.com>
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 <qiaonuohan@cn.fujitsu.com>
Reviewed-by: Laszlo Ersek <lersek@redhat.com>
---
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
next prev parent reply other threads:[~2014-02-18 6:13 UTC|newest]
Thread overview: 16+ messages / expand[flat|nested] mbox.gz Atom feed top
2014-02-18 6:11 [Qemu-devel] [PATCH v9 00/14] Make 'dump-guest-memory' dump in kdump-compressed format qiaonuohan
2014-02-18 6:11 ` [Qemu-devel] [PATCH v9 01/14] dump: const-qualify the buf of WriteCoreDumpFunction qiaonuohan
2014-02-18 6:11 ` [Qemu-devel] [PATCH v9 02/14] dump: add argument to write_elfxx_notes qiaonuohan
2014-02-18 6:11 ` [Qemu-devel] [PATCH v9 03/14] dump: add API to write header of flatten format qiaonuohan
2014-02-18 6:11 ` qiaonuohan [this message]
2014-02-18 6:11 ` [Qemu-devel] [PATCH v9 05/14] dump: add API to write elf notes to buffer qiaonuohan
2014-02-18 6:11 ` [Qemu-devel] [PATCH v9 06/14] dump: add support for lzo/snappy qiaonuohan
2014-02-18 6:11 ` [Qemu-devel] [PATCH v9 07/14] dump: add members to DumpState and init some of them qiaonuohan
2014-02-18 6:11 ` [Qemu-devel] [PATCH v9 08/14] dump: add API to write dump header qiaonuohan
2014-02-18 6:11 ` [Qemu-devel] [PATCH v9 09/14] dump: add API to write dump_bitmap qiaonuohan
2014-02-18 6:11 ` [Qemu-devel] [PATCH v9 10/14] dump: add APIs to operate DataCache qiaonuohan
2014-02-18 6:11 ` [Qemu-devel] [PATCH v9 11/14] dump: add API to write dump pages qiaonuohan
2014-02-18 6:11 ` [Qemu-devel] [PATCH v9 12/14] dump: make kdump-compressed format available for 'dump-guest-memory' qiaonuohan
2014-02-18 6:11 ` [Qemu-devel] [PATCH v9 13/14] Define the architecture for compressed dump format qiaonuohan
2014-02-18 6:11 ` [Qemu-devel] [PATCH v9 14/14] dump: add 'query-dump-guest-memory-capability' command qiaonuohan
2014-02-28 17:05 ` [Qemu-devel] [PATCH v9 00/14] Make 'dump-guest-memory' dump in kdump-compressed format Luiz Capitulino
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=1392703898-20083-5-git-send-email-qiaonuohan@cn.fujitsu.com \
--to=qiaonuohan@cn.fujitsu.com \
--cc=lcapitulino@redhat.com \
--cc=qemu-devel@nongnu.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).