Commit f345fc8f authored by Pavel Emelyanov's avatar Pavel Emelyanov

parasite: Don't pull opts through the stack

Revert and tune 9eda83b7. Andrey reminded me that we have
global instance of cr_options.
Signed-off-by: 's avatarPavel Emelyanov <xemul@parallels.com>
parent bd4e5d2f
...@@ -1304,7 +1304,7 @@ static int dump_task_threads(struct parasite_ctl *parasite_ctl, ...@@ -1304,7 +1304,7 @@ static int dump_task_threads(struct parasite_ctl *parasite_ctl,
return 0; return 0;
} }
static int dump_one_task(struct pstree_item *item, const struct cr_options *o) static int dump_one_task(struct pstree_item *item)
{ {
pid_t pid = item->pid.real; pid_t pid = item->pid.real;
LIST_HEAD(vma_area_list); LIST_HEAD(vma_area_list);
...@@ -1359,7 +1359,7 @@ static int dump_one_task(struct pstree_item *item, const struct cr_options *o) ...@@ -1359,7 +1359,7 @@ static int dump_one_task(struct pstree_item *item, const struct cr_options *o)
goto err; goto err;
} }
parasite_ctl = parasite_infect_seized(pid, &vma_area_list, o); parasite_ctl = parasite_infect_seized(pid, &vma_area_list);
if (!parasite_ctl) { if (!parasite_ctl) {
ret = -1; ret = -1;
pr_err("Can't infect (pid: %d) with parasite\n", pid); pr_err("Can't infect (pid: %d) with parasite\n", pid);
...@@ -1491,7 +1491,7 @@ int cr_dump_tasks(pid_t pid, const struct cr_options *opts) ...@@ -1491,7 +1491,7 @@ int cr_dump_tasks(pid_t pid, const struct cr_options *opts)
goto err; goto err;
for_each_pstree_item(item) { for_each_pstree_item(item) {
if (dump_one_task(item, opts)) if (dump_one_task(item))
goto err; goto err;
} }
......
...@@ -40,9 +40,7 @@ extern int parasite_dump_thread_seized(struct parasite_ctl *ctl, pid_t pid, ...@@ -40,9 +40,7 @@ extern int parasite_dump_thread_seized(struct parasite_ctl *ctl, pid_t pid,
extern int parasite_drain_fds_seized(struct parasite_ctl *ctl, int *fds, int *lfds, int nr_fds, char *flags); extern int parasite_drain_fds_seized(struct parasite_ctl *ctl, int *fds, int *lfds, int nr_fds, char *flags);
extern int parasite_cure_seized(struct parasite_ctl *ctl); extern int parasite_cure_seized(struct parasite_ctl *ctl);
struct cr_options;
extern struct parasite_ctl *parasite_infect_seized(pid_t pid, extern struct parasite_ctl *parasite_infect_seized(pid_t pid,
struct list_head *vma_area_list, const struct cr_options *); struct list_head *vma_area_list);
#endif /* PARASITE_SYSCALL_H_ */ #endif /* PARASITE_SYSCALL_H_ */
...@@ -369,7 +369,7 @@ static int parasite_set_logfd(struct parasite_ctl *ctl, pid_t pid) ...@@ -369,7 +369,7 @@ static int parasite_set_logfd(struct parasite_ctl *ctl, pid_t pid)
return 0; return 0;
} }
static int parasite_init(struct parasite_ctl *ctl, pid_t pid, const struct cr_options *o) static int parasite_init(struct parasite_ctl *ctl, pid_t pid)
{ {
struct parasite_init_args args = { }; struct parasite_init_args args = { };
static int sock = -1; static int sock = -1;
...@@ -381,7 +381,7 @@ static int parasite_init(struct parasite_ctl *ctl, pid_t pid, const struct cr_op ...@@ -381,7 +381,7 @@ static int parasite_init(struct parasite_ctl *ctl, pid_t pid, const struct cr_op
if (sock == -1) { if (sock == -1) {
int rst = -1; int rst = -1;
if (o->namespaces_flags & CLONE_NEWNET) { if (opts.namespaces_flags & CLONE_NEWNET) {
pr_info("Switching to %d's net for tsock creation\n", pid); pr_info("Switching to %d's net for tsock creation\n", pid);
if (switch_ns(pid, CLONE_NEWNET, "net", &rst)) if (switch_ns(pid, CLONE_NEWNET, "net", &rst))
...@@ -670,8 +670,7 @@ int parasite_cure_seized(struct parasite_ctl *ctl) ...@@ -670,8 +670,7 @@ int parasite_cure_seized(struct parasite_ctl *ctl)
return ret; return ret;
} }
struct parasite_ctl *parasite_infect_seized(pid_t pid, struct list_head *vma_area_list, struct parasite_ctl *parasite_infect_seized(pid_t pid, struct list_head *vma_area_list)
const struct cr_options *o)
{ {
struct parasite_ctl *ctl = NULL; struct parasite_ctl *ctl = NULL;
struct vma_area *vma_area; struct vma_area *vma_area;
...@@ -756,7 +755,7 @@ struct parasite_ctl *parasite_infect_seized(pid_t pid, struct list_head *vma_are ...@@ -756,7 +755,7 @@ struct parasite_ctl *parasite_infect_seized(pid_t pid, struct list_head *vma_are
ctl->addr_cmd = (void *)PARASITE_CMD_ADDR((unsigned long)ctl->local_map); ctl->addr_cmd = (void *)PARASITE_CMD_ADDR((unsigned long)ctl->local_map);
ctl->addr_args = (void *)PARASITE_ARGS_ADDR((unsigned long)ctl->local_map); ctl->addr_args = (void *)PARASITE_ARGS_ADDR((unsigned long)ctl->local_map);
ret = parasite_init(ctl, pid, o); ret = parasite_init(ctl, pid);
if (ret) { if (ret) {
pr_err("%d: Can't create a transport socket\n", pid); pr_err("%d: Can't create a transport socket\n", pid);
goto err_restore; goto err_restore;
......
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