mirror of
https://github.com/checkpoint-restore/criu
synced 2025-09-04 08:15:37 +00:00
mount: pick out a function to set ROOT_FD_OFF
Signed-off-by: Andrew Vagin <avagin@virtuozzo.com> Signed-off-by: Pavel Emelyanov <xemul@parallels.com>
This commit is contained in:
committed by
Pavel Emelyanov
parent
decf4f525a
commit
a9be7621b7
20
mount.c
20
mount.c
@@ -3214,9 +3214,21 @@ err:
|
|||||||
return -1;
|
return -1;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
static int mntns_root_pid = -1;
|
||||||
|
static int mntns_set_root_fd(pid_t pid, int fd)
|
||||||
|
{
|
||||||
|
int ret;
|
||||||
|
|
||||||
|
ret = install_service_fd(ROOT_FD_OFF, fd);
|
||||||
|
if (ret >= 0)
|
||||||
|
mntns_root_pid = pid;
|
||||||
|
close(fd);
|
||||||
|
|
||||||
|
return ret;
|
||||||
|
}
|
||||||
|
|
||||||
int __mntns_get_root_fd(pid_t pid)
|
int __mntns_get_root_fd(pid_t pid)
|
||||||
{
|
{
|
||||||
static int mntns_root_pid = -1;
|
|
||||||
|
|
||||||
int fd, pfd;
|
int fd, pfd;
|
||||||
int ret;
|
int ret;
|
||||||
@@ -3272,11 +3284,7 @@ int __mntns_get_root_fd(pid_t pid)
|
|||||||
}
|
}
|
||||||
|
|
||||||
set_root:
|
set_root:
|
||||||
ret = install_service_fd(ROOT_FD_OFF, fd);
|
return mntns_set_root_fd(pid, fd);
|
||||||
if (ret >= 0)
|
|
||||||
mntns_root_pid = pid;
|
|
||||||
close(fd);
|
|
||||||
return ret;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
int mntns_get_root_fd(struct ns_id *mntns) {
|
int mntns_get_root_fd(struct ns_id *mntns) {
|
||||||
|
Reference in New Issue
Block a user