On 11/18/2010 04:33 PM, Gerd Hoffmann wrote:
>   Hi,
> 
>> +static size_t scsi_req_iov_len(SCSIDiskReq *r)
>> +{
>> +    size_t iov_len = 0;
>> +    int i;
>> +
>> +    for (i = 0; i<  r->iov_num; i++)
>> +        iov_len += r->iov[i].iov_len;
>> +
>> +    return iov_len;
>> +}
> 
> You are aware that there is a QEMUIOVector type with helper functions
> which keeps track of both number of elements and total size?
> 
Yes. But I'm passing passing in an entire iovec to the request.
However, the QEMUIOVector routines allow you to add only _one_
element at a time, which is pretty wasteful here.

And I'm counting the resulting length of the iovec, which might have
been changed by read/write operations. For which there is no generic
function either.

But if requested I could easily move it into cutils.c.

Cheers,

Hannes
-- 
Dr. Hannes Reinecke                   zSeries & Storage
h...@suse.de                          +49 911 74053 688
SUSE LINUX Products GmbH, Maxfeldstr. 5, 90409 Nürnberg
GF: Markus Rex, HRB 16746 (AG Nürnberg)

Reply via email to