[Top][All Lists]
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: [Qemu-devel] [PATCH 6/6] chardev: convert file backend to realize
From: |
Paolo Bonzini |
Subject: |
Re: [Qemu-devel] [PATCH 6/6] chardev: convert file backend to realize |
Date: |
Tue, 16 Oct 2012 17:52:04 +0200 |
User-agent: |
Mozilla/5.0 (X11; Linux x86_64; rv:16.0) Gecko/20121009 Thunderbird/16.0 |
Il 15/10/2012 21:34, Anthony Liguori ha scritto:
> +static char *chardev_file_get_path(Object *obj, Error **errp)
> +{
> + CharDriverState *chr = CHARDEV(obj);
> + FDCharDriver *s = chr->opaque;
> +
> + return s->path ? g_strdup(s->path) : g_strdup("");
> +}
> +
> +static void chardev_file_set_path(Object *obj, const char *value, Error
> **errp)
> +{
> + CharDriverState *chr = CHARDEV(obj);
> + FDCharDriver *s = chr->opaque;
> +
> + if (chr->realized) {
> + error_set(errp, QERR_PERMISSION_DENIED);
> + return;
> + }
> +
> + if (s->path) {
> + g_free(s->path);
> + }
> +
> + s->path = g_strdup(value);
> +}
> +
> +static void chardev_file_initfn(Object *obj)
> +{
> + CharDriverState *chr = CHARDEV(obj);
> +
> + object_property_add_str(obj, "path", chardev_file_get_path,
> chardev_file_set_path, NULL);
> +#ifndef _WIN32
> + chr->opaque = CHARDEV_FILE(obj);
> +#endif
> +}
> +
IMHO this really really calls for pushing static properties and realized
up to Object...
Paolo
- [Qemu-devel] [RFC PATCH 0/6] chardev: convert to QOM, Anthony Liguori, 2012/10/15
- [Qemu-devel] [PATCH 1/6] object: add object_property_add_bool, Anthony Liguori, 2012/10/15
- [Qemu-devel] [PATCH 5/6] chardev: switch the easy backends to realize, Anthony Liguori, 2012/10/15
- [Qemu-devel] [PATCH 3/6] chardev: create new QOM types for each sub chardev type, Anthony Liguori, 2012/10/15
- [Qemu-devel] [PATCH 6/6] chardev: convert file backend to realize, Anthony Liguori, 2012/10/15
- Re: [Qemu-devel] [PATCH 6/6] chardev: convert file backend to realize,
Paolo Bonzini <=
- [Qemu-devel] [PATCH 2/6] chardev: convert to QOM (shallow pass), Anthony Liguori, 2012/10/15
- [Qemu-devel] [PATCH 4/6] chardev: implement realize, Anthony Liguori, 2012/10/15
- Re: [Qemu-devel] [RFC PATCH 0/6] chardev: convert to QOM, Gerd Hoffmann, 2012/10/17