From: "Jörn Engel" <joern@logfs.org>
To: Tobias Simon <tobias.simon@sp-ss.de>
Cc: joern@logfs.org, linux-mtd@lists.infradead.org
Subject: Re: flashcp
Date: Fri, 20 Jul 2007 02:28:21 +0200 [thread overview]
Message-ID: <20070720002820.GA28538@lazybastard.org> (raw)
In-Reply-To: <200707200123.46618.tobias.simon@sp-ss.de>
On Fri, 20 July 2007 01:23:46 +0200, Tobias Simon wrote:
>
> I just saw the following line, which is part of the original source:
> "if (filestat.st_size % mtd.erasesize) erase.length += mtd.erasesize;"
>
> ... or left there in conjunction with your "rounding down" code:
>
>
> --- flashcp_old.c 2007-07-20 01:15:28.000000000 +0200
> +++ flashcp_b.c 2007-07-20 01:14:02.000000000 +0200
> @@ -257,9 +257,12 @@
> #warning "Check for smaller erase regions"
>
> erase.start = 0;
> - erase.length = filestat.st_size & ~(mtd.erasesize - 1);
> - if (filestat.st_size % mtd.erasesize) erase.length += mtd.erasesize;
> - if (flags & FLAG_VERBOSE)
> +
> + erase.length = (filestat.st_size / mtd.erasesize) * mtd.erasesize;
> + if (filestat.st_size % mtd.erasesize)
> + erase.length += mtd.erasesize;
> +
> + if (flags & FLAG_VERBOSE)
> {
> /* if the user wants verbose output, erase 1 block at a time
> and show him/her what's going on */
> int blocks = erase.length / mtd.erasesize;
Maybe something like this:
#define ODD_ALIGN(n, align) ((((n) + (align) - 1) / (align)) * (align))
...
erase.length = ODD_ALIGN(filestat.st_size, mtd.erasesize);
But I should really disengage now. I don't even know what flashcp is
supposed to do.
Jörn
--
Data expands to fill the space available for storage.
-- Parkinson's Law
prev parent reply other threads:[~2007-07-20 0:31 UTC|newest]
Thread overview: 7+ messages / expand[flat|nested] mbox.gz Atom feed top
2007-07-19 18:46 flashcp Tobias Simon
2007-07-19 19:56 ` flashcp Jörn Engel
2007-07-19 21:08 ` flashcp Tobias Simon
2007-07-19 22:13 ` flashcp Jörn Engel
2007-07-19 22:55 ` flashcp Tobias Simon
2007-07-19 23:23 ` flashcp Tobias Simon
2007-07-20 0:28 ` Jörn Engel [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=20070720002820.GA28538@lazybastard.org \
--to=joern@logfs.org \
--cc=linux-mtd@lists.infradead.org \
--cc=tobias.simon@sp-ss.de \
/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