mirror of
https://github.com/checkpoint-restore/criu
synced 2025-08-29 13:28:27 +00:00
mount: Add suport of empty binfmt_misc (v3)
Binfmt is global fs. We could check for its inhabitants intersect on source and destination, but for the 1st time it's enough just to check this one being empty. Signed-off-by: Andrey Vagin <avagin@openvz.org> Signed-off-by: Pavel Emelyanov <xemul@parallels.com>
This commit is contained in:
parent
af15b75b70
commit
b0d7cc9724
35
mount.c
35
mount.c
@ -179,7 +179,7 @@ static struct mount_info *mnt_build_tree(struct mount_info *list)
|
|||||||
return tree;
|
return tree;
|
||||||
}
|
}
|
||||||
|
|
||||||
DIR *open_mountpoint(struct mount_info *pm)
|
static DIR *open_mountpoint(struct mount_info *pm)
|
||||||
{
|
{
|
||||||
int fd, ret;
|
int fd, ret;
|
||||||
char path[PATH_MAX + 1];
|
char path[PATH_MAX + 1];
|
||||||
@ -222,7 +222,7 @@ DIR *open_mountpoint(struct mount_info *pm)
|
|||||||
return fdir;
|
return fdir;
|
||||||
}
|
}
|
||||||
|
|
||||||
int close_mountpoint(DIR *dfd)
|
static int close_mountpoint(DIR *dfd)
|
||||||
{
|
{
|
||||||
if (closedir(dfd)) {
|
if (closedir(dfd)) {
|
||||||
pr_perror("Unable to close directory");
|
pr_perror("Unable to close directory");
|
||||||
@ -231,11 +231,42 @@ int close_mountpoint(DIR *dfd)
|
|||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
static int binfmt_misc_dump(struct mount_info *pm)
|
||||||
|
{
|
||||||
|
int ret = -1;
|
||||||
|
struct dirent *de;
|
||||||
|
DIR *fdir = NULL;
|
||||||
|
|
||||||
|
fdir = open_mountpoint(pm);
|
||||||
|
if (fdir == NULL)
|
||||||
|
return -1;
|
||||||
|
|
||||||
|
while ((de = readdir(fdir))) {
|
||||||
|
if (!strcmp(de->d_name, "."))
|
||||||
|
continue;
|
||||||
|
if (!strcmp(de->d_name, ".."))
|
||||||
|
continue;
|
||||||
|
if (!strcmp(de->d_name, "register"))
|
||||||
|
continue;
|
||||||
|
if (!strcmp(de->d_name, "status"))
|
||||||
|
continue;
|
||||||
|
|
||||||
|
pr_err("binfmt_misc isn't empty: %s\n", de->d_name);
|
||||||
|
goto out;
|
||||||
|
}
|
||||||
|
|
||||||
|
ret = 0;
|
||||||
|
out:
|
||||||
|
close_mountpoint(fdir);
|
||||||
|
return ret;
|
||||||
|
}
|
||||||
|
|
||||||
static struct fstype fstypes[] = {
|
static struct fstype fstypes[] = {
|
||||||
{ "unsupported" },
|
{ "unsupported" },
|
||||||
{ "proc" },
|
{ "proc" },
|
||||||
{ "sysfs" },
|
{ "sysfs" },
|
||||||
{ "devtmpfs" },
|
{ "devtmpfs" },
|
||||||
|
{ "binfmt_misc", binfmt_misc_dump },
|
||||||
};
|
};
|
||||||
|
|
||||||
struct fstype *find_fstype_by_name(char *fst)
|
struct fstype *find_fstype_by_name(char *fst)
|
||||||
|
@ -78,6 +78,11 @@ done:
|
|||||||
fail("Can't mount proc");
|
fail("Can't mount proc");
|
||||||
return 1;
|
return 1;
|
||||||
}
|
}
|
||||||
|
if (mount("none", MPTS_ROOT"/kernel/sys/fs/binfmt_misc",
|
||||||
|
"binfmt_misc", 0, "") < 0) {
|
||||||
|
fail("Can't mount proc");
|
||||||
|
return 1;
|
||||||
|
}
|
||||||
|
|
||||||
fd = open(MPTS_ROOT"/kernel/meminfo", O_RDONLY);
|
fd = open(MPTS_ROOT"/kernel/meminfo", O_RDONLY);
|
||||||
if (fd == -1)
|
if (fd == -1)
|
||||||
|
Loading…
x
Reference in New Issue
Block a user