nanddump: warn when the start address is not page aligned

Submitted by Baruch Siach on Oct. 18, 2010, 7:23 a.m.

Details

Message ID 1909cbad57553279212f156a0c7cb20178981909.1287386497.git.baruch@tkos.co.il
State New, archived
Headers show

Commit Message

Baruch Siach Oct. 18, 2010, 7:23 a.m.
nanddump should be consistent with nandwrite, which does not accept non page
aligned start addresses. Thus, non page aligned dumps are useless.

To ease migration only warn for now. Add the plan of making this an error to
feature-removal-schedule.txt.

Signed-off-by: Baruch Siach <baruch@tkos.co.il>
---
 feature-removal-schedule.txt |   12 +++++++++++-
 nanddump.c                   |    7 +++++++
 2 files changed, 18 insertions(+), 1 deletions(-)

Comments

Artem Bityutskiy Oct. 18, 2010, 10:31 a.m.
On Mon, 2010-10-18 at 09:23 +0200, Baruch Siach wrote:
> nanddump should be consistent with nandwrite, which does not accept non page
> aligned start addresses. Thus, non page aligned dumps are useless.
> 
> To ease migration only warn for now. Add the plan of making this an error to
> feature-removal-schedule.txt.
> 
> Signed-off-by: Baruch Siach <baruch@tkos.co.il>
> ---
>  feature-removal-schedule.txt |   12 +++++++++++-
>  nanddump.c                   |    7 +++++++
>  2 files changed, 18 insertions(+), 1 deletions(-)
> 
> diff --git a/feature-removal-schedule.txt b/feature-removal-schedule.txt
> index 21bc8d4..f4ed2a3 100644
> --- a/feature-removal-schedule.txt
> +++ b/feature-removal-schedule.txt
> @@ -27,5 +27,15 @@ So the plan is (to be done by Artem Bityutskiy):
>  3.1 adding a warning to make users stop using them
>  3.2 removing both options.
>  ---------------------------
> -2.
> +2. nanddump: fail when the -s parameter is not page aligned
> +
> +nanddump should be consistent with nandwrite, and refuse accepting non page 
> +aligned start addresses. These dumps are most likely useless, since nandwrite 
> +won't write then at this location. Currently only a warning is issued to keep 
> +backward compatibility during a transition period. This should become an error 
> +after 1.5.0.

I tweaked this and removed 1.5.0 - it is better to not specify exact
version. Also, fixed the following trailing white-spaces issue for the
feature-removal-schedule.txt part:

Applying: nanddump: warn when the start address is not page aligned
/home/dedekind/git/mtd-utils/.git/rebase-apply/patch:17: trailing whitespace.
nanddump should be consistent with nandwrite, and refuse accepting non page 
/home/dedekind/git/mtd-utils/.git/rebase-apply/patch:18: trailing whitespace.
aligned start addresses. These dumps are most likely useless, since nandwrite 
/home/dedekind/git/mtd-utils/.git/rebase-apply/patch:19: trailing whitespace.
won't write then at this location. Currently only a warning is issued to keep 
/home/dedekind/git/mtd-utils/.git/rebase-apply/patch:20: trailing whitespace.
backward compatibility during a transition period. This should become an error 
warning: 4 lines add whitespace errors.

And pushed, thanks.

Patch hide | download patch | download mbox

diff --git a/feature-removal-schedule.txt b/feature-removal-schedule.txt
index 21bc8d4..f4ed2a3 100644
--- a/feature-removal-schedule.txt
+++ b/feature-removal-schedule.txt
@@ -27,5 +27,15 @@  So the plan is (to be done by Artem Bityutskiy):
 3.1 adding a warning to make users stop using them
 3.2 removing both options.
 ---------------------------
-2.
+2. nanddump: fail when the -s parameter is not page aligned
+
+nanddump should be consistent with nandwrite, and refuse accepting non page 
+aligned start addresses. These dumps are most likely useless, since nandwrite 
+won't write then at this location. Currently only a warning is issued to keep 
+backward compatibility during a transition period. This should become an error 
+after 1.5.0.
+
+To be done by Artem Bityutskiy.
+---------------------------
+3.
 ---------------------------
diff --git a/nanddump.c b/nanddump.c
index 15bf9c4..bb649da 100644
--- a/nanddump.c
+++ b/nanddump.c
@@ -360,6 +360,13 @@  int main(int argc, char * const argv[])
 	}
 
 	/* Initialize start/end addresses and block size */
+	if (start_addr & (meminfo.writesize - 1)) {
+		fprintf(stderr, "WARNING: The start address is not page-aligned !\n"
+				"The pagesize of this NAND Flash is 0x%x.\n"
+				"nandwrite doesn't allow writes starting at this location.\n"
+				"Future versions of nanddump will fail here.\n",
+				meminfo.writesize);
+	}
 	if (length)
 		end_addr = start_addr + length;
 	if (!length || end_addr > meminfo.size)