From: Michael Roth <mdroth@linux.vnet.ibm.com>
To: qemu-devel@nongnu.org
Cc: kwolf@redhat.com, peter.maydell@linaro.org, aliguori@us.ibm.com,
quintela@redhat.com, blauwirbel@gmail.com, pbonzini@redhat.com
Subject: [Qemu-devel] [PATCH 01/29] qemu-timer: add QEMUTimer visitor
Date: Thu, 1 Nov 2012 08:04:03 -0500 [thread overview]
Message-ID: <1351775071-7644-2-git-send-email-mdroth@linux.vnet.ibm.com> (raw)
In-Reply-To: <1351775071-7644-1-git-send-email-mdroth@linux.vnet.ibm.com>
We'll use this for serializing rtc and elsewhere
Signed-off-by: Michael Roth <mdroth@linux.vnet.ibm.com>
---
Makefile | 3 ++-
qemu-timer.c | 29 +++++++++++++++++++++++++++++
qemu-timer.h | 4 ++++
3 files changed, 35 insertions(+), 1 deletion(-)
diff --git a/Makefile b/Makefile
index b575361..f2d2e70 100644
--- a/Makefile
+++ b/Makefile
@@ -172,7 +172,8 @@ qemu-img.o: qemu-img-cmds.h
tools-obj-y = $(oslib-obj-y) $(trace-obj-y) qemu-tool.o qemu-timer.o \
qemu-timer-common.o main-loop.o notify.o \
- iohandler.o cutils.o iov.o async.o error.o
+ iohandler.o cutils.o iov.o async.o error.o \
+ $(qapi-obj-y) $(qobject-obj-y)
tools-obj-$(CONFIG_POSIX) += compatfd.o
qemu-img$(EXESUF): qemu-img.o $(tools-obj-y) $(block-obj-y)
diff --git a/qemu-timer.c b/qemu-timer.c
index ede84ff..ef2ec6a 100644
--- a/qemu-timer.c
+++ b/qemu-timer.c
@@ -30,6 +30,7 @@
#include "hw/hw.h"
#include "qemu-timer.h"
+#include "qapi/qapi-visit-core.h"
#ifdef _WIN32
#include <mmsystem.h>
@@ -61,6 +62,34 @@ struct QEMUTimer {
int scale;
};
+void visit_type_QEMUTimer(Visitor *v, QEMUTimer **obj, const char *name,
+ Error **errp)
+{
+ int64_t expire_time, expire_time_cpy;
+
+ if (error_is_set(errp)) {
+ return;
+ }
+ if (!obj || !*obj) {
+ error_set(errp, QERR_INVALID_PARAMETER_VALUE, name ? name : NULL,
+ "non-NULL QEMUTimer");
+ return;
+ }
+ expire_time = expire_time_cpy = qemu_timer_expire_time_ns(*obj);
+ visit_start_struct(v, NULL, "QEMUTimer", name, 0, errp);
+ visit_type_int64(v, &expire_time, "expire_time", errp);
+ visit_end_struct(v, errp);
+
+ /* if we're modifying a QEMUTimer, re-arm/delete accordingly */
+ if (expire_time != expire_time_cpy) {
+ if (expire_time != -1) {
+ qemu_mod_timer_ns(*obj, expire_time);
+ } else {
+ qemu_del_timer(*obj);
+ }
+ }
+}
+
struct qemu_alarm_timer {
char const *name;
int (*start)(struct qemu_alarm_timer *t);
diff --git a/qemu-timer.h b/qemu-timer.h
index da7e97c..3d3d9d6 100644
--- a/qemu-timer.h
+++ b/qemu-timer.h
@@ -4,6 +4,7 @@
#include "qemu-common.h"
#include "main-loop.h"
#include "notify.h"
+#include "qapi/qapi-visit-core.h"
#ifdef __FreeBSD__
#include <sys/param.h>
@@ -67,6 +68,9 @@ int64_t cpu_get_ticks(void);
void cpu_enable_ticks(void);
void cpu_disable_ticks(void);
+void visit_type_QEMUTimer(Visitor *v, QEMUTimer **obj, const char *name,
+ Error **errp);
+
static inline QEMUTimer *qemu_new_timer_ns(QEMUClock *clock, QEMUTimerCB *cb,
void *opaque)
{
--
1.7.9.5
next prev parent reply other threads:[~2012-11-01 13:04 UTC|newest]
Thread overview: 30+ messages / expand[flat|nested] mbox.gz Atom feed top
2012-11-01 13:04 [Qemu-devel] [PATCH 00/29] QIDL: First Batch of Device Conversions Michael Roth
2012-11-01 13:04 ` Michael Roth [this message]
2012-11-01 13:04 ` [Qemu-devel] [PATCH 02/29] qidl: qidl.h, mark common immutable types as q_immutable by default Michael Roth
2012-11-01 13:04 ` [Qemu-devel] [PATCH 03/29] isa: qidl_declare ISADevice Michael Roth
2012-11-01 13:04 ` [Qemu-devel] [PATCH 04/29] rtc: qidl_declare RTCState Michael Roth
2012-11-01 13:04 ` [Qemu-devel] [PATCH 05/29] rtc: use qidl-generated properties Michael Roth
2012-11-01 13:04 ` [Qemu-devel] [PATCH 06/29] rtc: add qom property for RTCState state Michael Roth
2012-11-01 13:04 ` [Qemu-devel] [PATCH 07/29] pci: qidl_declare PCIDevice + PCIBus Michael Roth
2012-11-01 13:04 ` [Qemu-devel] [PATCH 08/29] pci: use qidl_declare'd properties for TYPE_PCI_DEVICE Michael Roth
2012-11-01 13:04 ` [Qemu-devel] [PATCH 09/29] pci: add qom property for PCIBus instances Michael Roth
2012-11-01 13:04 ` [Qemu-devel] [PATCH 10/29] vga: qidl_declare VGACommonState Michael Roth
2012-11-01 13:04 ` [Qemu-devel] [PATCH 11/29] cirrus: qidl_declare PCICirrusVGAState + CirrusVGAState Michael Roth
2012-11-01 13:04 ` [Qemu-devel] [PATCH 12/29] cirrus: add qom property for cirrus-vga state Michael Roth
2012-11-01 13:04 ` [Qemu-devel] [PATCH 13/29] cirrus: qidl_declare ISACirrusVGAState Michael Roth
2012-11-01 13:04 ` [Qemu-devel] [PATCH 14/29] cirrus: add qom property for isa-cirrus-vga Michael Roth
2012-11-01 13:04 ` [Qemu-devel] [PATCH 15/29] i440fx: qidl_declare PCII440FXState Michael Roth
2012-11-01 13:04 ` [Qemu-devel] [PATCH 16/29] i440fx: a qom property for i440FX state Michael Roth
2012-11-01 13:04 ` [Qemu-devel] [PATCH 17/29] piix3: qidl_declare PIIX3State Michael Roth
2012-11-01 13:04 ` [Qemu-devel] [PATCH 18/29] piix3: add qom property for PIIX3 state Michael Roth
2012-11-01 13:04 ` [Qemu-devel] [PATCH 19/29] shpc: qidl_declare SHPCDevice Michael Roth
2012-11-01 13:04 ` [Qemu-devel] [PATCH 20/29] pci_bridge: qidl_declare PCIBridge Michael Roth
2012-11-01 13:04 ` [Qemu-devel] [PATCH 21/29] pci_bridge_dev: qidl_declare PCIBridgeDev Michael Roth
2012-11-01 13:04 ` [Qemu-devel] [PATCH 22/29] pci_bridge_dev: add qom property for pci-bridge state Michael Roth
2012-11-01 13:04 ` [Qemu-devel] [PATCH 23/29] ide: qidl_declare IDEBus + IDEState + IDEDevice Michael Roth
2012-11-01 13:04 ` [Qemu-devel] [PATCH 24/29] ide: qidl_declare ISAIDEState Michael Roth
2012-11-01 13:04 ` [Qemu-devel] [PATCH 25/29] ide: add qom property for isa-ide state Michael Roth
2012-11-01 13:04 ` [Qemu-devel] [PATCH 26/29] ide: qidl_declare BMDMAState + PCIIDEState Michael Roth
2012-11-01 13:04 ` [Qemu-devel] [PATCH 27/29] ide: add qom property for piix3/piix4-ide state Michael Roth
2012-11-01 13:04 ` [Qemu-devel] [PATCH 28/29] hpet: qidl_declare HPETState + HPETTimer Michael Roth
2012-11-01 13:04 ` [Qemu-devel] [PATCH 29/29] hpet: add qom property for hpet state Michael Roth
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=1351775071-7644-2-git-send-email-mdroth@linux.vnet.ibm.com \
--to=mdroth@linux.vnet.ibm.com \
--cc=aliguori@us.ibm.com \
--cc=blauwirbel@gmail.com \
--cc=kwolf@redhat.com \
--cc=pbonzini@redhat.com \
--cc=peter.maydell@linaro.org \
--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).