[CRIU] [PATCH 12/15] crtools: don't include image.h in crtools.h

Andrey Vagin avagin at openvz.org
Mon Nov 4 22:00:34 PST 2013


Signed-off-by: Andrey Vagin <avagin at openvz.org>
---
 cr-service.c        |  1 +
 eventpoll.c         |  2 +-
 include/crtools.h   | 32 --------------------------------
 include/image.h     | 11 +++++++++++
 include/pstree.h    | 25 ++++++++++++++++++++++++-
 include/servicefd.h |  2 ++
 page-read.c         |  4 ++--
 page-xfer.c         |  1 +
 protobuf.c          |  1 +
 stats.c             |  5 ++++-
 10 files changed, 47 insertions(+), 37 deletions(-)

diff --git a/cr-service.c b/cr-service.c
index 264ee54..0bf5732 100644
--- a/cr-service.c
+++ b/cr-service.c
@@ -15,6 +15,7 @@
 
 #include "crtools.h"
 #include "util-pie.h"
+#include "image.h"
 #include "log.h"
 #include "cr-service.h"
 
diff --git a/eventpoll.c b/eventpoll.c
index e80597c..b43c0de 100644
--- a/eventpoll.c
+++ b/eventpoll.c
@@ -16,7 +16,7 @@
 #include "asm/types.h"
 #include "eventpoll.h"
 #include "proc_parse.h"
-#include "crtools.h"
+#include "pstree.h"
 #include "image.h"
 #include "util.h"
 #include "log.h"
diff --git a/include/crtools.h b/include/crtools.h
index 3609c75..f0888cc 100644
--- a/include/crtools.h
+++ b/include/crtools.h
@@ -7,7 +7,6 @@
 #include "asm/types.h"
 #include "list.h"
 #include "util.h"
-#include "image.h"
 #include "lock.h"
 #include "cr-show.h"
 #include "servicefd.h"
@@ -57,15 +56,10 @@ void kill_inventory(void);
 
 extern void print_data(unsigned long addr, unsigned char *data, size_t size);
 extern void print_image_data(int fd, unsigned int length, int show);
-extern struct cr_fd_desc_tmpl fdset_template[CR_FD_MAX];
 
 extern int open_image_dir(void);
 extern void close_image_dir(void);
 
-int open_image_at(int dfd, int type, unsigned long flags, ...);
-#define open_image(typ, flags, ...) open_image_at(get_service_fd(IMG_FD_OFF), typ, flags, ##__VA_ARGS__)
-int open_pages_image(unsigned long flags, int pm_fd);
-int open_pages_image_at(int dfd, unsigned long flags, int pm_fd);
 void up_page_ids_base(void);
 
 #define LAST_PID_PATH		"/proc/sys/kernel/ns_last_pid"
@@ -96,10 +90,6 @@ int convert_to_elf(char *elf_path, int fd_core);
 int cr_check(void);
 int cr_exec(int pid, char **opts);
 
-#define O_DUMP	(O_RDWR | O_CREAT | O_EXCL)
-#define O_SHOW	(O_RDONLY)
-#define O_RSTR	(O_RDONLY)
-
 struct cr_fdset *cr_task_fdset_open(int pid, int mode);
 struct cr_fdset *cr_fdset_open_range(int pid, int from, int to,
 			       unsigned long flags);
@@ -119,28 +109,6 @@ struct fdt {
 	futex_t			fdt_lock;
 };
 
-struct rst_info {
-	struct list_head	fds;
-	struct list_head	eventpoll;
-	struct list_head	tty_slaves;
-
-	void			*premmapped_addr;
-	unsigned long		premmapped_len;
-	unsigned long		clone_flags;
-
-	void			*munmap_restorer;
-
-	int			nr_zombies;
-
-	int service_fd_id;
-	struct fdt		*fdt;
-
-	union {
-		struct pstree_item	*pgrp_leader;
-		futex_t			pgrp_set;
-	};
-};
-
 /*
  * When we have to restore a shared resource, we mush select which
  * task should do it, and make other(s) wait for it. In order to
diff --git a/include/image.h b/include/image.h
index fe6eb91..c9669c0 100644
--- a/include/image.h
+++ b/include/image.h
@@ -60,7 +60,18 @@
 
 #define CR_PARENT_LINK "parent"
 
+#define O_DUMP	(O_RDWR | O_CREAT | O_EXCL)
+#define O_SHOW	(O_RDONLY)
+#define O_RSTR	(O_RDONLY)
+
+int open_image_at(int dfd, int type, unsigned long flags, ...);
+#define open_image(typ, flags, ...) open_image_at(get_service_fd(IMG_FD_OFF), typ, flags, ##__VA_ARGS__)
+int open_pages_image(unsigned long flags, int pm_fd);
+int open_pages_image_at(int dfd, unsigned long flags, int pm_fd);
+
 extern bool fdinfo_per_id;
 extern bool ns_per_id;
 
+extern struct cr_fd_desc_tmpl fdset_template[CR_FD_MAX];
+
 #endif /* __CR_IMAGE_H__ */
diff --git a/include/pstree.h b/include/pstree.h
index b80d5b1..53b0520 100644
--- a/include/pstree.h
+++ b/include/pstree.h
@@ -3,7 +3,8 @@
 
 #include "list.h"
 #include "types.h"
-#include "crtools.h"
+#include "image.h"
+#include "lock.h"
 #include "protobuf/core.pb-c.h"
 
 /*
@@ -12,6 +13,28 @@
  */
 #define INIT_PID	(1)
 
+struct rst_info {
+	struct list_head	fds;
+	struct list_head	eventpoll;
+	struct list_head	tty_slaves;
+
+	void			*premmapped_addr;
+	unsigned long		premmapped_len;
+	unsigned long		clone_flags;
+
+	void			*munmap_restorer;
+
+	int			nr_zombies;
+
+	int service_fd_id;
+	struct fdt		*fdt;
+
+	union {
+		struct pstree_item	*pgrp_leader;
+		futex_t			pgrp_set;
+	};
+};
+
 struct pstree_item {
 	struct pstree_item	*parent;
 	struct list_head	children;	/* list of my children */
diff --git a/include/servicefd.h b/include/servicefd.h
index 3c7d07c..4bf83a0 100644
--- a/include/servicefd.h
+++ b/include/servicefd.h
@@ -1,6 +1,8 @@
 #ifndef __CR_SERVICE_FD_H__
 #define __CR_SERVICE_FD_H__
 
+#include <stdbool.h>
+
 enum sfd_type {
 	SERVICE_FD_MIN,
 
diff --git a/page-read.c b/page-read.c
index dff6b62..874c075 100644
--- a/page-read.c
+++ b/page-read.c
@@ -2,9 +2,9 @@
 #include <stdio.h>
 #include <unistd.h>
 
-#include "crtools.h"
 #include "servicefd.h"
 #include "page-read.h"
+#include "image.h"
 
 #include "protobuf.h"
 #include "protobuf/pagemap.pb-c.h"
@@ -12,7 +12,7 @@
 static int get_page_vaddr(struct page_read *pr, struct iovec *iov)
 {
 	int ret;
-	__u64 img_va;
+	u64 img_va;
 
 	ret = read_img_eof(pr->fd_pg, &img_va);
 	if (ret <= 0)
diff --git a/page-xfer.c b/page-xfer.c
index 087595f..c16d749 100644
--- a/page-xfer.c
+++ b/page-xfer.c
@@ -3,6 +3,7 @@
 #include <arpa/inet.h>
 #include <unistd.h>
 
+#include "image.h"
 #include "crtools.h"
 #include "page-xfer.h"
 #include "page-pipe.h"
diff --git a/protobuf.c b/protobuf.c
index c60886e..10c844c 100644
--- a/protobuf.c
+++ b/protobuf.c
@@ -13,6 +13,7 @@
 #include "asm/types.h"
 #include "log.h"
 #include "util.h"
+#include "image.h"
 #include "string.h"
 #include "sockets.h"
 
diff --git a/stats.c b/stats.c
index af3e574..d15bd95 100644
--- a/stats.c
+++ b/stats.c
@@ -1,8 +1,11 @@
 #include <unistd.h>
 #include <sys/time.h>
+
+#include "asm/atomic.h"
 #include "protobuf.h"
 #include "stats.h"
-#include "crtools.h"
+#include "image.h"
+#include "servicefd.h"
 #include "protobuf/stats.pb-c.h"
 
 struct timing {
-- 
1.8.3.1



More information about the CRIU mailing list