qemu-devel
[Top][All Lists]
Advanced

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

Re: [Qemu-devel] [PATCH v3 09/12] iov: add iov_get_ptr() to reference ve


From: Paolo Bonzini
Subject: Re: [Qemu-devel] [PATCH v3 09/12] iov: add iov_get_ptr() to reference vector data
Date: Thu, 22 Nov 2012 11:54:49 +0100
User-agent: Mozilla/5.0 (X11; Linux x86_64; rv:16.0) Gecko/20121016 Thunderbird/16.0.1

Il 22/11/2012 11:38, Michael S. Tsirkin ha scritto:
>> > The code is a little simpler, because we know the footer is 1 byte only.
>
> 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.

That would be premature optimization; with >1 byte you just use
iov_from/to_buf.

BTW, something like this function is also useful for the broken SCSI
outhdr ("the CDB starts after the common outhdr and is in a single
iovec").  But the API must be changed slightly, as in my answer to Stefan.

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

That's also a possibility.

Paolo




reply via email to

[Prev in Thread] Current Thread [Next in Thread]