mirror of
https://github.com/checkpoint-restore/criu
synced 2025-09-03 07:45:17 +00:00
locks: Drop support for per-pid images with locks
This was 1.2 when we merged all file-locks images together. I think it is good time to drop the legacy format. Signed-off-by: Pavel Emelyanov <xemul@virtuozzo.com>
This commit is contained in:
@@ -339,39 +339,16 @@ static int restore_file_locks(int pid)
|
|||||||
return ret;
|
return ret;
|
||||||
}
|
}
|
||||||
|
|
||||||
static int restore_file_locks_legacy(int pid)
|
|
||||||
{
|
|
||||||
int ret = -1;
|
|
||||||
struct cr_img *img;
|
|
||||||
FileLockEntry *fle;
|
|
||||||
|
|
||||||
img = open_image(CR_FD_FILE_LOCKS_PID, O_RSTR, pid);
|
|
||||||
if (!img)
|
|
||||||
return -1;
|
|
||||||
|
|
||||||
while (1) {
|
|
||||||
ret = pb_read_one_eof(img, &fle, PB_FILE_LOCK);
|
|
||||||
if (ret <= 0)
|
|
||||||
break;
|
|
||||||
|
|
||||||
ret = restore_file_lock(fle);
|
|
||||||
file_lock_entry__free_unpacked(fle, NULL);
|
|
||||||
if (ret)
|
|
||||||
break;
|
|
||||||
}
|
|
||||||
|
|
||||||
close_image(img);
|
|
||||||
return ret;
|
|
||||||
}
|
|
||||||
|
|
||||||
int prepare_file_locks(int pid)
|
int prepare_file_locks(int pid)
|
||||||
{
|
{
|
||||||
if (!opts.handle_file_locks)
|
if (!opts.handle_file_locks)
|
||||||
return 0;
|
return 0;
|
||||||
|
|
||||||
pr_info("Restore file locks.\n");
|
if (!(file_locks_cinfo.flags & COLLECT_HAPPENED)) {
|
||||||
if (file_locks_cinfo.flags & COLLECT_HAPPENED)
|
pr_warn("Per-pid file locks are deprecated\n");
|
||||||
return restore_file_locks(pid);
|
return -1;
|
||||||
|
}
|
||||||
|
|
||||||
|
return restore_file_locks(pid);
|
||||||
|
|
||||||
return restore_file_locks_legacy(pid);
|
|
||||||
}
|
}
|
||||||
|
Reference in New Issue
Block a user