From: Mike Frysinger <vapier@gentoo.org>
To: "Frank Ch. Eigler" <fche@redhat.com>
Cc: gdb-patches@sourceware.org, toolchain-devel@blackfin.uclinux.org
Subject: Re: [PATCH v3] sim: cfi: new flash device simulation
Date: Fri, 25 Mar 2011 19:32:00 -0000 [thread overview]
Message-ID: <AANLkTi=FZ9TkZpRkWS2QQeQNBnEOCo-phavnaRx-79f1@mail.gmail.com> (raw)
On Fri, Mar 25, 2011 at 11:15 AM, Frank Ch. Eigler wrote:
> vapier wrote:
>> +/* Clean up any state when this device is removed (e.g. when shutting down,
>> + or when reloading via gdb). */
>> +static void
>> +cfi_delete_callback (struct hw *me)
>> +{
>> +#ifdef HAVE_MMAP
>> + struct cfi *cfi = hw_data (me);
>> +
>> + if (cfi->mmap)
>> + munmap (cfi->mmap, cfi->dev_size);
>> +#endif
>> +}
>
> Woudln't you want to write(2) out the contents of the flash backing
> store file, if !HAVE_MMAP?
perhaps, but that'd require quite a bit more logic that just a single
call to write() here. frankly, i dont care about the systems that
dont support mmap as required by POSIX. the ifdef's are only to keep
from breaking their builds.
if someone who actually cares about those systems wants to implement
that, then by all means.
>> +static void
>> +attach_cfi_regs (struct hw *me, struct cfi *cfi)
>> +[...]
>> + cfi->data = HW_NALLOC (me, unsigned char, cfi->dev_size);
>> + if (fd != -1)
>> + read_len = read (fd, cfi->data, cfi->dev_size);
>
> It's more typical to loop in read(2), in case of an EINTR or somesuch
> temporary-failure return code. Or use fread(3)?
i didnt bother with the EINTR case as i thought it overkill. i did at
least make sure that the code would (for the most part) continue to
work in the case of a short read.
i wasnt aware that fread() would handle this for me though. i dont
mind using that since it'd still be one fread() call.
-mike
next reply other threads:[~2011-03-25 19:19 UTC|newest]
Thread overview: 5+ messages / expand[flat|nested] mbox.gz Atom feed top
2011-03-25 19:32 Mike Frysinger [this message]
2011-03-25 21:07 ` Frank Ch. Eigler
2011-03-25 21:23 ` Mike Frysinger
-- strict thread matches above, loose matches on Subject: below --
2010-12-31 6:33 [PATCH] " Mike Frysinger
2011-03-25 9:49 ` [PATCH v3] " Mike Frysinger
2011-03-25 15:55 ` Joel Brobecker
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='AANLkTi=FZ9TkZpRkWS2QQeQNBnEOCo-phavnaRx-79f1@mail.gmail.com' \
--to=vapier@gentoo.org \
--cc=fche@redhat.com \
--cc=gdb-patches@sourceware.org \
--cc=toolchain-devel@blackfin.uclinux.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