[CRIU] [RFC PATCH 5/6] add --xxx command line option to specify FSTYPE__AUTO names
Oleg Nesterov
oleg at redhat.com
Fri Mar 27 10:55:55 PDT 2015
Don't tell me this patch is ugly and incomplete, I know ;)
Add --xxx option. optarg is the comma-separated string or "all".
With this patch "criu dump -t `pidof unshared-mnt-ns-app1" succeeds
with the following (debugging) output:
Warn (mount.c:1119): XXX: FSTYPE__AUTO(xfs) -> 1
Warn (mount.c:1119): XXX: FSTYPE__AUTO(hugetlbfs) -> 1
Warn (mount.c:1119): XXX: FSTYPE__AUTO(autofs) -> 1
Warn (mount.c:1119): XXX: FSTYPE__AUTO(configfs) -> 1
Warn (mount.c:1119): XXX: FSTYPE__AUTO(selinuxfs) -> 1
Signed-off-by: Oleg Nesterov <oleg at redhat.com>
---
crtools.c | 5 +++++
include/mount.h | 1 +
mount.c | 27 ++++++++++++++++++++++++++-
3 files changed, 32 insertions(+), 1 deletions(-)
diff --git a/crtools.c b/crtools.c
index 0b3c497..6745ea6 100644
--- a/crtools.c
+++ b/crtools.c
@@ -203,6 +203,7 @@ int main(int argc, char *argv[], char *envp[])
{ "cgroup-root", required_argument, 0, 1061},
{ "inherit-fd", required_argument, 0, 1062},
{ "feature", required_argument, 0, 1063},
+ { "xxx", required_argument, 0, 1064},
{ },
};
@@ -416,6 +417,10 @@ int main(int argc, char *argv[], char *envp[])
if (check_add_feature(optarg) < 0)
return 1;
break;
+ case 1064:
+ if (add_fstype_auto(optarg) < 0)
+ return 1;
+ break;
case 'M':
{
char *aux;
diff --git a/include/mount.h b/include/mount.h
index f3d31e6..a582d25 100644
--- a/include/mount.h
+++ b/include/mount.h
@@ -13,6 +13,7 @@ struct proc_mountinfo;
extern int open_mount(unsigned int s_dev);
extern struct fstype *find_fstype_by_name(char *fst);
+extern int add_fstype_auto(const char *names);
struct cr_imgset;
extern struct mount_info * collect_mntinfo(struct ns_id *ns);
diff --git a/mount.c b/mount.c
index b44ed38..0479b4e 100644
--- a/mount.c
+++ b/mount.c
@@ -1095,9 +1095,34 @@ static struct fstype fstypes[32] = {
},
};
+static char *fsauto_names;
+
static bool fstype_is_auto(const char *name)
{
- return false;
+ const char *p;
+ bool yes = false;
+
+ if (!fsauto_names)
+ goto ret;;
+
+ yes = strcmp(fsauto_names, "all") == 0;
+ if (yes)
+ goto ret;
+
+ for (p = strtok(fsauto_names, ","); p; p = strtok(NULL, ",")) {
+ yes = strcmp(name, p) == 0;
+ if (yes)
+ goto ret;
+ }
+ ret:
+ pr_warn("XXX: FSTYPE__AUTO(%s) -> %d\n", name, yes);
+ return yes;
+}
+
+int add_fstype_auto(const char *names)
+{
+ fsauto_names = xstrdup(names);
+ return 0;
}
static struct fstype *__find_fstype_by_name(char *fst, bool force_auto)
--
1.5.5.1
More information about the CRIU
mailing list