mail archive of the barebox mailing list
 help / color / mirror / Atom feed
From: Sascha Hauer <s.hauer@pengutronix.de>
To: Jean-Christophe PLAGNIOL-VILLARD <plagnioj@jcrosoft.com>
Cc: barebox@lists.infradead.org
Subject: Re: [PATCH 1/1] command: crc: add -V option to check the crc store in a file
Date: Wed, 18 Sep 2013 09:30:07 +0200	[thread overview]
Message-ID: <20130918073007.GO30088@pengutronix.de> (raw)
In-Reply-To: <1379404733-7071-1-git-send-email-plagnioj@jcrosoft.com>

On Tue, Sep 17, 2013 at 09:58:53AM +0200, Jean-Christophe PLAGNIOL-VILLARD wrote:
> the format is %08x
> 
> Signed-off-by: Jean-Christophe PLAGNIOL-VILLARD <plagnioj@jcrosoft.com>
> ---
>  commands/crc.c | 20 +++++++++++++++++++-
>  1 file changed, 19 insertions(+), 1 deletion(-)
> 
> diff --git a/commands/crc.c b/commands/crc.c
> index a0071b0..b7416e1 100644
> --- a/commands/crc.c
> +++ b/commands/crc.c
> @@ -82,6 +82,19 @@ out:
>  	return ret;
>  }
>  
> +static int crc_from_file(const char* file, ulong *crc)
> +{
> +	char * buf;
> +
> +	buf= read_file(file, NULL);
> +
> +	if (!buf)
> +		return -ENOMEM;
> +
> +	*crc = simple_strtoul(buf, NULL, 16);
> +	return 0;
> +}
> +
>  static int do_crc(int argc, char *argv[])
>  {
>  	loff_t start = 0, size = ~0;
> @@ -92,7 +105,7 @@ static int do_crc(int argc, char *argv[])
>  #endif
>  	int opt, err = 0, filegiven = 0, verify = 0;
>  
> -	while((opt = getopt(argc, argv, "f:F:v:")) > 0) {
> +	while((opt = getopt(argc, argv, "f:F:v:V:")) > 0) {
>  		switch(opt) {
>  		case 'f':
>  			filename = optarg;
> @@ -108,6 +121,10 @@ static int do_crc(int argc, char *argv[])
>  			verify = 1;
>  			vcrc = simple_strtoul(optarg, NULL, 0);
>  			break;
> +		case 'V':
> +			if (!crc_from_file(optarg, &vcrc))
> +				verify = 1;
> +			break;
>  		default:
>  			return COMMAND_ERROR_USAGE;
>  		}
> @@ -153,6 +170,7 @@ BAREBOX_CMD_HELP_OPT  ("-f <file>", "Use file instead of memory.\n")
>  BAREBOX_CMD_HELP_OPT  ("-F <file>", "Use file to compare.\n")
>  #endif
>  BAREBOX_CMD_HELP_OPT  ("-v <crc>",  "Verify\n")
> +BAREBOX_CMD_HELP_OPT  ("-V <file>", "Verify\n")

Please increase verbosity a bit, like "Verify with crc read from <file>".

Sascha

-- 
Pengutronix e.K.                           |                             |
Industrial Linux Solutions                 | http://www.pengutronix.de/  |
Peiner Str. 6-8, 31137 Hildesheim, Germany | Phone: +49-5121-206917-0    |
Amtsgericht Hildesheim, HRA 2686           | Fax:   +49-5121-206917-5555 |

_______________________________________________
barebox mailing list
barebox@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/barebox

      reply	other threads:[~2013-09-18  7:30 UTC|newest]

Thread overview: 2+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2013-09-17  7:58 Jean-Christophe PLAGNIOL-VILLARD
2013-09-18  7:30 ` Sascha Hauer [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=20130918073007.GO30088@pengutronix.de \
    --to=s.hauer@pengutronix.de \
    --cc=barebox@lists.infradead.org \
    --cc=plagnioj@jcrosoft.com \
    /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