Re: [Qemu-devel] Re: [PATCH 1/10] Refactor QEMUFile for live migration

Avi Kivity
2008-09-10T15:05:20Z

Glauber Costa wrote:
>> +static int fd_put_buffer(void *opaque, const uint8_t *buf,
>> + int64_t pos, int size)
>> +{
>> + QEMUFileFD *s = opaque;
>> + ssize_t len;
>> +
>> + do {
>> + len = write(s->fd, buf, size);
>> + } while (len == -1 && errno == EINTR);
>>
>
> What about the len == size case ?
>
>

Should work, no?

>> +
>> +QEMUFile *qemu_fopen_fd(int fd)
>> +{
>> + QEMUFileFD *s = qemu_mallocz(sizeof(QEMUFileFD));
>>
>
> can't it fail?
>

If it does, the entire world will disappear in a black hole. Qemu isn't
prepared to handle allocation failures.

> Isn't it possible to abstract the differences between bdrv and file so
> to have a common implementation
> between them? Do you think it's worthwhile ?
>
>

They're very different. bdrvs are sector-granularity, random access,
concurrent, and want dma. QEMUFiles are byte-granularity, sequential
access, serial, and aren't too worried about dma (though it could be nice).

--
error compiling committee.c: too many arguments to function