[CRIU] [PATCH 3/3] soccr: rectify Alpine build

Dmitry Safonov dsafonov at virtuozzo.com
Mon Sep 26 08:18:21 PDT 2016


Made a symlink to CRIU's generated config.h, played with
moving some code to soccr.h header.
Changed types from u32 to uint32_t, otherwise we should
include CRIU's "int.h" in soccr, but I'm lazy to add that.

Cc: Pavel Emelyanov <xemul at virtuozzo.com>
Cc: Cyrill Gorcunov <gorcunov at openvz.org>
Signed-off-by: Dmitry Safonov <dsafonov at virtuozzo.com>
---
 criu/sk-tcp.c  | 39 ---------------------------------------
 soccr/config.h |  1 +
 soccr/soccr.c  | 13 -------------
 soccr/soccr.h  | 43 +++++++++++++++++++++++++++++++++++++++++++
 4 files changed, 44 insertions(+), 52 deletions(-)
 create mode 120000 soccr/config.h

diff --git a/criu/sk-tcp.c b/criu/sk-tcp.c
index 0d48060f2432..46b59ceef0f1 100644
--- a/criu/sk-tcp.c
+++ b/criu/sk-tcp.c
@@ -28,45 +28,6 @@
 #include "protobuf.h"
 #include "images/tcp-stream.pb-c.h"
 
-#ifndef CONFIG_HAS_TCP_REPAIR_WINDOW
-struct tcp_repair_window {
-	u32   snd_wl1;
-	u32   snd_wnd;
-	u32   max_window;
-
-	u32   rcv_wnd;
-	u32   rcv_wup;
-};
-#endif
-
-#ifndef CONFIG_HAS_TCP_REPAIR
-/*
- * It's been reported that both tcp_repair_opt
- * and TCP_ enum already shipped in netinet/tcp.h
- * system header by some distros thus we need a
- * test if we can use predefined ones or provide
- * our own.
- */
-struct tcp_repair_opt {
-	u32	opt_code;
-	u32	opt_val;
-};
-
-enum {
-	TCP_NO_QUEUE,
-	TCP_RECV_QUEUE,
-	TCP_SEND_QUEUE,
-	TCP_QUEUES_NR,
-};
-#endif
-
-#ifndef TCP_TIMESTAMP
-#define TCP_TIMESTAMP	24
-#endif
-
-#ifndef TCP_REPAIR_WINDOW
-#define TCP_REPAIR_WINDOW       29
-#endif
 
 static LIST_HEAD(cpt_tcp_repair_sockets);
 static LIST_HEAD(rst_tcp_repair_sockets);
diff --git a/soccr/config.h b/soccr/config.h
new file mode 120000
index 000000000000..106aa8bf2be0
--- /dev/null
+++ b/soccr/config.h
@@ -0,0 +1 @@
+../criu/include/config.h
\ No newline at end of file
diff --git a/soccr/soccr.c b/soccr/soccr.c
index c27ba66e8ee0..7c6bfb199a91 100644
--- a/soccr/soccr.c
+++ b/soccr/soccr.c
@@ -11,19 +11,6 @@
 #define SIOCOUTQNSD     0x894B
 #endif
 
-#ifndef TCP_REPAIR_WINDOW
-#define TCP_REPAIR_WINDOW       29
-#endif
-
-struct tcp_repair_window {
-	__u32   snd_wl1;
-	__u32   snd_wnd;
-	__u32   max_window;
-
-	__u32   rcv_wnd;
-	__u32   rcv_wup;
-};
-
 static void (*log)(unsigned int loglevel, const char *format, ...)
 	__attribute__ ((__format__ (__printf__, 2, 3)));
 static unsigned int log_level = 0;
diff --git a/soccr/soccr.h b/soccr/soccr.h
index c75f7766e946..4e272d56734d 100644
--- a/soccr/soccr.h
+++ b/soccr/soccr.h
@@ -1,6 +1,49 @@
 #ifndef __LIBSOCCR_H__
 #define __LIBSOCCR_H__
 #include <linux/types.h>
+#include <stdint.h>
+
+#include "config.h"
+
+#ifndef CONFIG_HAS_TCP_REPAIR_WINDOW
+struct tcp_repair_window {
+	uint32_t   snd_wl1;
+	uint32_t   snd_wnd;
+	uint32_t   max_window;
+
+	uint32_t   rcv_wnd;
+	uint32_t   rcv_wup;
+};
+#endif
+
+#ifndef CONFIG_HAS_TCP_REPAIR
+/*
+ * It's been reported that both tcp_repair_opt
+ * and TCP_ enum already shipped in netinet/tcp.h
+ * system header by some distros thus we need a
+ * test if we can use predefined ones or provide
+ * our own.
+ */
+struct tcp_repair_opt {
+	uint32_t	opt_code;
+	uint32_t	opt_val;
+};
+
+enum {
+	TCP_NO_QUEUE,
+	TCP_RECV_QUEUE,
+	TCP_SEND_QUEUE,
+	TCP_QUEUES_NR,
+};
+#endif
+
+#ifndef TCP_TIMESTAMP
+#define TCP_TIMESTAMP	24
+#endif
+
+#ifndef TCP_REPAIR_WINDOW
+#define TCP_REPAIR_WINDOW       29
+#endif
 
 struct libsoccr_sk;
 
-- 
2.10.0



More information about the CRIU mailing list