[CRIU] [PATCH 7/8] files: add ability to set callbacks for files (v3)

Andrew Vagin avagin at parallels.com
Sun Dec 15 07:23:54 PST 2013


On Thu, Dec 12, 2013 at 09:12:58PM +0400, Andrey Vagin wrote:
> Here is nothing interecting. If a file can't be dumped by criu,
> plugins are called. If one of plugins knows how to dump the file,
> the file entry is marked as need_callback. On restore if we see
> this mark, we execute plugins for restoring the file.
> 
> v2: Callbacks are called for all files, which are not supported by CRIU.
> v3: Call plugins for a file instead of file descriptor. A few file
> descriptors can be associated with one file.
> 
> Signed-off-by: Andrey Vagin <avagin at openvz.org>
> ---
...
> @@ -583,6 +589,15 @@ static int do_open_reg(struct reg_file_info *rfi, void *arg)
        fd = open(rfi->path, rfi->rfe->flags);
        if (fd < 0) {
                pr_perror("Can't open file %s on restore", rfi->path);
>  		return fd;
>  	}
> 
> +	if (rfi->rfe->need_callback) {

I'm not sure that criu should open a file. Maybe it should be done in
a callback...

> +		if (cr_plugin_restore_file(fd, rfi->rfe->id)) {
> +			pr_err("Unable to restore %#x\n", rfi->rfe->id);
> +			close(fd);
> +			return -1;
> +		}
> +		return fd;
> +	}
> +
>  	if ((rfi->rfe->pos != -1ULL) &&
>  			lseek(fd, rfi->rfe->pos, SEEK_SET) < 0) {
>  		pr_perror("Can't restore file pos");


More information about the CRIU mailing list