mirror of
https://github.com/checkpoint-restore/criu.git
synced 2026-01-23 02:14:37 +00:00
util: Add make_yard helper
Signed-off-by: Pavel Emelyanov <xemul@parallels.com>
This commit is contained in:
parent
c5054f959d
commit
9b3189fed1
4 changed files with 20 additions and 14 deletions
9
cgroup.c
9
cgroup.c
|
|
@ -1157,15 +1157,8 @@ static int prepare_cgroup_sfd(CgroupEntry *ce)
|
|||
return -1;
|
||||
}
|
||||
|
||||
if (mount("none", cg_yard, "tmpfs", 0, NULL)) {
|
||||
pr_perror("Can't mount tmpfs in cgyard");
|
||||
if (make_yard(cg_yard))
|
||||
goto err;
|
||||
}
|
||||
|
||||
if (mount("none", cg_yard, NULL, MS_PRIVATE, NULL)) {
|
||||
pr_perror("Can't make cgyard private");
|
||||
goto err;
|
||||
}
|
||||
|
||||
pr_debug("Opening %s as cg yard\n", cg_yard);
|
||||
i = open(cg_yard, O_DIRECTORY);
|
||||
|
|
|
|||
|
|
@ -261,4 +261,6 @@ void split(char *str, char token, char ***out, int *n);
|
|||
|
||||
int fd_has_data(int lfd);
|
||||
|
||||
int make_yard(char *path);
|
||||
|
||||
#endif /* __CR_UTIL_H__ */
|
||||
|
|
|
|||
6
mount.c
6
mount.c
|
|
@ -2647,11 +2647,7 @@ static int prepare_roots_yard(void)
|
|||
if (mnt_roots == NULL)
|
||||
return 0;
|
||||
|
||||
if (mount("none", mnt_roots, "tmpfs", 0, NULL)) {
|
||||
pr_perror("Unable to mount tmpfs in %s", mnt_roots);
|
||||
return -1;
|
||||
}
|
||||
if (mount("none", mnt_roots, NULL, MS_PRIVATE, NULL))
|
||||
if (make_yard(mnt_roots))
|
||||
return -1;
|
||||
|
||||
for (nsid = ns_ids; nsid != NULL; nsid = nsid->next) {
|
||||
|
|
|
|||
17
util.c
17
util.c
|
|
@ -14,7 +14,7 @@
|
|||
#include <sys/sendfile.h>
|
||||
#include <fcntl.h>
|
||||
#include <poll.h>
|
||||
|
||||
#include <sys/mount.h>
|
||||
#include <sys/param.h>
|
||||
#include <sys/types.h>
|
||||
#include <sys/ptrace.h>
|
||||
|
|
@ -845,3 +845,18 @@ int fd_has_data(int lfd)
|
|||
|
||||
return ret;
|
||||
}
|
||||
|
||||
int make_yard(char *path)
|
||||
{
|
||||
if (mount("none", path, "tmpfs", 0, NULL)) {
|
||||
pr_perror("Unable to mount tmpfs in %s", path);
|
||||
return -1;
|
||||
}
|
||||
|
||||
if (mount("none", path, NULL, MS_PRIVATE, NULL)) {
|
||||
pr_perror("Unable to mark yard as private");
|
||||
return -1;
|
||||
}
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue