[CRIU] Re: [PATCH 02/28] dump: open global image files with global helpers

Pavel Emelyanov xemul at parallels.com
Fri Mar 23 08:54:24 EDT 2012


On 03/23/2012 04:36 PM, Kinsbursky Stanislav wrote:
> 23.03.2012 16:32, Pavel Emelyanov пишет:
>> On 03/23/2012 04:25 PM, Kinsbursky Stanislav wrote:
>>> 22.03.2012 22:57, Pavel Emelyanov пишет:
>>>> How about the pstree file? It's opened with these _glob_ helpers and
>>>> thus is no longer unlinked.
>>>>
>>> No, it is not opened with _glob_ helpers.
>> Ah, I see. It's opened with _glob_ in restore _only_:
> 
> I'll fix this.
> 
>> --- a/cr-restore.c
>> +++ b/cr-restore.c
>> @@ -1167,7 +1167,7 @@ static int restore_task_with_children(void *_arg)
>>
>>   	pr_info("%d: Starting restore\n", me->pid);
>>
>> -	fd = open_image_ro_nocheck(FMT_FNAME_PSTREE, pstree_pid);
>> +	fd = open_glob_image_ro_nocheck(FMT_FNAME_PSTREE);
>>   	if (fd<  0) {
>>   		pr_perror("%d: Can't reopen pstree image", me->pid);
>>   		exit(1);
>>
>> This is also wrong. GLobal files should be opened with _glob_ helper always.
> 
> The idea of global files was to provide some way to open the same file many 
> times during dump.
> Pstree image files is opened only once. I don't see any need in opening it with 
> global helpers.

Это, конечно, все мои личные заморочки, но...

Если функция называется *_glob_*, то это функция для работы с чем-то глобальным.
Если функция для открывания чего-то много раз, то она должна зваться *_append_* или
*_mult_* или *_again_* или там reopen_* или как-то еще, но не *_glob_*.

Thanks,
Pavel



More information about the CRIU mailing list