[CRIU] [PATCH] parasite: remove excessive header deps from parasite.h and friends

Kinsbursky Stanislav skinsbursky at openvz.org
Tue May 29 12:11:22 EDT 2012


From: Stanislav Kinsbursky <skinsbursky at openvz.org>

The task is not complete - this is just a part of what have to be done. I.e.
looks like a lot of excessive deps can be fixed.

Signed-off-by: Stanislav Kinsbursky <skinsbursky at openvz.org>
---
 cr-dump.c                  |    1 +
 files.c                    |    1 +
 include/parasite-syscall.h |   11 +++--------
 include/parasite.h         |    3 ---
 include/syscall-types.h    |    3 ---
 include/util.h             |    2 --
 kcmp-ids.c                 |    1 +
 namespaces.c               |    1 +
 netfilter.c                |    1 +
 parasite-syscall.c         |    5 +++++
 parasite.c                 |    2 ++
 pipes.c                    |    1 +
 proc_parse.c               |    2 ++
 shmem.c                    |    1 +
 sk-inet.c                  |    2 ++
 sk-tcp.c                   |    1 +
 sk-unix.c                  |    1 +
 sockets.c                  |   15 ---------------
 sysctl.c                   |    2 ++
 uts_ns.c                   |    1 +
 20 files changed, 26 insertions(+), 31 deletions(-)
-------------- next part --------------
diff --git a/cr-dump.c b/cr-dump.c
index ec0d049..4255554 100644
--- a/cr-dump.c
+++ b/cr-dump.c
@@ -15,6 +15,7 @@
 #include <sys/vfs.h>
 
 #include <sys/sendfile.h>
+#include <sys/mman.h>
 
 #include <linux/major.h>
 
diff --git a/files.c b/files.c
index 1aecd6f..c7eee1d 100644
--- a/files.c
+++ b/files.c
@@ -10,6 +10,7 @@
 #include <sys/stat.h>
 #include <sys/socket.h>
 #include <sys/un.h>
+#include <stdlib.h>
 
 #include "crtools.h"
 
diff --git a/include/parasite-syscall.h b/include/parasite-syscall.h
index d8e1259..6cf844e 100644
--- a/include/parasite-syscall.h
+++ b/include/parasite-syscall.h
@@ -1,14 +1,6 @@
 #ifndef PARASITE_SYSCALL_H_
 #define PARASITE_SYSCALL_H_
 
-#include <sys/types.h>
-#include <sys/mman.h>
-
-#include "compiler.h"
-#include "types.h"
-#include "list.h"
-#include "crtools.h"
-
 #define BUILTIN_SYSCALL_SIZE	8
 
 /* parasite control block */
@@ -29,6 +21,9 @@ struct parasite_ctl {
 	void *			addr_args;				/* address for arguments */
 };
 
+struct cr_fdset;
+struct list_head;
+
 extern int parasite_dump_sigacts_seized(struct parasite_ctl *ctl, struct cr_fdset *cr_fdset);
 extern int parasite_dump_itimers_seized(struct parasite_ctl *ctl, struct cr_fdset *cr_fdset);
 
diff --git a/include/parasite.h b/include/parasite.h
index 23773d1..3796505 100644
--- a/include/parasite.h
+++ b/include/parasite.h
@@ -8,11 +8,8 @@
 
 #ifndef __ASSEMBLY__
 
-#include <sys/types.h>
 #include <sys/un.h>
-#include <limits.h>
 
-#include "compiler.h"
 #include "image.h"
 #include "sockets.h"
 
diff --git a/include/syscall-types.h b/include/syscall-types.h
index 918c0fc..a4f0a00 100644
--- a/include/syscall-types.h
+++ b/include/syscall-types.h
@@ -8,13 +8,10 @@
 #ifndef SYSCALL_TYPES_H__
 #define SYSCALL_TYPES_H__
 
-#include <sys/types.h>
 #include <sys/time.h>
 #include <arpa/inet.h>
-#include <fcntl.h>
 
 #include "types.h"
-#include "compiler.h"
 
 #ifndef CONFIG_X86_64
 # error x86-32 bit mode not yet implemented
diff --git a/include/util.h b/include/util.h
index 714bfdd..851131a 100644
--- a/include/util.h
+++ b/include/util.h
@@ -4,8 +4,6 @@
 /*
  * Some bits are stolen from perf and kvm tools
  */
-#include <string.h>
-#include <stdlib.h>
 #include <signal.h>
 #include <stdio.h>
 #include <errno.h>
diff --git a/kcmp-ids.c b/kcmp-ids.c
index 028c774..6823586 100644
--- a/kcmp-ids.c
+++ b/kcmp-ids.c
@@ -1,4 +1,5 @@
 #include <unistd.h>
+#include <stdlib.h>
 #include "types.h"
 #include "rbtree.h"
 #include "util.h"
diff --git a/namespaces.c b/namespaces.c
index b925b7f..e3121ca 100644
--- a/namespaces.c
+++ b/namespaces.c
@@ -1,6 +1,7 @@
 #include <unistd.h>
 #include <fcntl.h>
 #include <sys/wait.h>
+#include <stdlib.h>
 #include "util.h"
 #include "syscall.h"
 #include "uts_ns.h"
diff --git a/netfilter.c b/netfilter.c
index e827c43..eebde5d 100644
--- a/netfilter.c
+++ b/netfilter.c
@@ -3,6 +3,7 @@
 #include <unistd.h>
 #include <string.h>
 #include <wait.h>
+#include <stdlib.h>
 
 #include "types.h"
 #include "util.h"
diff --git a/parasite-syscall.c b/parasite-syscall.c
index 64f6ab7..72a5a62 100644
--- a/parasite-syscall.c
+++ b/parasite-syscall.c
@@ -2,6 +2,7 @@
 
 #include <sys/stat.h>
 #include <sys/wait.h>
+#include <sys/mman.h>
 
 #include "syscall.h"
 #include "ptrace.h"
@@ -9,6 +10,10 @@
 #include "parasite-syscall.h"
 #include "parasite-blob.h"
 #include "parasite.h"
+#include "crtools.h"
+
+#include <string.h>
+#include <stdlib.h>
 
 #ifdef CONFIG_X86_64
 static const char code_syscall[] = {0x0f, 0x05, 0xcc, 0xcc,
diff --git a/parasite.c b/parasite.c
index fb1ddb7..9aa68bd 100644
--- a/parasite.c
+++ b/parasite.c
@@ -4,6 +4,8 @@
 #include "parasite.h"
 #include "util.h"
 
+#include <string.h>
+
 /*
  * Some notes on parasite code overall. There are a few
  * calling convention specfics the caller must follow
diff --git a/pipes.c b/pipes.c
index 80684f5..a9e73fa 100644
--- a/pipes.c
+++ b/pipes.c
@@ -2,6 +2,7 @@
 #include <sys/types.h>
 #include <sys/stat.h>
 #include <fcntl.h>
+#include <stdlib.h>
 
 #include "crtools.h"
 #include "image.h"
diff --git a/proc_parse.c b/proc_parse.c
index e6c2102..6ca23b9 100644
--- a/proc_parse.c
+++ b/proc_parse.c
@@ -16,6 +16,8 @@
 
 #include "proc_parse.h"
 
+#include <stdlib.h>
+
 struct buffer {
 	char buf[PAGE_SIZE];
 	char end; /* '\0' */
diff --git a/shmem.c b/shmem.c
index fea697f..dccc5c7 100644
--- a/shmem.c
+++ b/shmem.c
@@ -1,5 +1,6 @@
 #include <unistd.h>
 #include <sys/mman.h>
+#include <stdlib.h>
 
 #include "shmem.h"
 #include "image.h"
diff --git a/sk-inet.c b/sk-inet.c
index a193fed..d6abd7e 100644
--- a/sk-inet.c
+++ b/sk-inet.c
@@ -3,6 +3,8 @@
 #include <unistd.h>
 #include <netinet/tcp.h>
 #include <arpa/inet.h>
+#include <string.h>
+#include <stdlib.h>
 
 #include "types.h"
 #include "libnetlink.h"
diff --git a/sk-tcp.c b/sk-tcp.c
index c2e3f5a..dd31144 100644
--- a/sk-tcp.c
+++ b/sk-tcp.c
@@ -2,6 +2,7 @@
 #include <sys/ioctl.h>
 #include <linux/sockios.h>
 #include <unistd.h>
+#include <stdlib.h>
 
 #include "crtools.h"
 #include "util.h"
diff --git a/sk-unix.c b/sk-unix.c
index a6d109e..7950b84 100644
--- a/sk-unix.c
+++ b/sk-unix.c
@@ -5,6 +5,7 @@
 #include <sys/stat.h>
 #include <fcntl.h>
 #include <sys/un.h>
+#include <stdlib.h>
 
 #include "types.h"
 #include "libnetlink.h"
diff --git a/sockets.c b/sockets.c
index 9503334..df944f3 100644
--- a/sockets.c
+++ b/sockets.c
@@ -1,25 +1,10 @@
 #include <sys/socket.h>
 #include <linux/netlink.h>
-#include <linux/types.h>
-#include <linux/net.h>
-#include <sys/types.h>
-#include <sys/vfs.h>
-#include <sys/stat.h>
-#include <fcntl.h>
 #include <netinet/tcp.h>
-#include <errno.h>
-#include <unistd.h>
-#include <limits.h>
-#include <sys/sendfile.h>
 
-#include "types.h"
 #include "libnetlink.h"
 #include "sockets.h"
-#include "sk-queue.h"
 #include "unix_diag.h"
-#include "image.h"
-#include "crtools.h"
-#include "util.h"
 #include "inet_diag.h"
 #include "files.h"
 #include "util-net.h"
diff --git a/sysctl.c b/sysctl.c
index 51255a9..a7bb6e3 100644
--- a/sysctl.c
+++ b/sysctl.c
@@ -1,6 +1,8 @@
 #include <unistd.h>
 #include <fcntl.h>
 #include <ctype.h>
+#include <string.h>
+#include <stdlib.h>
 
 #include "types.h"
 #include "sysctl.h"
diff --git a/uts_ns.c b/uts_ns.c
index b739158..ff89e34 100644
--- a/uts_ns.c
+++ b/uts_ns.c
@@ -1,6 +1,7 @@
 #include <unistd.h>
 #include <fcntl.h>
 #include <sys/utsname.h>
+#include <string.h>
 
 #include "util.h"
 #include "crtools.h"


More information about the CRIU mailing list