mirror of
https://github.com/checkpoint-restore/criu
synced 2025-09-03 07:45:17 +00:00
mnt: Rename _collect_root into _get_root_fd
Nowadays this routine is mainly used for getting an fd, rather than keeping one for future reference. Signed-off-by: Pavel Emelyanov <xemul@parallels.com>
This commit is contained in:
@@ -351,7 +351,7 @@ static void __rollback_link_remaps(bool do_unlink)
|
|||||||
return;
|
return;
|
||||||
|
|
||||||
list_for_each_entry_safe(rlb, tmp, &link_remaps, list) {
|
list_for_each_entry_safe(rlb, tmp, &link_remaps, list) {
|
||||||
mntns_root = mntns_collect_root(rlb->pid);
|
mntns_root = mntns_get_root_fd(rlb->pid);
|
||||||
if (mntns_root < 0)
|
if (mntns_root < 0)
|
||||||
return;
|
return;
|
||||||
list_del(&rlb->list);
|
list_del(&rlb->list);
|
||||||
@@ -407,7 +407,7 @@ static int create_link_remap(char *path, int len, int lfd,
|
|||||||
/* Any 'unique' name works here actually. Remap works by reg-file ids. */
|
/* Any 'unique' name works here actually. Remap works by reg-file ids. */
|
||||||
snprintf(tmp + 1, sizeof(link_name) - (size_t)(tmp - link_name - 1), "link_remap.%d", rfe.id);
|
snprintf(tmp + 1, sizeof(link_name) - (size_t)(tmp - link_name - 1), "link_remap.%d", rfe.id);
|
||||||
|
|
||||||
mntns_root = mntns_collect_root(nsid->pid);
|
mntns_root = mntns_get_root_fd(nsid->pid);
|
||||||
|
|
||||||
if (linkat(lfd, "", mntns_root, link_name, AT_EMPTY_PATH) < 0) {
|
if (linkat(lfd, "", mntns_root, link_name, AT_EMPTY_PATH) < 0) {
|
||||||
pr_perror("Can't link remap to %s", path);
|
pr_perror("Can't link remap to %s", path);
|
||||||
@@ -515,7 +515,7 @@ static int check_path_remap(char *rpath, int plen, const struct fd_parms *parms,
|
|||||||
return dump_linked_remap(rpath + 1, plen - 1, ost, lfd, id, nsid);
|
return dump_linked_remap(rpath + 1, plen - 1, ost, lfd, id, nsid);
|
||||||
}
|
}
|
||||||
|
|
||||||
mntns_root = mntns_collect_root(nsid->pid);
|
mntns_root = mntns_get_root_fd(nsid->pid);
|
||||||
if (mntns_root < 0)
|
if (mntns_root < 0)
|
||||||
return -1;
|
return -1;
|
||||||
|
|
||||||
@@ -713,7 +713,7 @@ static int do_open_reg_noseek_flags(struct reg_file_info *rfi, void *arg)
|
|||||||
if (nsid == NULL)
|
if (nsid == NULL)
|
||||||
return -1;
|
return -1;
|
||||||
|
|
||||||
mntns_root = mntns_collect_root(nsid->pid);
|
mntns_root = mntns_get_root_fd(nsid->pid);
|
||||||
|
|
||||||
fd = openat(mntns_root, rfi->path, flags);
|
fd = openat(mntns_root, rfi->path, flags);
|
||||||
if (fd < 0) {
|
if (fd < 0) {
|
||||||
|
@@ -3,7 +3,7 @@
|
|||||||
|
|
||||||
extern struct mount_info *mntinfo;
|
extern struct mount_info *mntinfo;
|
||||||
|
|
||||||
extern int mntns_collect_root(pid_t pid);
|
extern int mntns_get_root_fd(pid_t pid);
|
||||||
extern struct ns_id *lookup_nsid_by_mnt_id(int mnt_id);
|
extern struct ns_id *lookup_nsid_by_mnt_id(int mnt_id);
|
||||||
|
|
||||||
struct proc_mountinfo;
|
struct proc_mountinfo;
|
||||||
|
2
irmap.c
2
irmap.c
@@ -227,7 +227,7 @@ char *irmap_lookup(unsigned int s_dev, unsigned long i_ino)
|
|||||||
|
|
||||||
pr_debug("Resolving %x:%lx path\n", s_dev, i_ino);
|
pr_debug("Resolving %x:%lx path\n", s_dev, i_ino);
|
||||||
|
|
||||||
if (mntns_collect_root(root_item->pid.real) < 0)
|
if (mntns_get_root_fd(root_item->pid.real) < 0)
|
||||||
goto out;
|
goto out;
|
||||||
|
|
||||||
timing_start(TIME_IRMAP_RESOLVE);
|
timing_start(TIME_IRMAP_RESOLVE);
|
||||||
|
4
mount.c
4
mount.c
@@ -475,7 +475,7 @@ static int __open_mountpoint(struct mount_info *pm, int mnt_fd)
|
|||||||
if (mnt_fd == -1) {
|
if (mnt_fd == -1) {
|
||||||
int mntns_root;
|
int mntns_root;
|
||||||
|
|
||||||
mntns_root = mntns_collect_root(pm->nsid->pid);
|
mntns_root = mntns_get_root_fd(pm->nsid->pid);
|
||||||
if (mntns_root < 0)
|
if (mntns_root < 0)
|
||||||
return -1;
|
return -1;
|
||||||
|
|
||||||
@@ -1791,7 +1791,7 @@ out:
|
|||||||
return ret;
|
return ret;
|
||||||
}
|
}
|
||||||
|
|
||||||
int mntns_collect_root(pid_t pid)
|
int mntns_get_root_fd(pid_t pid)
|
||||||
{
|
{
|
||||||
static int mntns_root_pid = -1;
|
static int mntns_root_pid = -1;
|
||||||
|
|
||||||
|
@@ -387,7 +387,7 @@ int dump_task_ns_ids(struct pstree_item *item)
|
|||||||
|
|
||||||
static int gen_ns_ids(int pid)
|
static int gen_ns_ids(int pid)
|
||||||
{
|
{
|
||||||
/* needed for mntns_collect_root */
|
/* needed for mntns_get_root_fd */
|
||||||
if (!get_ns_id(pid, &mnt_ns_desc))
|
if (!get_ns_id(pid, &mnt_ns_desc))
|
||||||
return -1;
|
return -1;
|
||||||
return 0;
|
return 0;
|
||||||
|
Reference in New Issue
Block a user