[CRIU] [PATCH 1/3] crtools: Add --file-locks option

Gu Zheng cengku.gu at huawei.com
Wed Nov 7 22:10:07 EST 2012


Add --file-locks/-l option to support handling file locks, for safety,
only used for container.

Signed-off-by: Zheng Gu <cengku.gu at huawei.com>
---
 crtools.c         |    7 ++++++-
 include/crtools.h |    1 +
 2 files changed, 7 insertions(+), 1 deletions(-)

diff --git a/crtools.c b/crtools.c
index 71a37a0..2440b3d 100644
--- a/crtools.c
+++ b/crtools.c
@@ -60,7 +60,7 @@ int main(int argc, char *argv[])
 	int log_inited = 0;
 	int log_level = 0;
 
-	static const char short_opts[] = "dsf:t:hcD:o:n:vxVr:j";
+	static const char short_opts[] = "dsf:t:hcD:o:n:vxVr:jl";
 
 	BUILD_BUG_ON(PAGE_SIZE != PAGE_IMAGE_SIZE);
 
@@ -100,6 +100,7 @@ int main(int argc, char *argv[])
 			{ "action-script", required_argument, 0, 49},
 			{ LREMAP_PARAM, no_argument, 0, 41},
 			{ "shell-job", no_argument, 0, 'j'},
+			{ "file-locks", no_argument, 0, 'l'},
 			{ },
 		};
 
@@ -221,6 +222,9 @@ int main(int argc, char *argv[])
 		case 'j':
 			opts.shell_job = true;
 			break;
+		case 'l':
+			opts.handle_file_locks = true;
+			break;
 		case 'V':
 			pr_msg("Version: %d.%d\n", CRIU_VERSION_MAJOR, CRIU_VERSION_MINOR);
 			return 0;
@@ -317,6 +321,7 @@ usage:
 	pr_msg("			* network-lock - lock network in a target network namespace\n");
 	pr_msg("			* network-unlock - unlock network in a target network namespace\n");
 	pr_msg("  -j|--shell-job        allow to dump and restore shell jobs\n");
+	pr_msg("  -l|--file-locks       handle file locks, for safety, only used for container\n");
 
 	pr_msg("\n* Logging:\n");
 	pr_msg("  -o|--log-file [NAME]  log file name (relative path is relative to --images-dir)\n");
diff --git a/include/crtools.h b/include/crtools.h
index 43aba4d..ba9a06d 100644
--- a/include/crtools.h
+++ b/include/crtools.h
@@ -94,6 +94,7 @@ struct cr_options {
 	bool			restore_detach;
 	bool			ext_unix_sk;
 	bool			shell_job;
+	bool			handle_file_locks;
 	bool			tcp_established_ok;
 	bool			evasive_devices;
 	bool			link_remap_ok;
-- 
1.7.1




More information about the CRIU mailing list