[CRIU] [PATCH 6/12] sockets: Replace sockets conn job flags with type

Pavel Emelyanov xemul at parallels.com
Tue Feb 7 06:54:03 EST 2012


Required for simpler future patching.

Signed-off-by: Pavel Emelyanov <xemul at parallels.com>

---
-------------- next part --------------
From 2f9b425888dd3681624baf45e06d303f95ad5fce Mon Sep 17 00:00:00 2001
From: Pavel Emelyanov <xemul at parallels.com>
Date: Mon, 6 Feb 2012 16:56:03 +0400
Subject: [PATCH 06/12] replace flags with type

---
 sockets.c |   17 +++++++++++++----
 1 files changed, 13 insertions(+), 4 deletions(-)

diff --git a/sockets.c b/sockets.c
index 13206c4..dad0ace 100644
--- a/sockets.c
+++ b/sockets.c
@@ -664,10 +664,16 @@ static void prep_conn_addr(int id, struct sockaddr_un *addr, int *addrlen)
 struct unix_conn_job {
 	int			fd;
 	unsigned int		peer;
-	int			flags;
+	int			type;
 	struct unix_conn_job	*next;
 };
 
+enum {
+	CJ_DGRAM,
+	CJ_STREAM,
+	CJ_STREAM_INFLIGHT,
+};
+
 static void unix_show_job(char *type, int fd, int id)
 {
 	dprintk("%s job fd %d id %d\n", type, fd, id);
@@ -689,7 +695,7 @@ static int run_connect_jobs(void)
 		/*
 		 * Might need to resolve in-flight connection name.
 		 */
-		if (cj->flags & USK_INFLIGHT) {
+		if (cj->type == CJ_STREAM_INFLIGHT) {
 			struct unix_sk_listen *e;
 
 			e = lookup_unix_listen(cj->peer);
@@ -879,7 +885,7 @@ static int open_unix_sk_dgram(int sk, struct unix_sk_entry *ue, int img_fd)
 		if (!d)
 			goto err;
 
-		d->flags = 0;
+		d->type = CJ_DGRAM;
 		d->peer	= ue->peer;
 		d->fd	= ue->fd;
 		d->next = dgram_peer;
@@ -1001,7 +1007,10 @@ static int open_unix_sk_stream(int sk, struct unix_sk_entry *ue, int img_fd)
 
 
 			cj->peer = ue->peer;
-			cj->flags = ue->flags;
+			if (ue->flags & USK_INFLIGHT)
+				cj->type = CJ_STREAM_INFLIGHT;
+			else
+				cj->type = CJ_STREAM;
 			cj->fd = ue->fd;
 			cj->next = conn_jobs;
 			conn_jobs = cj;
-- 
1.6.5.2


More information about the CRIU mailing list