[CRIU] [crtools-bot] sockets: Replace sockets conn job flags with type

Cyrill Gorcunov gorcunov at openvz.org
Tue Feb 7 08:27:16 EST 2012


The commit is pushed to "master" and will appear on git://github.com/cyrillos/crtools.git
--------------->
commit 23cf6f84d9a879aa28316f177d50b85aafd6eac3
Author: Pavel Emelyanov <xemul at parallels.com>
Date:   Tue Feb 7 15:54:03 2012 +0400

    sockets: Replace sockets conn job flags with type
    
    Required for simpler future patching.
    
    Signed-off-by: Pavel Emelyanov <xemul at parallels.com>
    Signed-off-by: Cyrill Gorcunov <gorcunov at openvz.org>
---
 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;


More information about the CRIU mailing list