On Thu, Nov 22, 2012 at 10:52:27AM +0100, Paolo Bonzini wrote: > Il 22/11/2012 10:45, Michael S. Tsirkin ha scritto: > > All this looks suspiciously like premature optimization to me. > > Do we have data to show avoiding header copy is a win? > > The code is a little simpler, because we know the footer is 1 byte only. > > Paolo
Yes but the APIs don't make sense in the generic case of >1 byte: users will have to code up two paths for when the buffer they want to access gets scattered across. So this looks like a future source of errors: it's better to avoid poking at guest memory directly. If the point is to avoid scanning iov vector when data is towards the end of the iov, then this does sound reasonable. In that case IMHO we should just have accessors that work back from end of the iov. E.g. size_t iov_from_buf_end(const struct iovec *iov, unsigned int iov_cnt, size_t offset, const void *buf, size_t bytes)