As mentioned here's my draft patch adding a helper to pull headers off an IOV, checking for contiguity, alignment and so forth. It's based around the idea of an "iov tail", that is an iov from which you've already consumed (in some sense) some data from the beginning. It uses an explicit offset to track this, so we don't have to copy an entire iovec array in order to trim a bit off it. But, it's built so that if you pull enough off the front to remove some entire buffers, it won't repeatedly have to step through them working out later offsets. It may be somewhat overengineered, let me know what you think of the interface. David Gibson (1): iov: iov tail helpers iov.c | 83 +++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ iov.h | 24 +++++++++++++++++ 2 files changed, 107 insertions(+) -- 2.47.0