[CRIU] [PATCH CRIU 1/7] opts/rpc/lib: add log-dirty option to criu

Pavel Emelyanov xemul at virtuozzo.com
Tue Apr 12 04:09:53 PDT 2016


On 04/07/2016 04:28 PM, Pavel Tikhomirov wrote:
> Signed-off-by: Pavel Tikhomirov <ptikhomirov at virtuozzo.com>
> ---
>  criu/cr-service.c         |  3 +++
>  criu/crtools.c            |  4 ++++
>  criu/include/cr_options.h |  1 +
>  images/rpc.proto          |  1 +
>  lib/c/criu.c              | 11 +++++++++++
>  lib/c/criu.h              |  2 ++
>  6 files changed, 22 insertions(+)
> 
> diff --git a/criu/cr-service.c b/criu/cr-service.c
> index 05455d4..f84d6c5 100644
> --- a/criu/cr-service.c
> +++ b/criu/cr-service.c
> @@ -466,6 +466,9 @@ static int setup_opts_from_req(int sk, CriuOpts *req)
>  			goto err;
>  	}
>  
> +	if (req->has_log_dirty)
> +		opts.log_dirty = req->log_dirty;
> +
>  	if (req->n_irmap_scan_paths) {
>  		for (i = 0; i < req->n_irmap_scan_paths; i++) {
>  			if (irmap_scan_path_add(req->irmap_scan_paths[i]))
> diff --git a/criu/crtools.c b/criu/crtools.c
> index cedef3c..7f187c2 100644
> --- a/criu/crtools.c
> +++ b/criu/crtools.c
> @@ -250,6 +250,7 @@ int main(int argc, char *argv[], char *envp[])
>  		{ "extra",			no_argument,		0, 1077	},
>  		{ "experimental",		no_argument,		0, 1078	},
>  		{ "all",			no_argument,		0, 1079	},
> +		{ "log-dirty",			no_argument,		0, 1080	},
>  		{ },
>  	};
>  
> @@ -541,6 +542,9 @@ int main(int argc, char *argv[], char *envp[])
>  			opts.check_extra_features = true;
>  			opts.check_experimental_features = true;
>  			break;
> +		case 1080:
> +			opts.log_dirty = true;
> +			break;
>  		case 'V':
>  			pr_msg("Version: %s\n", CRIU_VERSION);
>  			if (strcmp(CRIU_GITID, "0"))

Here should go a hunk describing the option in help text.

> diff --git a/criu/include/cr_options.h b/criu/include/cr_options.h
> index 4dcfa0a..f4e1d60 100644
> --- a/criu/include/cr_options.h
> +++ b/criu/include/cr_options.h
> @@ -107,6 +107,7 @@ struct cr_options {
>  	char			*lsm_profile;
>  	unsigned int		timeout;
>  	unsigned int		empty_ns;
> +	bool			log_dirty;
>  };
>  
>  extern struct cr_options opts;
> diff --git a/images/rpc.proto b/images/rpc.proto
> index fac4b9f..26e7715 100644
> --- a/images/rpc.proto
> +++ b/images/rpc.proto
> @@ -90,6 +90,7 @@ message criu_opts {
>  	repeated string			irmap_scan_paths = 36;
>  	repeated string			external	= 37;
>  	optional uint32			empty_ns	= 38;
> +	optional bool			log_dirty	= 39;
>  }
>  
>  message criu_dump_resp {
> diff --git a/lib/c/criu.c b/lib/c/criu.c
> index 52d1b61..53a8d21 100644
> --- a/lib/c/criu.c
> +++ b/lib/c/criu.c
> @@ -196,6 +196,17 @@ void criu_set_auto_dedup(bool auto_dedup)
>  	criu_local_set_auto_dedup(global_opts, auto_dedup);
>  }
>  
> +void criu_local_set_log_dirty(criu_opts *opts, bool log_dirty)
> +{
> +	opts->rpc->has_log_dirty = true;
> +	opts->rpc->log_dirty = log_dirty;
> +}
> +
> +void criu_set_log_dirty(bool log_dirty)
> +{
> +	criu_local_set_log_dirty(global_opts, log_dirty);
> +}
> +
>  void criu_local_set_force_irmap(criu_opts *opts, bool force_irmap)
>  {
>  	opts->rpc->has_force_irmap = true;
> diff --git a/lib/c/criu.h b/lib/c/criu.h
> index 0898be0..bb3bdb3 100644
> --- a/lib/c/criu.h
> +++ b/lib/c/criu.h
> @@ -89,6 +89,7 @@ int criu_add_enable_fs(char *fs);
>  int criu_add_skip_mnt(char *mnt);
>  void criu_set_ghost_limit(unsigned int limit);
>  int criu_add_irmap_path(char *path);
> +void criu_set_log_dirty(bool log_dirty);
>  
>  /*
>   * The criu_notify_arg_t na argument is an opaque
> @@ -191,6 +192,7 @@ int criu_local_add_enable_fs(criu_opts *opts, char *fs);
>  int criu_local_add_skip_mnt(criu_opts *opts, char *mnt);
>  void criu_local_set_ghost_limit(criu_opts *opts, unsigned int limit);
>  int criu_local_add_irmap_path(criu_opts *opts, char *path);
> +void criu_local_set_log_dirty(criu_opts *opts, bool log_dirty);
>  
>  void criu_local_set_notify_cb(criu_opts *opts, int (*cb)(char *action, criu_notify_arg_t na));
>  
> 



More information about the CRIU mailing list