From: Glauber Costa <glommer@redhat.com>
To: kvm@vger.kernel.org
Cc: avi@redhat.com
Subject: [PATCH 1/3] introduce VMSTATE_U64
Date: Fri, 16 Oct 2009 15:27:37 -0400 [thread overview]
Message-ID: <1255721259-11740-2-git-send-email-glommer@redhat.com> (raw)
In-Reply-To: <1255721259-11740-1-git-send-email-glommer@redhat.com>
This is a patch actually written by Juan, which, according to him,
he plans on posting to qemu.git. Problem is that linux defines
u64 in a way that is type-uncompatible with uint64_t.
I am including it here, because it is a dependency to my patch series
that follows.
Signed-off-by: Glauber Costa <glommer@redhat.com>
---
hw/hw.h | 13 +++++++++++++
savevm.c | 23 +++++++++++++++++++++++
2 files changed, 36 insertions(+), 0 deletions(-)
diff --git a/hw/hw.h b/hw/hw.h
index 8c223f8..348bf1d 100644
--- a/hw/hw.h
+++ b/hw/hw.h
@@ -330,6 +330,10 @@ extern const VMStateInfo vmstate_info_uint16;
extern const VMStateInfo vmstate_info_uint32;
extern const VMStateInfo vmstate_info_uint64;
+#ifdef __linux__
+extern const VMStateInfo vmstate_info_u64;
+#endif
+
extern const VMStateInfo vmstate_info_timer;
extern const VMStateInfo vmstate_info_ptimer;
extern const VMStateInfo vmstate_info_buffer;
@@ -538,6 +542,15 @@ extern const VMStateDescription vmstate_i2c_slave;
#define VMSTATE_UINT64(_f, _s) \
VMSTATE_UINT64_V(_f, _s, 0)
+/* This is needed because on linux __u64 is unsigned long long
+ and on glibc uint64_t is unsigned long on 64 bits */
+#ifdef __linux__
+#define VMSTATE_U64_V(_f, _s, _v) \
+ VMSTATE_SINGLE(_f, _s, _v, vmstate_info_u64, __u64)
+#define VMSTATE_U64(_f, _s) \
+ VMSTATE_U64_V(_f, _s, 0)
+#endif
+
#define VMSTATE_UINT8_EQUAL(_f, _s) \
VMSTATE_SINGLE(_f, _s, 0, vmstate_info_uint8_equal, uint8_t)
diff --git a/savevm.c b/savevm.c
index a6f3556..1a68aa5 100644
--- a/savevm.c
+++ b/savevm.c
@@ -848,6 +848,29 @@ const VMStateInfo vmstate_info_uint64 = {
.put = put_uint64,
};
+/* 64 bit linux kernel unsigned int */
+
+#ifdef __linux__
+static int get_u64(QEMUFile *f, void *pv, size_t size)
+{
+ __u64 *v = pv;
+ qemu_get_be64s(f, (uint64_t *)v);
+ return 0;
+}
+
+static void put_u64(QEMUFile *f, void *pv, size_t size)
+{
+ __u64 *v = pv;
+ qemu_put_be64s(f, (uint64_t *)v);
+}
+
+const VMStateInfo vmstate_info_u64 = {
+ .name = "__u64",
+ .get = get_u64,
+ .put = put_u64,
+};
+#endif /* __linux__ */
+
/* 8 bit int. See that the received value is the same than the one
in the field */
--
1.6.2.2
next prev parent reply other threads:[~2009-10-16 19:27 UTC|newest]
Thread overview: 8+ messages / expand[flat|nested] mbox.gz Atom feed top
2009-10-16 19:27 [PATCH 0/3] Fix migration of linux guests using kvmclock Glauber Costa
2009-10-16 19:27 ` Glauber Costa [this message]
2009-10-16 19:27 ` [PATCH 2/3] properly save kvm system time msr registers Glauber Costa
2009-10-16 19:27 ` [PATCH 3/3] get and set clock upon migration Glauber Costa
2009-10-19 23:40 ` [PATCH 1/3] introduce VMSTATE_U64 Avi Kivity
2009-10-20 0:38 ` Glauber Costa
2009-10-19 19:51 ` [PATCH 0/3] Fix migration of linux guests using kvmclock Marcelo Tosatti
-- strict thread matches above, loose matches on Subject: below --
2009-10-27 17:49 [PATCH 1/3] introduce VMSTATE_U64 Andrew Theurer
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=1255721259-11740-2-git-send-email-glommer@redhat.com \
--to=glommer@redhat.com \
--cc=avi@redhat.com \
--cc=kvm@vger.kernel.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