[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: Cstruct.shift_left



That's a slightly odd function in cstruct; it mutates the buffer in-place to 
shift the data pointer towards the beginning, to enable the FABLE-style buffer 
write functions to expose packet headers on packet transmit.

It's quite a low-level function, and could be made safer by duplicating the 
buffer reference and modifying that, rather than being the only function to 
actually mutate the buffer that is passed in.

I've just pushed the cstruct TCP code that works to os-bigarray (and am 
finishing up the buffered channel at the moment, which will unlock HTTP and 
friends).  This doesn't actually use shift_left, since every TCP write uses 
scatter-gather IO to write segment fragments to the interface (with a small 
fragment for the header, and a list of Io_page views).

Therefore, the only real use for shift_left is now in UDP/IPv4, where it could 
also be removed and scatter-gather used for everything. This will be slightly 
more inefficient, but I suspect that it wont make a difference in practise, 
since the netback will read all the fragments on the ring in one pass without 
any extra events being involved.

What are you using shift_left for in DNS?  I would have thought that you just 
need to keep track of an offset to write into, and create sub-views. You 
shouldn't need to shift_left (I think).

-anil

On 4 Jun 2012, at 19:06, Richard Mortier wrote:

> is there a reason this has signature
> 
> val shift_left : buf -> int -> bool
> 
> ...with the bool indicating whether it worked (true) or not (false); rather 
> than
> 
> val shift_left : buf -> int -> buf 
> 
> ...with exception raised when it fails?
> 
> (i seem to be doing a lot of shift_lefting in DNS, and it's a bit fiddly - 
> i'm wrapping it up but wondered if i was missing something.)
> 
> -- 
> Cheers,
> 
> R.
> 
> 
> 
> 
> This message and any attachment are intended solely for the addressee and may 
> contain confidential information. If you have received this message in error, 
> please send it back to me, and immediately delete it.   Please do not use, 
> copy or disclose the information contained in this message or in any 
> attachment.  Any views or opinions expressed by the author of this email do 
> not necessarily reflect the views of the University of Nottingham.
> 
> This message has been checked for viruses but the contents of an attachment
> may still contain software viruses which could damage your computer system:
> you are advised to perform your own checks. Email communications with the
> University of Nottingham may be monitored as permitted by UK legislation.




 


Rackspace

Lists.xenproject.org is hosted with RackSpace, monitoring our
servers 24x7x365 and backed by RackSpace's Fanatical Support®.