From: Peter Xu <peterx@redhat.com>
To: qemu-devel@nongnu.org
Cc: "Eduardo Habkost" <ehabkost@redhat.com>,
"Laurent Vivier" <lvivier@redhat.com>,
"Peter Xu" <peterx@redhat.com>,
"Markus Armbruster" <armbru@redhat.com>,
"Juan Quintela" <quintela@redhat.com>,
"Dr . David Alan Gilbert" <dgilbert@redhat.com>,
"Marc-André Lureau" <marcandre.lureau@redhat.com>,
"Marcel Apfelbaum" <marcel@redhat.com>
Subject: [Qemu-devel] [PATCH v2 01/11] qdev: provide DEFINE_PROP_INT64()
Date: Mon, 17 Jul 2017 16:26:01 +0800 [thread overview]
Message-ID: <1500279971-13875-2-git-send-email-peterx@redhat.com> (raw)
In-Reply-To: <1500279971-13875-1-git-send-email-peterx@redhat.com>
We have merely all the stuff, but this one is missing. Add it in.
Am going to use this new helper for MigrationParameters fields, since
most of them are int64_t.
CC: Markus Armbruster <armbru@redhat.com>
CC: Eduardo Habkost <ehabkost@redhat.com>
CC: Marc-André Lureau <marcandre.lureau@redhat.com>
CC: Peter Xu <peterx@redhat.com>
CC: Juan Quintela <quintela@redhat.com>
CC: Marcel Apfelbaum <marcel@redhat.com>
Reviewed-by: Marc-André Lureau <marcandre.lureau@redhat.com>
Signed-off-by: Peter Xu <peterx@redhat.com>
---
hw/core/qdev-properties.c | 32 ++++++++++++++++++++++++++++++++
include/hw/qdev-properties.h | 3 +++
2 files changed, 35 insertions(+)
diff --git a/hw/core/qdev-properties.c b/hw/core/qdev-properties.c
index dcecdf0..c1d4e54 100644
--- a/hw/core/qdev-properties.c
+++ b/hw/core/qdev-properties.c
@@ -404,6 +404,31 @@ static void set_uint64(Object *obj, Visitor *v, const char *name,
visit_type_uint64(v, name, ptr, errp);
}
+static void get_int64(Object *obj, Visitor *v, const char *name,
+ void *opaque, Error **errp)
+{
+ DeviceState *dev = DEVICE(obj);
+ Property *prop = opaque;
+ int64_t *ptr = qdev_get_prop_ptr(dev, prop);
+
+ visit_type_int64(v, name, ptr, errp);
+}
+
+static void set_int64(Object *obj, Visitor *v, const char *name,
+ void *opaque, Error **errp)
+{
+ DeviceState *dev = DEVICE(obj);
+ Property *prop = opaque;
+ int64_t *ptr = qdev_get_prop_ptr(dev, prop);
+
+ if (dev->realized) {
+ qdev_prop_set_after_realize(dev, name, errp);
+ return;
+ }
+
+ visit_type_int64(v, name, ptr, errp);
+}
+
const PropertyInfo qdev_prop_uint64 = {
.name = "uint64",
.get = get_uint64,
@@ -411,6 +436,13 @@ const PropertyInfo qdev_prop_uint64 = {
.set_default_value = set_default_value_uint,
};
+const PropertyInfo qdev_prop_int64 = {
+ .name = "int64",
+ .get = get_int64,
+ .set = set_int64,
+ .set_default_value = set_default_value_int,
+};
+
/* --- string --- */
static void release_string(Object *obj, const char *name, void *opaque)
diff --git a/include/hw/qdev-properties.h b/include/hw/qdev-properties.h
index f6692d5..30af33b 100644
--- a/include/hw/qdev-properties.h
+++ b/include/hw/qdev-properties.h
@@ -13,6 +13,7 @@ extern const PropertyInfo qdev_prop_uint16;
extern const PropertyInfo qdev_prop_uint32;
extern const PropertyInfo qdev_prop_int32;
extern const PropertyInfo qdev_prop_uint64;
+extern const PropertyInfo qdev_prop_int64;
extern const PropertyInfo qdev_prop_size;
extern const PropertyInfo qdev_prop_string;
extern const PropertyInfo qdev_prop_chr;
@@ -136,6 +137,8 @@ extern const PropertyInfo qdev_prop_link;
DEFINE_PROP_SIGNED(_n, _s, _f, _d, qdev_prop_int32, int32_t)
#define DEFINE_PROP_UINT64(_n, _s, _f, _d) \
DEFINE_PROP_UNSIGNED(_n, _s, _f, _d, qdev_prop_uint64, uint64_t)
+#define DEFINE_PROP_INT64(_n, _s, _f, _d) \
+ DEFINE_PROP_SIGNED(_n, _s, _f, _d, qdev_prop_int64, int64_t)
#define DEFINE_PROP_SIZE(_n, _s, _f, _d) \
DEFINE_PROP_UNSIGNED(_n, _s, _f, _d, qdev_prop_size, uint64_t)
#define DEFINE_PROP_PCI_DEVFN(_n, _s, _f, _d) \
--
2.7.4
next prev parent reply other threads:[~2017-07-17 8:26 UTC|newest]
Thread overview: 36+ messages / expand[flat|nested] mbox.gz Atom feed top
2017-07-17 8:26 [Qemu-devel] [PATCH v2 00/11] migration: export cap/params to qdev props Peter Xu
2017-07-17 8:26 ` Peter Xu [this message]
2017-07-17 8:30 ` [Qemu-devel] [PATCH v2 01/11] qdev: provide DEFINE_PROP_INT64() Marcel Apfelbaum
2017-07-17 16:24 ` Juan Quintela
2017-07-17 16:30 ` Eric Blake
2017-07-18 1:25 ` Peter Xu
2017-07-17 17:49 ` Eduardo Habkost
2017-07-17 8:26 ` [Qemu-devel] [PATCH v2 02/11] migration: export parameters to props Peter Xu
2017-07-17 16:30 ` Juan Quintela
2017-07-17 8:26 ` [Qemu-devel] [PATCH v2 03/11] migration: export capabilities " Peter Xu
2017-07-17 16:58 ` Juan Quintela
2017-07-18 1:34 ` Peter Xu
2017-07-17 17:52 ` Eduardo Habkost
2017-07-18 1:00 ` Peter Xu
2017-07-17 8:26 ` [Qemu-devel] [PATCH v2 04/11] qom: call parent first on post_init() Peter Xu
2017-07-17 18:02 ` Eduardo Habkost
2017-07-17 8:26 ` [Qemu-devel] [PATCH v2 05/11] migration: introduce migrate_params_check() Peter Xu
2017-07-17 17:04 ` Juan Quintela
2017-07-17 8:26 ` [Qemu-devel] [PATCH v2 06/11] migration: provide migrate_params_apply() Peter Xu
2017-07-17 19:01 ` Juan Quintela
2017-07-17 8:26 ` [Qemu-devel] [PATCH v2 07/11] migration: check global params for validity Peter Xu
2017-07-17 17:50 ` Juan Quintela
2017-07-17 18:25 ` Eduardo Habkost
2017-07-18 1:56 ` Peter Xu
2017-07-18 2:33 ` Eduardo Habkost
2017-07-18 2:41 ` Peter Xu
2017-07-17 8:26 ` [Qemu-devel] [PATCH v2 08/11] migration: remove check against colo support Peter Xu
2017-07-17 17:07 ` Juan Quintela
2017-07-18 7:13 ` Zhang Chen
2017-07-17 8:26 ` [Qemu-devel] [PATCH v2 09/11] migration: provide migrate_caps_check() Peter Xu
2017-07-17 19:03 ` Juan Quintela
2017-07-17 8:26 ` [Qemu-devel] [PATCH v2 10/11] migration: provide migrate_cap_add() Peter Xu
2017-07-17 17:14 ` Juan Quintela
2017-07-18 3:10 ` Peter Xu
2017-07-17 8:26 ` [Qemu-devel] [PATCH v2 11/11] migration: check global caps for validity Peter Xu
2017-07-17 19:48 ` Juan Quintela
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=1500279971-13875-2-git-send-email-peterx@redhat.com \
--to=peterx@redhat.com \
--cc=armbru@redhat.com \
--cc=dgilbert@redhat.com \
--cc=ehabkost@redhat.com \
--cc=lvivier@redhat.com \
--cc=marcandre.lureau@redhat.com \
--cc=marcel@redhat.com \
--cc=qemu-devel@nongnu.org \
--cc=quintela@redhat.com \
/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).