[CRIU] [PATCH 11/15] opt: cpu-cap -- Make it as optional_argument

Cyrill Gorcunov gorcunov at openvz.org
Fri Sep 19 07:03:13 PDT 2014


This slightly changes the visible API, but i think it's safe now.
The idea behind it to make single --cpu-cap to indicate "--cpu-cap all".

Signed-off-by: Cyrill Gorcunov <gorcunov at openvz.org>
---
 crtools.c | 7 ++++++-
 1 file changed, 6 insertions(+), 1 deletion(-)

diff --git a/crtools.c b/crtools.c
index 8928150e0391..ee85adb624b6 100644
--- a/crtools.c
+++ b/crtools.c
@@ -98,6 +98,11 @@ static int parse_cpu_cap(struct cr_options *opts, const char *optarg)
 			(__opts)->cpu_cap |=  (__cap);	\
 	} while (0)
 
+	if (!optarg) {
+		____cpu_set_cap(opts, CPU_CAP_ALL, false);
+		return 0;
+	}
+
 	for (; *optarg; optarg++) {
 		if (optarg[0] == '^') {
 			inverse = !inverse;
@@ -175,7 +180,7 @@ int main(int argc, char *argv[], char *envp[])
 		{ "track-mem", no_argument, 0, 1055},
 		{ "auto-dedup", no_argument, 0, 1056},
 		{ "libdir", required_argument, 0, 'L'},
-		{ "cpu-cap", required_argument, 0, 1057},
+		{ "cpu-cap", optional_argument, 0, 1057},
 		{ "force-irmap", no_argument, 0, 1058},
 		{ "ext-mount-map", required_argument, 0, 'M'},
 		{ "exec-cmd", no_argument, 0, 1059},
-- 
1.9.3



More information about the CRIU mailing list