Am 09.03.2012 12:42, schrieb Stefan Hajnoczi:
> On Thu, Mar 8, 2012 at 10:15 PM, Leonardo E. Reiter
> <[email protected]> wrote:
>> +#ifndef _WIN32
>> +#include <sys/mman.h>
> 
> I recommend writing this in a platform-independent way using bdrv_*()
> APIs to access the image file.  This has been a requirement for all
> block drivers.  Legacy drivers have been updated too.  The chance of
> merging a new image format that uses platform-specific I/O APIs is low
> IMO.

Let's be clear here: It's not just low, it's zero.

Maybe the qcow2-cache should be generalised so that replacing an mmap in
other image formats becomes easier?

>> +BlockDriver bdrv_gow1 = {
>> +    .format_name    = "gow1",
>> +    .instance_size  = sizeof(gow1_state_t),
>> +    .bdrv_probe     = gow1_probe,
>> +    .bdrv_file_open = gow1_open,
>> +    .bdrv_close     = gow1_close,
>> +    .bdrv_read      = gow1_read,
>> +    .bdrv_write     = gow1_write,
> 
> Please implement .bdrv_co_readv()/.bdrv_co_writev() instead.  They
> work along the same lines - except they allow parallel requests.  If
> you don't want to handle parallel requests you can use a CoMutex to
> serialize these functions.

.bdrv_read/write allow parallel requests as well. The difference is that
bdrv_co_readv/writev is vectored and therefore preferable.

Kevin

Reply via email to