[CRIU] [PATCH 1/2] tty: Write unread pty buffers on post dump stage
Pavel Emelyanov
xemul at virtuozzo.com
Fri May 13 08:06:48 PDT 2016
On 05/13/2016 05:46 PM, Cyrill Gorcunov wrote:
> On Fri, May 13, 2016 at 05:28:00PM +0300, Pavel Emelyanov wrote:
>>>>
>>>> Any reason why data is put into global list and is then picked by
>>>> ttys instead of tty itself is searched at data collect stage and
>>>> receives data in its list_head?
>>>
>>> Not sure I follow this moment. Queued data are saved in records inside
>>> separate image, and it's collected automatically, into one list.
>>
>> Yup. My point is that -- why not collect this data into respective tty's
>> list immediately? We already have list of all tty to lookup tty from,
>> so we'd avoid introducing yet another one.
>
> We need to keep the data read somewhere. Look, I guess it's unclean from
> the patch itself. Here is how we collect everything:
>
> static struct collect_image_info *cinfos[] = {
> ...
> &tty_cdata,
> &tty_info_cinfo,
> &tty_cinfo,
> ...
> };
>
> The &tty_cdata represents records in tty-data.img, which has only
> id per each record, so each record is hooked into one global list
> which we use for lookup later.
>
> static int collect_one_tty(void *obj, ProtobufCMessage *msg, struct cr_img *i)
> {
> info->tie = lookup_tty_info_entry(info->tfe->tty_info_id);
> info->tty_data = is_pty(info->driver) ? tty_lookup_data(info) : NULL;
>
> here we walk over records from @&tty_cdata and find which queue
> blongs to particular tty entry we're reading from image now.
>
> Could you please write in pseudocode which exactly you would like to see here?
> .
>
Sure. Put tty_data collect at the very end and
collect_tty_data(data)
{
tty_info = find_tty_info(data->id);
tty_info->data = data;
}
-- Pavel
More information about the CRIU
mailing list