[v2,32/36] rst: Pass pstree_item argument to alloc_groups_copy_creds()

Submitted by Kirill Tkhai on Feb. 3, 2017, 4:16 p.m.

Details

Message ID 148613858118.3612.9955429816553534539.stgit@localhost.localdomain
State New
Series "Nested user namespaces support"
Headers show

Commit Message

Kirill Tkhai Feb. 3, 2017, 4:16 p.m.
Pass the arg and add const modifiers where they are need.

Signed-off-by: Kirill Tkhai <ktkhai@virtuozzo.com>
---
 criu/cgroup.c                   |    2 +-
 criu/cr-dump.c                  |    6 +++---
 criu/include/cgroup.h           |    2 +-
 criu/include/parasite-syscall.h |    4 ++--
 criu/parasite-syscall.c         |   13 +++++++------
 5 files changed, 14 insertions(+), 13 deletions(-)

Patch hide | download patch | download mbox

diff --git a/criu/cgroup.c b/criu/cgroup.c
index 5036be430..77ee4e24e 100644
--- a/criu/cgroup.c
+++ b/criu/cgroup.c
@@ -632,7 +632,7 @@  static int collect_cgroups(struct list_head *ctls)
 	return 0;
 }
 
-int dump_task_cgroup(struct pstree_item *item, u32 *cg_id, struct parasite_dump_cgroup_args *args)
+int dump_task_cgroup(const struct pstree_item *item, u32 *cg_id, struct parasite_dump_cgroup_args *args)
 {
 	int pid;
 	LIST_HEAD(ctls);
diff --git a/criu/cr-dump.c b/criu/cr-dump.c
index 0130893d6..d22d11ef8 100644
--- a/criu/cr-dump.c
+++ b/criu/cr-dump.c
@@ -690,7 +690,7 @@  int dump_thread_core(int pid, CoreEntry *core, const struct parasite_dump_thread
 }
 
 static int dump_task_core_all(struct parasite_ctl *ctl,
-			      struct pstree_item *item,
+			      const struct pstree_item *item,
 			      const struct proc_pid_stat *stat,
 			      const struct cr_imgset *cr_imgset)
 {
@@ -728,7 +728,7 @@  static int dump_task_core_all(struct parasite_ctl *ctl,
 	core->tc->task_state = item->pid->state;
 	core->tc->exit_code = 0;
 
-	ret = parasite_dump_thread_leader_seized(ctl, pid, core);
+	ret = parasite_dump_thread_leader_seized(ctl, item, pid, core);
 	if (ret)
 		goto err;
 
@@ -827,7 +827,7 @@  static int dump_task_thread(struct parasite_ctl *parasite_ctl,
 	pr_info("Dumping core for thread (pid: %d)\n", pid);
 	pr_info("----------------------------------------\n");
 
-	ret = parasite_dump_thread_seized(parasite_ctl, id, tid, core);
+	ret = parasite_dump_thread_seized(parasite_ctl, item, id, tid, core);
 	if (ret) {
 		pr_err("Can't dump thread for pid %d\n", pid);
 		goto err;
diff --git a/criu/include/cgroup.h b/criu/include/cgroup.h
index 949266d40..6910c38a7 100644
--- a/criu/include/cgroup.h
+++ b/criu/include/cgroup.h
@@ -7,7 +7,7 @@ 
 struct pstree_item;
 struct parasite_dump_cgroup_args;
 extern u32 root_cg_set;
-int dump_task_cgroup(struct pstree_item *, u32 *, struct parasite_dump_cgroup_args *args);
+int dump_task_cgroup(const struct pstree_item *, u32 *, struct parasite_dump_cgroup_args *args);
 int dump_cgroups(void);
 int prepare_task_cgroup(struct pstree_item *);
 int prepare_cgroup(void);
diff --git a/criu/include/parasite-syscall.h b/criu/include/parasite-syscall.h
index 3887446d6..0f923f381 100644
--- a/criu/include/parasite-syscall.h
+++ b/criu/include/parasite-syscall.h
@@ -31,8 +31,8 @@  extern int parasite_dump_posix_timers_seized(struct proc_posix_timers_stat *proc
 
 extern int parasite_dump_misc_seized(struct parasite_ctl *ctl, struct parasite_dump_misc *misc);
 extern int parasite_dump_creds(struct parasite_ctl *ctl, struct _CredsEntry *ce);
-extern int parasite_dump_thread_leader_seized(struct parasite_ctl *ctl, int pid, struct _CoreEntry *core);
-extern int parasite_dump_thread_seized(struct parasite_ctl *ctl, int id,
+extern int parasite_dump_thread_leader_seized(struct parasite_ctl *ctl, const struct pstree_item *item, int pid, struct _CoreEntry *core);
+extern int parasite_dump_thread_seized(struct parasite_ctl *ctl, const struct pstree_item *item, int id,
 					struct pid *tid, struct _CoreEntry *core);
 extern int dump_thread_core(int pid, CoreEntry *core,
 					const struct parasite_dump_thread *dt);
diff --git a/criu/parasite-syscall.c b/criu/parasite-syscall.c
index a7a26adf4..60c2457e8 100644
--- a/criu/parasite-syscall.c
+++ b/criu/parasite-syscall.c
@@ -103,7 +103,7 @@  static void sigchld_handler(int signal, siginfo_t *siginfo, void *data)
 	exit(1);
 }
 
-static int alloc_groups_copy_creds(CredsEntry *ce, struct parasite_dump_creds *c)
+static int alloc_groups_copy_creds(const struct pstree_item *item, CredsEntry *ce, struct parasite_dump_creds *c)
 {
 	BUILD_BUG_ON(sizeof(ce->groups[0]) != sizeof(c->groups[0]));
 	BUILD_BUG_ON(sizeof(ce->cap_inh[0]) != sizeof(c->cap_inh[0]));
@@ -138,7 +138,8 @@  static int alloc_groups_copy_creds(CredsEntry *ce, struct parasite_dump_creds *c
 	return ce->groups ? 0 : -ENOMEM;
 }
 
-int parasite_dump_thread_leader_seized(struct parasite_ctl *ctl, int pid, CoreEntry *core)
+int parasite_dump_thread_leader_seized(struct parasite_ctl *ctl, const struct pstree_item *item,
+					int pid, CoreEntry *core)
 {
 	ThreadCoreEntry *tc = core->thread_core;
 	struct parasite_dump_thread *args;
@@ -154,7 +155,7 @@  int parasite_dump_thread_leader_seized(struct parasite_ctl *ctl, int pid, CoreEn
 	if (ret < 0)
 		return ret;
 
-	ret = alloc_groups_copy_creds(tc->creds, pc);
+	ret = alloc_groups_copy_creds(item, tc->creds, pc);
 	if (ret) {
 		pr_err("Can't copy creds for thread leader %d\n", pid);
 		return -1;
@@ -163,8 +164,8 @@  int parasite_dump_thread_leader_seized(struct parasite_ctl *ctl, int pid, CoreEn
 	return dump_thread_core(pid, core, args);
 }
 
-int parasite_dump_thread_seized(struct parasite_ctl *ctl, int id,
-				struct pid *tid, CoreEntry *core)
+int parasite_dump_thread_seized(struct parasite_ctl *ctl, const struct pstree_item *item,
+				int id, struct pid *tid, CoreEntry *core)
 {
 	struct parasite_dump_thread *args;
 	pid_t pid = tid->real;
@@ -194,7 +195,7 @@  int parasite_dump_thread_seized(struct parasite_ctl *ctl, int id,
 		goto err_rth;
 	}
 
-	ret = alloc_groups_copy_creds(creds, pc);
+	ret = alloc_groups_copy_creds(item, creds, pc);
 	if (ret) {
 		pr_err("Can't copy creds for thread %d\n", pid);
 		goto err_rth;