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

Ruslan Kuprieiev kupruser at gmail.com
Fri Sep 19 07:22:02 PDT 2014


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?

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


More information about the CRIU mailing list