[CRIU] [PATCH 04/15] shmem: don't include restorer.h in shmem.c

Andrey Vagin avagin at openvz.org
Tue Nov 5 00:32:57 PST 2013


Signed-off-by: Andrey Vagin <avagin at openvz.org>
---
 include/bug.h      |  1 +
 include/restorer.h | 31 +------------------------------
 include/shmem.h    | 31 +++++++++++++++++++++++++++++++
 shmem.c            |  1 -
 4 files changed, 33 insertions(+), 31 deletions(-)

diff --git a/include/bug.h b/include/bug.h
index 920abda..8330fed 100644
--- a/include/bug.h
+++ b/include/bug.h
@@ -3,6 +3,7 @@
 
 #include <signal.h>
 
+#include "compiler.h"
 #include "log.h"
 
 #ifndef BUG_ON_HANDLER
diff --git a/include/restorer.h b/include/restorer.h
index 6ddf8fe..53d8e6c 100644
--- a/include/restorer.h
+++ b/include/restorer.h
@@ -15,6 +15,7 @@
 #include "asm/restorer.h"
 
 #include "posix-timer.h"
+#include "shmem.h"
 #include "vdso.h"
 
 #include <time.h>
@@ -152,23 +153,6 @@ static inline unsigned long restorer_stack(struct thread_restore_args *a)
 	return RESTORE_ALIGN_STACK((long)a->mem_zone.stack, RESTORE_STACK_SIZE);
 }
 
-/*
- * pid is a pid of a creater
- * start, end are used for open mapping
- * fd is a file discriptor, which is valid for creater,
- * it's opened in cr-restor, because pgoff may be non zero
- */
-
-struct shmem_info {
-	unsigned long	shmid;
-	unsigned long	start;
-	unsigned long	end;
-	unsigned long	size;
-	int		pid;
-	int		fd;
-	futex_t		lock;
-};
-
 #define TASK_ENTRIES_SIZE 4096
 
 enum {
@@ -194,19 +178,6 @@ struct task_entries {
 	mutex_t	zombie_lock;
 };
 
-static always_inline struct shmem_info *
-find_shmem(struct shmem_info *shmems, int nr, unsigned long shmid)
-{
-	struct shmem_info *si;
-	int i;
-
-	for (i = 0, si = shmems; i < nr; i++, si++)
-		if (si->shmid == shmid)
-			return si;
-
-	return NULL;
-}
-
 #define restore_finish_stage(__stage) ({				\
 		futex_dec_and_wake(&task_entries->nr_in_progress);	\
 		futex_wait_while(&task_entries->start, __stage);	\
diff --git a/include/shmem.h b/include/shmem.h
index 9594e69..6369e50 100644
--- a/include/shmem.h
+++ b/include/shmem.h
@@ -1,8 +1,26 @@
 #ifndef __CR_SHMEM_H__
 #define __CR_SHMEM_H__
 
+#include "lock.h"
+
 #include "protobuf/vma.pb-c.h"
 
+/*
+ * pid is a pid of a creater
+ * start, end are used for open mapping
+ * fd is a file discriptor, which is valid for creater,
+ * it's opened in cr-restor, because pgoff may be non zero
+ */
+struct shmem_info {
+	unsigned long	shmid;
+	unsigned long	start;
+	unsigned long	end;
+	unsigned long	size;
+	int		pid;
+	int		fd;
+	futex_t		lock;
+};
+
 int prepare_shmem_pid(int pid);
 int prepare_shmem_restore(void);
 void show_saved_shmems(void);
@@ -14,4 +32,17 @@ extern unsigned int rst_shmems;
 int cr_dump_shmem(void);
 int add_shmem_area(pid_t pid, VmaEntry *vma);
 
+static always_inline struct shmem_info *
+find_shmem(struct shmem_info *shmems, int nr, unsigned long shmid)
+{
+	struct shmem_info *si;
+	int i;
+
+	for (i = 0, si = shmems; i < nr; i++, si++)
+		if (si->shmid == shmid)
+			return si;
+
+	return NULL;
+}
+
 #endif /* __CR_SHMEM_H__ */
diff --git a/shmem.c b/shmem.c
index e88287f..843073c 100644
--- a/shmem.c
+++ b/shmem.c
@@ -5,7 +5,6 @@
 #include "shmem.h"
 #include "image.h"
 #include "crtools.h"
-#include "restorer.h"
 #include "page-pipe.h"
 #include "page-xfer.h"
 #include "rst-malloc.h"
-- 
1.8.3.1



More information about the CRIU mailing list