[CRIU] [PATCH 03/19] unix: Move post_open_unix_sk() to open_unixsk_standalone() and rename it

Kirill Tkhai ktkhai at virtuozzo.com
Tue Jan 30 18:41:20 MSK 2018


Since this function is used by standalone sockets only,
we move it to appropriate place. No functional changes.

Signed-off-by: Kirill Tkhai <ktkhai at virtuozzo.com>
---
 criu/sk-unix.c |   11 +++++------
 1 file changed, 5 insertions(+), 6 deletions(-)

diff --git a/criu/sk-unix.c b/criu/sk-unix.c
index 3963a4ad5..b461f1c14 100644
--- a/criu/sk-unix.c
+++ b/criu/sk-unix.c
@@ -1088,7 +1088,7 @@ static int prep_unix_sk_cwd(struct unix_sk_info *ui, int *prev_cwd_fd, int *prev
 	return -1;
 }
 
-static int post_open_unix_sk(struct file_desc *d, int fd)
+static int post_open_standalone(struct file_desc *d, int fd)
 {
 	struct unix_sk_info *ui;
 	struct unix_sk_info *peer;
@@ -1308,10 +1308,14 @@ static int open_unixsk_pair_slave(struct unix_sk_info *ui, int *new_fd)
 
 static int open_unixsk_standalone(struct unix_sk_info *ui, int *new_fd)
 {
+	struct fdinfo_list_entry *fle;
 	int sk;
 
 	pr_info("Opening standalone socket (id %#x ino %#x peer %#x)\n",
 			ui->ue->id, ui->ue->ino, ui->ue->peer);
+	fle = file_master(&ui->d);
+	if (fle->stage == FLE_OPEN)
+		return post_open_standalone(&ui->d, fle->fe->fd);
 
 	if (set_netns(ui->ue->ns_id))
 		return -1;
@@ -1459,7 +1463,6 @@ static int open_unixsk_standalone(struct unix_sk_info *ui, int *new_fd)
 
 static int open_unix_sk(struct file_desc *d, int *new_fd)
 {
-	struct fdinfo_list_entry *fle;
 	struct unix_sk_info *ui;
 	int ret;
 
@@ -1471,10 +1474,6 @@ static int open_unix_sk(struct file_desc *d, int *new_fd)
 		return 1;
 	}
 
-	fle = file_master(d);
-	if (fle->stage >= FLE_OPEN)
-		return post_open_unix_sk(d, fle->fe->fd);
-
 	if (inherited_fd(d, new_fd)) {
 		ui->ue->uflags |= USK_INHERIT;
 		ret = *new_fd >= 0 ? 0 : -1;



More information about the CRIU mailing list