[CRIU] [PATCH 1/5] bfd: File-descriptors based buffered read

Pavel Emelyanov xemul at parallels.com
Fri Sep 19 07:44:08 PDT 2014


On 09/19/2014 06:22 PM, Ruslan Kuprieiev wrote:
> On 19.09.2014 17:04, Pavel Emelyanov wrote:
>> On 09/19/2014 05:57 PM, Ruslan Kuprieiev wrote:
>>> On 19.09.2014 16:30, Pavel Emelyanov wrote:
>>>> +/*
>>>> + * XXX currently CRIU doesn't open several files
>>>> + * at once, so we can have just one buffer.
>>>> + */
>>>> +static char *buf;
>>>> +static bool buf_busy;
>>>> +
>>> Why not just store flags(like buf_busy) and buffers inside xbuf structure?
>> Because if some other call to bfdopen() comes and asks us for a buffer,
>> we here should know that the buffer pointed by this static variable is
>> busy (and we need to mmap a new one) not some xbuf that we was before.
>>
> Thats because we assume, that there is only one file opened, right?
> And later, when we would need to open several files at the time, we would
> get rid of these static vars, put them into structure xbuf and mmap\unmap,
> right?

Nnnno, we'd have to introduce a list (or array) or "char *"-s,
pull them out of list on get and put back on put.

> Could I use it as a start point at image buffering?

Sure. But there's no write() method for bfd yet :)

Thanks,
Pavel




More information about the CRIU mailing list