* [PATCH] flash_erase: start position should be in bytes
@ 2011-03-18 10:21 Peter Korsgaard
2011-03-18 10:28 ` Artem Bityutskiy
2011-03-18 11:06 ` Artem Bityutskiy
0 siblings, 2 replies; 4+ messages in thread
From: Peter Korsgaard @ 2011-03-18 10:21 UTC (permalink / raw)
To: vapier, dedekind1, linux-mtd
Commit a8801d8 (unify flash_erase and flash_eraseall) changed the
flash_erase interface in a backwards incompatible way. Before that
commit start position was given in bytes, and now it must be provided
in blocks.
While I agree the new interface is nicer, we shouldn't break the
interface. I have scripts that expect the old behaviour, and I'm
most likely not alone, so change the interface back to the old
way.
Signed-off-by: Peter Korsgaard <jacmet@sunsite.dk>
---
flash_erase.c | 7 +++++--
1 files changed, 5 insertions(+), 2 deletions(-)
diff --git a/flash_erase.c b/flash_erase.c
index 1a7b52e..3ce701b 100644
--- a/flash_erase.c
+++ b/flash_erase.c
@@ -60,7 +60,7 @@ static void show_progress(struct mtd_dev_info *mtd, uint64_t start, int eb,
static void display_help (void)
{
- printf("Usage: %s [options] MTD_DEVICE <start block> <block count>\n"
+ printf("Usage: %s [options] MTD_DEVICE <start offset> <block count>\n"
"Erase blocks of the specified MTD device.\n"
"Specify a count of 0 to erase to end of device.\n"
"\n"
@@ -94,6 +94,7 @@ int main(int argc, char *argv[])
libmtd_t mtd_desc;
struct mtd_dev_info mtd;
int fd, clmpos = 0, clmlen = 8;
+ unsigned long long start;
unsigned int eb, eb_start, eb_cnt;
int isNAND;
int error = 0;
@@ -153,7 +154,7 @@ int main(int argc, char *argv[])
switch (argc - optind) {
case 3:
mtd_device = argv[optind];
- eb_start = simple_strtoul(argv[optind + 1], &error);
+ start = simple_strtoull(argv[optind + 1], &error);
eb_cnt = simple_strtoul(argv[optind + 2], &error);
break;
default:
@@ -182,6 +183,8 @@ int main(int argc, char *argv[])
if (mtd_get_dev_info(mtd_desc, mtd_device, &mtd) < 0)
return errmsg("mtd_get_dev_info failed");
+ eb_start = start / mtd.eb_size;
+
isNAND = mtd.type == MTD_NANDFLASH ? 1 : 0;
if (jffs2) {
--
1.7.2.3
^ permalink raw reply related [flat|nested] 4+ messages in thread
* Re: [PATCH] flash_erase: start position should be in bytes
2011-03-18 10:21 [PATCH] flash_erase: start position should be in bytes Peter Korsgaard
@ 2011-03-18 10:28 ` Artem Bityutskiy
2011-03-18 10:42 ` Peter Korsgaard
2011-03-18 11:06 ` Artem Bityutskiy
1 sibling, 1 reply; 4+ messages in thread
From: Artem Bityutskiy @ 2011-03-18 10:28 UTC (permalink / raw)
To: Peter Korsgaard; +Cc: linux-mtd, vapier
On Fri, 2011-03-18 at 11:21 +0100, Peter Korsgaard wrote:
> Commit a8801d8 (unify flash_erase and flash_eraseall) changed the
> flash_erase interface in a backwards incompatible way. Before that
> commit start position was given in bytes, and now it must be provided
> in blocks.
>
> While I agree the new interface is nicer, we shouldn't break the
> interface. I have scripts that expect the old behaviour, and I'm
> most likely not alone, so change the interface back to the old
> way.
>
> Signed-off-by: Peter Korsgaard <jacmet@sunsite.dk>
I guess this means we need to make a new maintenance with this patch...
--
Best Regards,
Artem Bityutskiy (Артём Битюцкий)
^ permalink raw reply [flat|nested] 4+ messages in thread
* Re: [PATCH] flash_erase: start position should be in bytes
2011-03-18 10:28 ` Artem Bityutskiy
@ 2011-03-18 10:42 ` Peter Korsgaard
0 siblings, 0 replies; 4+ messages in thread
From: Peter Korsgaard @ 2011-03-18 10:42 UTC (permalink / raw)
To: dedekind1; +Cc: linux-mtd, vapier
>>>>> "Artem" == Artem Bityutskiy <dedekind1@gmail.com> writes:
Hi,
Artem> I guess this means we need to make a new maintenance with this
Artem> patch...
Yes, a 1.4.3 would be good - Thanks.
So just to be clear: That patch got added between 1.4.1 and 1.4.2.
--
Bye, Peter Korsgaard
^ permalink raw reply [flat|nested] 4+ messages in thread
* Re: [PATCH] flash_erase: start position should be in bytes
2011-03-18 10:21 [PATCH] flash_erase: start position should be in bytes Peter Korsgaard
2011-03-18 10:28 ` Artem Bityutskiy
@ 2011-03-18 11:06 ` Artem Bityutskiy
1 sibling, 0 replies; 4+ messages in thread
From: Artem Bityutskiy @ 2011-03-18 11:06 UTC (permalink / raw)
To: Peter Korsgaard; +Cc: linux-mtd, vapier
On Fri, 2011-03-18 at 11:21 +0100, Peter Korsgaard wrote:
> Commit a8801d8 (unify flash_erase and flash_eraseall) changed the
> flash_erase interface in a backwards incompatible way. Before that
> commit start position was given in bytes, and now it must be provided
> in blocks.
>
> While I agree the new interface is nicer, we shouldn't break the
> interface. I have scripts that expect the old behaviour, and I'm
> most likely not alone, so change the interface back to the old
> way.
>
> Signed-off-by: Peter Korsgaard <jacmet@sunsite.dk>
Pushed, thanks. Also tagged release 1.4.3, updated the mtd web-site and
uploaded the tarball.
--
Best Regards,
Artem Bityutskiy (Артём Битюцкий)
^ permalink raw reply [flat|nested] 4+ messages in thread
end of thread, other threads:[~2011-03-18 11:08 UTC | newest]
Thread overview: 4+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2011-03-18 10:21 [PATCH] flash_erase: start position should be in bytes Peter Korsgaard
2011-03-18 10:28 ` Artem Bityutskiy
2011-03-18 10:42 ` Peter Korsgaard
2011-03-18 11:06 ` Artem Bityutskiy
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).