summary refs log tree commit diff stats
path: root/hw/qdev.h
diff options
context:
space:
mode:
authorPaolo Bonzini <pbonzini@redhat.com>2011-12-18 17:05:09 +0100
committerAnthony Liguori <aliguori@us.ibm.com>2011-12-19 10:27:34 -0600
commit80e555c2418c50e5130fed6245537dfd2ba4bebd (patch)
treea0ba3b68b8b4e241c4669ce5df5e49c7e5b04d5d /hw/qdev.h
parent6aced82c4f304c47d7affb8371edda093b11c81a (diff)
downloadfocaccia-qemu-80e555c2418c50e5130fed6245537dfd2ba4bebd.tar.gz
focaccia-qemu-80e555c2418c50e5130fed6245537dfd2ba4bebd.zip
qom: introduce get/set methods for Property
This patch adds a visitor interface to Property.  This way, QOM will be
able to expose Properties that access a fixed field in a struct without
exposing also the everything-is-a-string "feature" of qdev properties.

Whenever the printed representation in both QOM and qdev (which is
typically the case for device backends), parse/print code can be reused
via get_generic/set_generic.  Dually, whenever multiple PropertyInfos
have the same representation in both the struct and the visitors the
code can be reused (for example among all of int32/uint32/hex32).

Reviewed-by: Anthony Liguori <aliguori@us.ibm.com>
Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>
Signed-off-by: Anthony Liguori <aliguori@us.ibm.com>
Diffstat (limited to 'hw/qdev.h')
-rw-r--r--hw/qdev.h4
1 files changed, 4 insertions, 0 deletions
diff --git a/hw/qdev.h b/hw/qdev.h
index 94f5ce91b4..42495aed04 100644
--- a/hw/qdev.h
+++ b/hw/qdev.h
@@ -158,9 +158,13 @@ struct PropertyInfo {
     const char *name;
     size_t size;
     enum PropertyType type;
+    int64_t min;
+    int64_t max;
     int (*parse)(DeviceState *dev, Property *prop, const char *str);
     int (*print)(DeviceState *dev, Property *prop, char *dest, size_t len);
     void (*free)(DeviceState *dev, Property *prop);
+    DevicePropertyAccessor *get;
+    DevicePropertyAccessor *set;
 };
 
 typedef struct GlobalProperty {