[PATCH] Initial work on automatically reallocated buffer size for CSD script

David Woodhouse dwmw2 at infradead.org
Mon Feb 22 09:09:52 EST 2010


On Fri, 2010-02-12 at 23:03 +0100, Adam Piątyszek wrote:
> 
> The relevant patches are in my repository:
> http://git.infradead.org/users/ediap/openconnect-csd2.git

Thanks. The last commit there isn't strictly needed -- we weren't
actually allocating the +1 byte repeatedly and losing space. It went
like this...

 done = 0
 (re)allocate 'done' + 16385 == 16385
 read 16KiB, set 'done' to 16KiB.
 reallocate 'done' + 16385 == 32769
 read another 16KiB, set 'done' to 32KiB
 reallocate 'done' + 16385 == 49153

So we only ever had the one extra byte, not one extra byte for each time
round the loop.

But doing it your way is probably slightly more efficient since it's
only allocating an even number of pages most of the time, not extending
one byte into a final page on every allocation.

I've pushed this to the main repository now; thanks.

-- 
David Woodhouse                            Open Source Technology Centre
David.Woodhouse at intel.com                              Intel Corporation




More information about the openconnect-devel mailing list