[U-Boot] [PATCH 0/4] Network defrag

Wolfgang Denk wd at denx.de
Mon Aug 17 22:20:28 CEST 2009


Dear Robin Getz,

In message <200908171555.31016.rgetz at blackfin.uclinux.org> you wrote:
>
> > Why static int? This gives a random init value for the second and each
> > following TFTP transfers.
> 
> Nope - it is set to zero on the start of every transfer.

Right, I saw this later, at the end of your patch, but was too lazy to
change my whole message ;-)

> > > +#ifdef CONFIG_TFTP_TSIZE
> > > +		pkt += sprintf((char *)pkt,"tsize%c%d", 0,0);
> > > +		pkt += strlen((char *)pkt) + 1;
> > 
> > Looks to me as if you were adding the length twice?
> 
> One zero is for the null char (delimiter), one zero is for ascii zero (length).

Wel, the sprintf() already returns the number of output characters,
i. e. 7.

pkt then points at the terminating '\0' character. strlen() should
always return 0, then. This makes not much sense to me.

Also, why do you need sprintf() at all when the string is a constant
anyway?

Why not simply:

	memcpy (pkt, "tsize\00", 7);
	pkt += 7;

> > > +			printf("%2d\b\b", NetBootFileXferSize * 100 / TftpTsize);
> > > +		}
> > > +#endif
> > 
> > Hm... maybe we should rather print hashes (say one '#' for each 2%,
> > resulting in a maximum of 50 characters output.
> > 
> > Otherwise we actually increase the amount of characters sent over the
> > serial line (and the intention was to reduce it, right?)
> 
> Yeah, it was to reduce the output - this was easier :)
> 
> Plus spinning numbers are always nice. When you are doing a scp - do you
> look at the bar moving, or the numbers going up to 100%? I always look
> at the numbers...

I know what you  mean.  OTOH,  I  tend  to  dislike  such  characters
sequences  (with  lots  of  backspace characters) because they always
mess up log files ;-)

> I'll re-work it for a single line of 50 hashes. (one '#' == 2% of the file).

Thanks.

> So - you are OK with they way it is done (other comments still apply of
> course).

Right. Thanks a lot.

Best regards,

Wolfgang Denk

-- 
DENX Software Engineering GmbH,     MD: Wolfgang Denk & Detlev Zundel
HRB 165235 Munich, Office: Kirchenstr.5, D-82194 Groebenzell, Germany
Phone: (+49)-8142-66989-10 Fax: (+49)-8142-66989-80 Email: wd at denx.de
Many aligators will be slain, but the swamp will remain.


More information about the U-Boot mailing list