diff options
author | Paolo Bonzini <pbonzini@redhat.com> | 2012-02-02 13:08:48 +0100 |
---|---|---|
committer | Paolo Bonzini <pbonzini@redhat.com> | 2012-02-07 13:52:42 +0100 |
commit | dd0ba250ca83ed915ea192ab7539cdbb4e868c14 (patch) | |
tree | 6d127f77c7b78b10b9f1e6604ad44428df8f0514 /hw/qdev-properties.c | |
parent | 7b009e5d09ee7786a4fd848327b6a8d8d7c01f0d (diff) | |
download | hqemu-dd0ba250ca83ed915ea192ab7539cdbb4e868c14.zip hqemu-dd0ba250ca83ed915ea192ab7539cdbb4e868c14.tar.gz |
qdev: let QOM free properties
Drop the special free callback. Instead, register a "regular"
release method in the non-legacy property.
Reviewed-by: Anthony Liguori <aliguori@us.ibm.com>
Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>
Diffstat (limited to 'hw/qdev-properties.c')
-rw-r--r-- | hw/qdev-properties.c | 19 |
1 files changed, 12 insertions, 7 deletions
diff --git a/hw/qdev-properties.c b/hw/qdev-properties.c index 67995a3..d69a987 100644 --- a/hw/qdev-properties.c +++ b/hw/qdev-properties.c @@ -510,9 +510,10 @@ PropertyInfo qdev_prop_hex64 = { /* --- string --- */ -static void free_string(DeviceState *dev, Property *prop) +static void release_string(Object *obj, const char *name, void *opaque) { - g_free(*(char **)qdev_get_prop_ptr(dev, prop)); + Property *prop = opaque; + g_free(*(char **)qdev_get_prop_ptr(DEVICE(obj), prop)); } static int print_string(DeviceState *dev, Property *prop, char *dest, size_t len) @@ -572,7 +573,7 @@ PropertyInfo qdev_prop_string = { .type = PROP_TYPE_STRING, .size = sizeof(char*), .print = print_string, - .free = free_string, + .release = release_string, .get = get_string, .set = set_string, }; @@ -592,8 +593,10 @@ static int parse_drive(DeviceState *dev, const char *str, void **ptr) return 0; } -static void free_drive(DeviceState *dev, Property *prop) +static void release_drive(Object *obj, const char *name, void *opaque) { + DeviceState *dev = DEVICE(obj); + Property *prop = opaque; BlockDriverState **ptr = qdev_get_prop_ptr(dev, prop); if (*ptr) { @@ -667,7 +670,7 @@ PropertyInfo qdev_prop_drive = { .size = sizeof(BlockDriverState *), .get = get_drive, .set = set_drive, - .free = free_drive, + .release = release_drive, }; /* --- character device --- */ @@ -686,8 +689,10 @@ static int parse_chr(DeviceState *dev, const char *str, void **ptr) return 0; } -static void free_chr(DeviceState *dev, Property *prop) +static void release_chr(Object *obj, const char *name, void *opaque) { + DeviceState *dev = DEVICE(obj); + Property *prop = opaque; CharDriverState **ptr = qdev_get_prop_ptr(dev, prop); if (*ptr) { @@ -721,7 +726,7 @@ PropertyInfo qdev_prop_chr = { .size = sizeof(CharDriverState*), .get = get_chr, .set = set_chr, - .free = free_chr, + .release = release_chr, }; /* --- netdev device --- */ |