Commit 1435617c authored by Pavel Emelyanov's avatar Pavel Emelyanov

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: 's avatarPavel Emelyanov <xemul@parallels.com>
parent 20003300
...@@ -351,7 +351,7 @@ static void __rollback_link_remaps(bool do_unlink) ...@@ -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, ...@@ -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, ...@@ -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) ...@@ -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 @@ ...@@ -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;
......
...@@ -227,7 +227,7 @@ char *irmap_lookup(unsigned int s_dev, unsigned long i_ino) ...@@ -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);
......
...@@ -475,7 +475,7 @@ static int __open_mountpoint(struct mount_info *pm, int mnt_fd) ...@@ -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: ...@@ -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) ...@@ -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;
......
...@@ -375,7 +375,7 @@ static int unix_collect_one(const struct unix_diag_msg *m, ...@@ -375,7 +375,7 @@ static int unix_collect_one(const struct unix_diag_msg *m,
if (ns == NULL) if (ns == NULL)
return -1; return -1;
if (mntns_collect_root(ns->pid) < 0) if (mntns_get_root_fd(ns->pid) < 0)
return -1; return -1;
d = xzalloc(sizeof(*d)); d = xzalloc(sizeof(*d));
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment