qemu-devel.nongnu.org archive mirror
 help / color / mirror / Atom feed
From: Paolo Bonzini <pbonzini@redhat.com>
To: Anthony Liguori <aliguori@us.ibm.com>
Cc: qemu-devel@nongnu.org, Andreas Faerber <afaerber@suse.de>,
	Gerd Hoffmann <kraxel@redhat.com>
Subject: Re: [Qemu-devel] [PATCH 6/6] chardev: convert file backend to realize
Date: Tue, 16 Oct 2012 17:52:04 +0200	[thread overview]
Message-ID: <507D82A4.1030203@redhat.com> (raw)
In-Reply-To: <1350329657-18665-7-git-send-email-aliguori@us.ibm.com>

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

  reply	other threads:[~2012-10-16 15:52 UTC|newest]

Thread overview: 13+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2012-10-15 19:34 [Qemu-devel] [RFC PATCH 0/6] chardev: convert to QOM Anthony Liguori
2012-10-15 19:34 ` [Qemu-devel] [PATCH 1/6] object: add object_property_add_bool Anthony Liguori
2012-10-16 15:44   ` Andreas Färber
2012-10-23 11:30   ` Markus Armbruster
2012-10-15 19:34 ` [Qemu-devel] [PATCH 2/6] chardev: convert to QOM (shallow pass) Anthony Liguori
2012-10-15 19:34 ` [Qemu-devel] [PATCH 3/6] chardev: create new QOM types for each sub chardev type Anthony Liguori
2012-10-15 19:34 ` [Qemu-devel] [PATCH 4/6] chardev: implement realize Anthony Liguori
2012-10-15 19:34 ` [Qemu-devel] [PATCH 5/6] chardev: switch the easy backends to realize Anthony Liguori
2012-10-15 19:34 ` [Qemu-devel] [PATCH 6/6] chardev: convert file backend " Anthony Liguori
2012-10-16 15:52   ` Paolo Bonzini [this message]
2012-10-16 19:44     ` Anthony Liguori
2012-10-17  8:07 ` [Qemu-devel] [RFC PATCH 0/6] chardev: convert to QOM Gerd Hoffmann
2012-10-17 14:44   ` Anthony Liguori

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=507D82A4.1030203@redhat.com \
    --to=pbonzini@redhat.com \
    --cc=afaerber@suse.de \
    --cc=aliguori@us.ibm.com \
    --cc=kraxel@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).