From: Scott Wood <scottwood@freescale.com>
To: Jon Loeliger <jdl@freescale.com>,
Kumar Gala <galak@kernel.crashing.org>,
linuxppc-dev@ozlabs.org, jdl@jdl.com
Subject: Re: dtc: Add support for binary includes.
Date: Thu, 12 Jun 2008 11:43:22 -0500 [thread overview]
Message-ID: <20080612164322.GA2972@loki.buserror.net> (raw)
In-Reply-To: <20080611015839.GB22012@yookeroo.seuss>
On Wed, Jun 11, 2008 at 11:58:39AM +1000, David Gibson wrote:
> Scott's original patch does still have some implementation details I
> didn't like. So in the interests of saving time, I've addressed some
> of those, added a testcase, and and now resubmitting my revised
> version of Scott's patch.
Acked-by: Scott Wood <scottwood@freescale.com>
> -struct data data_copy_file(FILE *f, size_t len)
> +struct data data_copy_file(FILE *f, size_t maxlen)
> {
> - struct data d;
> + struct data d = empty_data;
> +
> + while (!feof(f) && (d.len < maxlen)) {
> + size_t chunksize, ret;
> +
> + if (maxlen == -1)
> + chunksize = 4096;
> + else
> + chunksize = maxlen - d.len;
> +
> + d = data_grow_for(d, chunksize);
> + ret = fread(d.val + d.len, 1, chunksize, f);
> +
> + if (ferror(f))
> + die("Error reading file into data: %s", strerror(errno));
It'd be nice if we could keep the filename around for reporting here...
-Scott
next prev parent reply other threads:[~2008-06-12 16:44 UTC|newest]
Thread overview: 30+ messages / expand[flat|nested] mbox.gz Atom feed top
2008-02-20 19:19 [PATCH] Add support for binary includes Scott Wood
2008-02-22 5:34 ` David Gibson
2008-02-22 18:12 ` Jon Loeliger
2008-02-25 3:38 ` David Gibson
2008-02-22 6:05 ` Grant Likely
2008-02-22 8:34 ` Bartlomiej Sieka
2008-02-22 9:02 ` David Woodhouse
2008-02-22 15:50 ` Grant Likely
2008-02-22 16:08 ` Scott Wood
2008-02-22 16:24 ` Jon Loeliger
2008-02-22 16:28 ` Scott Wood
2008-02-26 0:39 ` David Gibson
2008-02-26 17:26 ` Scott Wood
2008-05-27 15:27 ` Kumar Gala
2008-05-27 17:59 ` Jon Loeliger
2008-05-28 23:58 ` David Gibson
2008-05-29 0:02 ` David Gibson
2008-05-30 18:54 ` Scott Wood
2008-06-04 4:13 ` David Gibson
2008-06-04 12:36 ` Bartlomiej Sieka
2008-06-04 14:26 ` Jon Loeliger
2008-06-05 3:11 ` Josh Boyer
2008-06-11 1:58 ` dtc: " David Gibson
2008-06-12 16:43 ` Scott Wood [this message]
2008-06-13 0:01 ` David Gibson
2008-06-13 0:46 ` Jon Loeliger
2008-06-13 3:41 ` David Gibson
2008-05-29 14:04 ` [PATCH] " Jon Loeliger
2008-05-30 1:34 ` David Gibson
2008-06-02 20:22 ` Jon Loeliger
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=20080612164322.GA2972@loki.buserror.net \
--to=scottwood@freescale.com \
--cc=galak@kernel.crashing.org \
--cc=jdl@freescale.com \
--cc=jdl@jdl.com \
--cc=linuxppc-dev@ozlabs.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 an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.