qemu-devel.nongnu.org archive mirror
 help / color / mirror / Atom feed
From: mtosatti@redhat.com
To: qemu-devel@nongnu.org
Cc: gleb@kernel.org, mprivozn@redhat.com,
	Marcelo Tosatti <mtosatti@redhat.com>,
	armbru@redhat.com, pbonzini@redhat.com
Subject: [Qemu-devel] [patch 3/3] mc146818rtc: add "rtc" link to "/machine"
Date: Wed, 04 Jun 2014 14:52:03 -0300	[thread overview]
Message-ID: <20140604175446.569449721@amt.cnet> (raw)
In-Reply-To: 20140604175200.667995104@amt.cnet

[-- Attachment #1: rtc-add-link --]
[-- Type: text/plain, Size: 1410 bytes --]

Add a link to rtc under /machine providing a stable 
location for management apps to query "date" field.

{"execute":"qom-get","arguments":{"path":"/machine/rtc","property":"date"} }

Suggested by Paolo Bonzini.

Signed-off-by: Marcelo Tosatti <mtosatti@redhat.com>

---
 hw/timer/mc146818rtc.c |    9 +++++++++
 1 file changed, 9 insertions(+)

Index: qemu/hw/timer/mc146818rtc.c
===================================================================
--- qemu.orig/hw/timer/mc146818rtc.c	2014-06-02 23:14:11.707436729 -0300
+++ qemu/hw/timer/mc146818rtc.c	2014-06-02 23:14:15.453424684 -0300
@@ -911,6 +911,9 @@
 
     object_property_add(OBJECT(s), "date", "struct tm",
                         rtc_get_date, NULL, NULL, s, NULL);
+
+    object_property_add_alias(qdev_get_machine(), "rtc", OBJECT(s),
+                              &error_abort);
 }
 
 ISADevice *rtc_init(ISABus *bus, int base_year, qemu_irq intercept_irq)
@@ -954,11 +957,17 @@
     dc->cannot_instantiate_with_device_add_yet = true;
 }
 
+static void rtc_finalize(Object *obj)
+{
+    object_property_del(qdev_get_machine(), "rtc", NULL);
+}
+
 static const TypeInfo mc146818rtc_info = {
     .name          = TYPE_MC146818_RTC,
     .parent        = TYPE_ISA_DEVICE,
     .instance_size = sizeof(RTCState),
     .class_init    = rtc_class_initfn,
+    .instance_finalize = rtc_finalize,
 };
 
 static void mc146818rtc_register_types(void)

  parent reply	other threads:[~2014-06-04 17:56 UTC|newest]

Thread overview: 8+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2014-06-04 17:52 [Qemu-devel] [patch 0/3] add QMP command to reset rtc interrupt backlog (v4) mtosatti
2014-06-04 17:52 ` [Qemu-devel] [patch 1/3] mc146818rtc: add rtc-reset-reinjection QMP command mtosatti
2014-06-17 12:32   ` Michael S. Tsirkin
2014-06-17 13:12   ` Eric Blake
2014-06-04 17:52 ` [Qemu-devel] [patch 2/3] add object_property_add_alias mtosatti
2014-06-05 11:09   ` Paolo Bonzini
2014-06-04 17:52 ` mtosatti [this message]
     [not found] <20140530201145.194061806@amt.cnet>
2014-06-02 17:51 ` [Qemu-devel] [patch 0/3] add QMP command to reset rtc interrupt backlog (v3) mtosatti
2014-06-02 17:51   ` [Qemu-devel] [patch 3/3] mc146818rtc: add "rtc" link to "/machine" mtosatti

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=20140604175446.569449721@amt.cnet \
    --to=mtosatti@redhat.com \
    --cc=armbru@redhat.com \
    --cc=gleb@kernel.org \
    --cc=mprivozn@redhat.com \
    --cc=pbonzini@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).