From patchwork Fri Mar 18 11:42:40 2011 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Artem Bityutskiy X-Patchwork-Id: 87516 Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@bilbo.ozlabs.org Received: from bombadil.infradead.org (bombadil.infradead.org [18.85.46.34]) (using TLSv1 with cipher DHE-RSA-AES256-SHA (256/256 bits)) (Client did not present a certificate) by ozlabs.org (Postfix) with ESMTPS id E3D01B6FE1 for ; Fri, 18 Mar 2011 22:41:23 +1100 (EST) Received: from canuck.infradead.org ([2001:4978:20e::1]) by bombadil.infradead.org with esmtps (Exim 4.72 #1 (Red Hat Linux)) id 1Q0Y2B-0004WW-Pl; Fri, 18 Mar 2011 11:40:00 +0000 Received: from localhost ([127.0.0.1] helo=canuck.infradead.org) by canuck.infradead.org with esmtp (Exim 4.72 #1 (Red Hat Linux)) id 1Q0Y28-0006rW-Df; Fri, 18 Mar 2011 11:39:56 +0000 Received: from smtp.nokia.com ([147.243.1.48] helo=mgw-sa02.nokia.com) by canuck.infradead.org with esmtps (Exim 4.72 #1 (Red Hat Linux)) id 1Q0Y1z-0006qT-QL for linux-mtd@lists.infradead.org; Fri, 18 Mar 2011 11:39:48 +0000 Received: from eru.research.nokia.com (esdhcp03787.research.nokia.com [172.21.37.87]) by mgw-sa02.nokia.com (Switch-3.4.3/Switch-3.4.3) with ESMTP id p2IBdjmR026183 for ; Fri, 18 Mar 2011 13:39:45 +0200 From: Artem Bityutskiy To: MTD list Subject: [PATCH 2/2] nanddump: fail if -s parameter is unaligned Date: Fri, 18 Mar 2011 13:42:40 +0200 Message-Id: <1300448560-4166-3-git-send-email-dedekind1@gmail.com> X-Mailer: git-send-email 1.7.2.3 In-Reply-To: <1300448560-4166-1-git-send-email-dedekind1@gmail.com> References: <1300448560-4166-1-git-send-email-dedekind1@gmail.com> X-Nokia-AV: Clean X-CRM114-Version: 20090807-BlameThorstenAndJenny ( TRE 0.7.6 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20110318_073948_175745_9D4570C5 X-CRM114-Status: GOOD ( 11.34 ) X-Spam-Score: 3.4 (+++) X-Spam-Report: SpamAssassin version 3.3.1 on canuck.infradead.org summary: Content analysis details: (3.4 points) pts rule name description ---- ---------------------- -------------------------------------------------- -0.0 RCVD_IN_DNSWL_NONE RBL: Sender listed at http://www.dnswl.org/, low trust [147.243.1.48 listed in list.dnswl.org] 0.0 FREEMAIL_FROM Sender email is freemail (dedekind1[at]gmail.com) 0.0 DKIM_ADSP_CUSTOM_MED No valid author signature, adsp_override is CUSTOM_MED 2.2 FREEMAIL_ENVFROM_END_DIGIT Envelope-from freemail username ends in digit (dedekind1[at]gmail.com) 1.2 NML_ADSP_CUSTOM_MED ADSP custom_med hit, and not from a mailing list X-BeenThere: linux-mtd@lists.infradead.org X-Mailman-Version: 2.1.12 Precedence: list List-Id: Linux MTD discussion mailing list List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , MIME-Version: 1.0 Sender: linux-mtd-bounces@lists.infradead.org Errors-To: linux-mtd-bounces+incoming=patchwork.ozlabs.org@lists.infradead.org From: Artem Bityutskiy Implement the feature which we planned long time ago - make nanddump fail if the -s parameter is not NAND page-aligned. Also bump nanddump version. Signed-off-by: Artem Bityutskiy --- feature-removal-schedule.txt | 12 +----------- nanddump.c | 9 ++++----- 2 files changed, 5 insertions(+), 16 deletions(-) diff --git a/feature-removal-schedule.txt b/feature-removal-schedule.txt index 2899e34..30f0403 100644 --- a/feature-removal-schedule.txt +++ b/feature-removal-schedule.txt @@ -26,15 +26,5 @@ to stop using them. The further step is to remove both of them. --------------------------- -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 -one release after the next release (current is mtd-utils-1.4.0, 18 Sep 2010). - -To be done by Artem Bityutskiy. ---------------------------- -3. +2. --------------------------- diff --git a/nanddump.c b/nanddump.c index 1dbb247..214fb12 100644 --- a/nanddump.c +++ b/nanddump.c @@ -14,7 +14,7 @@ */ #define PROGRAM_NAME "nanddump" -#define VERSION "$Revision: 1.29 $" +#define VERSION "1.30" #define _GNU_SOURCE #include @@ -366,11 +366,10 @@ int main(int argc, char * const argv[]) /* Initialize start/end addresses and block size */ if (start_addr & (mtd.min_io_size - 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", + fprintf(stderr, "the start address (-s parameter) is not page-aligned!\n" + "The pagesize of this NAND Flash is 0x%x.\n", mtd.min_io_size); + goto closeall; } if (length) end_addr = start_addr + length;