[v2,07/14] files: Pass pstree_item argument to clone_service_fd()

Submitted by Kirill Tkhai on Dec. 28, 2017, 1:09 p.m.

Details

Message ID 151446658721.28132.840445168210200428.stgit@localhost.localdomain
State New
Series "Introduce custom per-task service fds placement"
Headers show

Commit Message

Kirill Tkhai Dec. 28, 2017, 1:09 p.m.
Refactoring for next patches.

Signed-off-by: Kirill Tkhai <ktkhai@virtuozzo.com>
---
 criu/cr-restore.c        |    2 +-
 criu/include/servicefd.h |    2 +-
 criu/util.c              |    6 ++++--
 3 files changed, 6 insertions(+), 4 deletions(-)

Patch hide | download patch | download mbox

diff --git a/criu/cr-restore.c b/criu/cr-restore.c
index de14a716b..c8c3c8622 100644
--- a/criu/cr-restore.c
+++ b/criu/cr-restore.c
@@ -1158,7 +1158,7 @@  static int restore_one_zombie(CoreEntry *core)
 
 static int setup_newborn_fds(struct pstree_item *me)
 {
-	if (clone_service_fd(rsti(me)->service_fd_id))
+	if (clone_service_fd(me))
 		return -1;
 
 	if (!me->parent ||
diff --git a/criu/include/servicefd.h b/criu/include/servicefd.h
index 175e53023..8585d9c18 100644
--- a/criu/include/servicefd.h
+++ b/criu/include/servicefd.h
@@ -29,7 +29,7 @@  enum sfd_type {
 
 struct pstree_item;
 
-extern int clone_service_fd(int id);
+extern int clone_service_fd(struct pstree_item *me);
 extern int init_service_fd(void);
 extern int get_service_fd(enum sfd_type type);
 extern int install_service_fd(enum sfd_type type, int fd);
diff --git a/criu/util.c b/criu/util.c
index c08e13dfb..a8b7ef4ef 100644
--- a/criu/util.c
+++ b/criu/util.c
@@ -524,9 +524,11 @@  int close_service_fd(enum sfd_type type)
 	return 0;
 }
 
-int clone_service_fd(int id)
+int clone_service_fd(struct pstree_item *me)
 {
-	int ret = -1, i;
+	int id, i, ret = -1;
+
+	id = rsti(me)->service_fd_id;
 
 	if (service_fd_id == id)
 		return 0;