qemu-devel.nongnu.org archive mirror
 help / color / mirror / Atom feed
From: Aurelien Jarno <aurelien@aurel32.net>
To: Alexander Graf <agraf@suse.de>
Cc: Peter Maydell <peter.maydell@linaro.org>,
	qemu-ppc Mailing List <qemu-ppc@nongnu.org>,
	qemu-devel qemu-devel <qemu-devel@nongnu.org>
Subject: Re: [Qemu-devel] [PATCH] device tree: simplify dumpdtb code
Date: Mon, 1 Oct 2012 21:15:08 +0200	[thread overview]
Message-ID: <20121001191508.GF4623@ohm.aurel32.net> (raw)
In-Reply-To: <1348435772-26553-1-git-send-email-agraf@suse.de>

On Sun, Sep 23, 2012 at 11:29:32PM +0200, Alexander Graf wrote:
> As per Peter's suggestion, we can use glib to write out a buffer in whole to
> a file, simplifying the code dramatically.
> 
> Signed-off-by: Alexander Graf <agraf@suse.de>
> 
> ---
> 
> This patch applies on top of the generic dumpdtb remodeling patch.
> 
> ---
>  device_tree.c |    9 +--------
>  1 files changed, 1 insertions(+), 8 deletions(-)
> 
> diff --git a/device_tree.c b/device_tree.c
> index 69ca953..a923613 100644
> --- a/device_tree.c
> +++ b/device_tree.c
> @@ -314,14 +314,7 @@ void qemu_devtree_dumpdtb(void *fdt, int size)
>          const char *dumpdtb = qemu_opt_get(machine_opts, "dumpdtb");
>          if (dumpdtb) {
>              /* Dump the dtb to a file and quit */
> -            FILE *f = fopen(dumpdtb, "wb");
> -            size_t len;
> -            len = fwrite(fdt, size, 1, f);
> -            fclose(f);
> -            if (len != size) {
> -                exit(1);
> -            }
> -            exit(0);
> +            exit(g_file_set_contents(dumpdtb, fdt, size, NULL) ? 0 : 1);
>          }
>      }
>  

Reviewed-by: Aurelien Jarno <aurelien@aurel32.net>


-- 
Aurelien Jarno                          GPG: 1024D/F1BCDB73
aurelien@aurel32.net                 http://www.aurel32.net

      reply	other threads:[~2012-10-01 19:15 UTC|newest]

Thread overview: 2+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2012-09-23 21:29 [Qemu-devel] [PATCH] device tree: simplify dumpdtb code Alexander Graf
2012-10-01 19:15 ` Aurelien Jarno [this message]

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=20121001191508.GF4623@ohm.aurel32.net \
    --to=aurelien@aurel32.net \
    --cc=agraf@suse.de \
    --cc=peter.maydell@linaro.org \
    --cc=qemu-devel@nongnu.org \
    --cc=qemu-ppc@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).