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

Robin Getz rgetz at blackfin.uclinux.org
Mon Aug 17 22:35:07 CEST 2009


On Mon 17 Aug 2009 16:20, Wolfgang Denk pondered:
> 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;

That's is better - It was just a dumb copy/paste from the blksize option...

> > > > +			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 ;-)

But they look pretty ... :)

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

Np.

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

New version tomorrow...

Robin


More information about the U-Boot mailing list