[v5,13/21] unix: Unify printings on peer open

Submitted by Cyrill Gorcunov on May 10, 2018, 2:57 p.m.

Details

Message ID 20180510145801.12322-14-gorcunov@gmail.com
State New
Series "Add support of deleted unix sockets"
Headers show

Commit Message

Cyrill Gorcunov May 10, 2018, 2:57 p.m.
Signed-off-by: Cyrill Gorcunov <gorcunov@gmail.com>
---
 criu/sk-unix.c | 14 +++++++++-----
 1 file changed, 9 insertions(+), 5 deletions(-)

Patch hide | download patch | download mbox

diff --git a/criu/sk-unix.c b/criu/sk-unix.c
index 110be4a6a41e..b1da3c564f7e 100644
--- a/criu/sk-unix.c
+++ b/criu/sk-unix.c
@@ -1446,16 +1446,20 @@  static int post_open_interconnected_master(struct unix_sk_info *ui)
 	return 0;
 }
 
+static void pr_info_opening(const char *prefix, struct unix_sk_info *ui, struct fdinfo_list_entry *fle)
+{
+	pr_info("Opening %s (stage %d id %#x ino %#x peer %#x)\n",
+		prefix, fle->stage, ui->ue->id, ui->ue->ino, ui->ue->peer);
+}
+
 static int open_unixsk_pair_master(struct unix_sk_info *ui, int *new_fd)
 {
 	struct fdinfo_list_entry *fle, *fle_peer;
 	struct unix_sk_info *peer = ui->peer;
 	int sk[2], tmp;
 
-	pr_info("Opening pair master (id %#x ino %#x peer %#x)\n",
-			ui->ue->id, ui->ue->ino, ui->ue->peer);
-
 	fle = file_master(&ui->d);
+	pr_info_opening("master", ui, fle);
 	if (fle->stage == FLE_OPEN)
 		return post_open_interconnected_master(ui);
 
@@ -1506,6 +1510,7 @@  static int open_unixsk_pair_slave(struct unix_sk_info *ui, int *new_fd)
 	struct fdinfo_list_entry *fle_peer;
 
 	fle_peer = file_master(&ui->peer->d);
+	pr_info_opening("slave", ui, fle_peer);
 	/*
 	 * All the work is made in master. Slave just says it's restored
 	 * after it sees the master is restored.
@@ -1549,9 +1554,8 @@  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);
+	pr_info_opening("standalone", ui, fle);
 	if (fle->stage == FLE_OPEN)
 		return post_open_standalone(&ui->d, fle->fe->fd);