[PATCH] flashcp: improve speed & some clean ups

Mike Frysinger vapier.adi at gmail.com
Thu Apr 7 11:43:36 EDT 2011


On Thu, Apr 7, 2011 at 11:04, Frans Meulenbroeks wrote:
> the speed of the program is improved by:
> - checking if a block needs to be erased before actually erasing it

doesnt this make an assumption about the values of an unwritten flash
?  iirc, this came up in the past and we opted to not blindly make
that assumption.  probably best to put it behind a new command line
option that the user has to opt into.

> -static void showusage(bool error)
> +static void showusage (const char *progname,bool error)

your style throughout this patch is wrong.  this is lkml style, not
GNU.  for example:
 - no space between func and open paren
 - space after commas
 - braces after if/while/for/etc... need to be cuddled

> @@ -94,15 +87,15 @@ static void showusage(bool error)
>                        "\n"
>                        "Flash Copy - Written by Abraham van der Merwe <abraham at 2d3d.co.za>\n"
>                        "\n"
> -                       "usage: %1$s [ -v | --verbose ] <filename> <device>\n"
> -                       "       %1$s -h | --help\n"
> +                       "usage: %s [ -v | --verbose ] <filename> <device>\n"
> +                       "       %s -h | --help\n"
>                        "\n"
>                        "   -h | --help      Show this help message\n"
>                        "   -v | --verbose   Show progress reports\n"
>                        "   <filename>       File which you want to copy to flash\n"
>                        "   <device>         Flash device to write to (e.g. /dev/mtd0, /dev/mtd1, etc.)\n"
>                        "\n",
> -                       PROGRAM_NAME);
> +                       progname,progname);

ignoring the style issue you introduced, i dont see how your change
from %1$s to %s is correct.  all you had to do was change PROGRAM_NAME
to progname.

i'll hold off on reviewing more until these fundamental issues are fixed.
-mike


More information about the linux-mtd mailing list