[6/7] rpc: Add interface for --check-mounts option

Submitted by Pavel Tikhomirov on Feb. 7, 2019, 12:17 p.m.

Details

Message ID 20190207121754.19667-7-ptikhomirov@virtuozzo.com
State New
Series "mount: check mounts after restoring"
Headers show

Commit Message

Pavel Tikhomirov Feb. 7, 2019, 12:17 p.m.
Signed-off-by: Pavel Tikhomirov <ptikhomirov@virtuozzo.com>
---
 criu/cr-service.c |  3 +++
 images/rpc.proto  |  1 +
 lib/c/criu.c      | 11 +++++++++++
 lib/c/criu.h      |  2 ++
 4 files changed, 17 insertions(+)

Patch hide | download patch | download mbox

diff --git a/criu/cr-service.c b/criu/cr-service.c
index 231a37f30..fde1df698 100644
--- a/criu/cr-service.c
+++ b/criu/cr-service.c
@@ -649,6 +649,9 @@  static int setup_opts_from_req(int sk, CriuOpts *req)
 			goto err;
 	}
 
+	if (req->check_mounts)
+		opts.check_mounts = true;
+
 	log_set_loglevel(opts.log_level);
 	if (check_options())
 		goto err;
diff --git a/images/rpc.proto b/images/rpc.proto
index 5c8226d25..aec1cb765 100644
--- a/images/rpc.proto
+++ b/images/rpc.proto
@@ -113,6 +113,7 @@  message criu_opts {
 	optional bool			orphan_pts_master	= 50;
 	optional string			config_file		= 51;
 	optional bool			tcp_close		= 52;
+	optional bool			check_mounts		= 53;
 }
 
 message criu_dump_resp {
diff --git a/lib/c/criu.c b/lib/c/criu.c
index f53315894..44d3ff0da 100644
--- a/lib/c/criu.c
+++ b/lib/c/criu.c
@@ -1067,6 +1067,17 @@  int criu_set_page_server_address_port(const char *address, int port)
 	return criu_local_set_page_server_address_port(global_opts, address, port);
 }
 
+void criu_local_set_check_mounts(criu_opts *opts, bool val)
+{
+	opts->rpc->has_check_mounts = true;
+	opts->rpc->check_mounts = val;
+}
+
+void criu_set_check_mounts(bool val)
+{
+	criu_local_set_check_mounts(global_opts, val);
+}
+
 static CriuResp *recv_resp(int socket_fd)
 {
 	unsigned char *buf = NULL;
diff --git a/lib/c/criu.h b/lib/c/criu.h
index 8fccf8ed7..badf1b4a9 100644
--- a/lib/c/criu.h
+++ b/lib/c/criu.h
@@ -98,6 +98,7 @@  int criu_add_irmap_path(const char *path);
 int criu_add_inherit_fd(int fd, const char *key);
 int criu_add_external(const char *key);
 int criu_set_page_server_address_port(const char *address, int port);
+void criu_set_check_mounts(bool val);
 
 /*
  * The criu_notify_arg_t na argument is an opaque
@@ -213,6 +214,7 @@  int criu_local_add_cg_dump_controller(criu_opts *opts, const char *name);
 int criu_local_add_inherit_fd(criu_opts *opts, int fd, const char *key);
 int criu_local_add_external(criu_opts *opts, const char *key);
 int criu_local_set_page_server_address_port(criu_opts *opts, const char *address, int port);
+void criu_local_set_check_mounts(criu_opts *opts, bool val);
 
 void criu_local_set_notify_cb(criu_opts *opts, int (*cb)(char *action, criu_notify_arg_t na));