linux-mtd.lists.infradead.org archive mirror
 help / color / mirror / Atom feed
From: Jehan Bing <jehan@orb.com>
To: linux-mtd@lists.infradead.org
Subject: Re: [PATCH 1/3] [MTD-UTILS] Unified reading from standard input and from file
Date: Wed, 10 Jun 2009 10:11:03 -0700	[thread overview]
Message-ID: <4A2FE927.3020309@orb.com> (raw)
In-Reply-To: <1244649814.5847.404.camel@localhost.localdomain>

Artem Bityutskiy wrote:
> On Tue, 2009-06-09 at 16:04 -0700, Jehan Bing wrote:
>   
>> -		readlen = meminfo.writesize;
>>  
>> -		if (ifd != STDIN_FILENO) {
>> -			int tinycnt = 0;
>> -
>> -			if (pad && (imglen < readlen))
>> -			{
>> -				readlen = imglen;
>> -				erase_buffer(writebuf + readlen, meminfo.writesize - readlen);
>> -			}
>> +		{
>> +			readlen = meminfo.writesize;
>>  
>>     
>
> Err, why do you need these spare { } ?
>   

Right, I wanted to comment on that but forgot by the time I started the 
email.
My idea was to make the patches clearer. Patch 3/3 puts that code inside 
a condition. So to avoid extra changes just because of the indentation, 
I added the extra { } in this patch instead since I was already heavily 
modifying it anyway.
Do you prefer me to remove them?


>> -			/* Read Page Data from input file */
>> -			while(tinycnt < readlen) {
>> -				cnt = read(ifd, writebuf + tinycnt, readlen - tinycnt);
>> -				if (cnt == 0) { // EOF
>> -					break;
>> -				} else if (cnt < 0) {
>> -					perror ("File I/O error on input file");
>> -					goto closeall;
>> -				}
>> -				tinycnt += cnt;
>> -			}
>> -		} else {
>>  			int tinycnt = 0;
>>     
>
> Err, is it normal C do do stuff like
> {
> 	readlen = meminfo.writesize;
> 	int tinycnt += cnt;
>
> ? I think this is C++.
>   

gcc didn't complain. Easy to fix.

  parent reply	other threads:[~2009-06-10 17:11 UTC|newest]

Thread overview: 13+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2009-06-08 22:32 [PATCH] [MTD-UTILS] Bad block handling in nandwrite when reading from standard input Jehan Bing
2009-06-09 12:53 ` Artem Bityutskiy
2009-06-09 17:15   ` Jehan Bing
2009-06-09 23:04     ` [PATCH 1/3] [MTD-UTILS] Unified reading from standard input and from file Jehan Bing
2009-06-10 16:03       ` Artem Bityutskiy
2009-06-10 16:05         ` Artem Bityutskiy
2009-06-10 17:23           ` Jamie Lokier
2009-06-10 17:11         ` Jehan Bing [this message]
2009-06-11  7:32       ` Artem Bityutskiy
2009-06-11 17:43         ` [PATCH 1/3 v2] " Jehan Bing
2009-06-12  5:30           ` Artem Bityutskiy
2009-06-09 23:07     ` [PATCH 2/3] [MTD-UTILS] Use same kind of code for reading OOB than for regular data Nahor
2009-06-09 23:19     ` [PATCH 3/3] [MTD-UTILS] Handle bad block when reading from standard input Jehan Bing

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=4A2FE927.3020309@orb.com \
    --to=jehan@orb.com \
    --cc=linux-mtd@lists.infradead.org \
    /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;
as well as URLs for NNTP newsgroup(s).