diff options
author | David Gibson <david@gibson.dropbear.id.au> | 2015-02-06 14:55:45 +1100 |
---|---|---|
committer | Alexander Graf <agraf@suse.de> | 2015-03-09 14:59:55 +0100 |
commit | 8e099d14f5233f330c4a6f03ff655219cd789c8f (patch) | |
tree | 355f72ea6b80b702f968c72677e36dcfa5bf967c /include | |
parent | b194df478ae7607d93b47a8307e623c9f9f2b3ab (diff) |
Generalize QOM publishing of date and time from mc146818rtc.c
The mc146818rtc driver exposes the current RTC date and time via the "date"
property in QOM (which is also aliased to the machine's "rtc-time"
property). Currently it uses a custom visitor function rtc_get_date to
do this.
This patch introduces new helpers to the QOM core to expose struct tm
valued properties via a getter function, so that this functionality can be
more easily duplicated in other RTC implementations.
Signed-off-by: David Gibson <david@gibson.dropbear.id.au>
Signed-off-by: Alexander Graf <agraf@suse.de>
Diffstat (limited to 'include')
-rw-r--r-- | include/qom/object.h | 14 |
1 files changed, 14 insertions, 0 deletions
diff --git a/include/qom/object.h b/include/qom/object.h index 87575735fe..d2d7748f62 100644 --- a/include/qom/object.h +++ b/include/qom/object.h @@ -1204,6 +1204,20 @@ void object_property_add_bool(Object *obj, const char *name, Error **errp); /** + * object_property_add_tm: + * @obj: the object to add a property to + * @name: the name of the property + * @get: the getter or NULL if the property is write-only. + * @errp: if an error occurs, a pointer to an area to store the error + * + * Add a read-only struct tm valued property using a getter function. + * This function will add a property of type 'struct tm'. + */ +void object_property_add_tm(Object *obj, const char *name, + void (*get)(Object *, struct tm *, Error **), + Error **errp); + +/** * object_property_add_uint8_ptr: * @obj: the object to add a property to * @name: the name of the property |