[CRIU] [PATCH 2/4] mount: mount functions about mounts from proc_parse.h

Andrei Vagin avagin at openvz.org
Tue Aug 16 08:22:23 PDT 2016


From: Andrei Vagin <avagin at virtuozzo.com>

It breaks a dependecy between  proc_parse.h and mount.c.

Signed-off-by: Andrei Vagin <avagin at virtuozzo.com>
---
 criu/include/mount.h       | 25 +++++++++++++++++++++++++
 criu/include/proc_parse.h  | 26 --------------------------
 criu/include/sysfs_parse.h |  3 +++
 criu/mount.c               |  1 -
 4 files changed, 28 insertions(+), 27 deletions(-)

diff --git a/criu/include/mount.h b/criu/include/mount.h
index d3f472d..a266cd0 100644
--- a/criu/include/mount.h
+++ b/criu/include/mount.h
@@ -128,4 +128,29 @@ extern int mntns_maybe_create_roots(void);
 extern int read_mnt_ns_img(void);
 extern void cleanup_mnt_ns(void);
 
+struct mount_info;
+typedef int (*mount_fn_t)(struct mount_info *mi, const char *src, const
+			  char *fstype, unsigned long mountflags);
+
+struct fstype {
+	char *name;
+	int code;
+	int (*dump)(struct mount_info *pm);
+	int (*restore)(struct mount_info *pm);
+	int (*parse)(struct mount_info *pm);
+	mount_fn_t mount;
+};
+
+extern bool add_skip_mount(const char *mountpoint);
+struct ns_id;
+extern struct mount_info *parse_mountinfo(pid_t pid, struct ns_id *nsid, bool for_dump);
+
+/* callback for AUFS support */
+extern int aufs_parse(struct mount_info *mi);
+
+/* callback for OverlayFS support */
+extern int overlayfs_parse(struct mount_info *mi);
+
+extern int check_mnt_id(void);
+
 #endif /* __CR_MOUNT_H__ */
diff --git a/criu/include/proc_parse.h b/criu/include/proc_parse.h
index 4bc0ffa..889aee1 100644
--- a/criu/include/proc_parse.h
+++ b/criu/include/proc_parse.h
@@ -103,26 +103,8 @@ struct proc_status_creds {
 bool proc_status_creds_dumpable(struct proc_status_creds *parent,
 				struct proc_status_creds *child);
 
-struct mount_info;
-typedef int (*mount_fn_t)(struct mount_info *mi, const char *src, const
-			  char *fstype, unsigned long mountflags);
-
-struct fstype {
-	char *name;
-	int code;
-	int (*dump)(struct mount_info *pm);
-	int (*restore)(struct mount_info *pm);
-	int (*parse)(struct mount_info *pm);
-	mount_fn_t mount;
-};
-
-struct vm_area_list;
-
 #define INVALID_UID ((uid_t)-1)
 
-extern bool add_skip_mount(const char *mountpoint);
-struct ns_id;
-extern struct mount_info *parse_mountinfo(pid_t pid, struct ns_id *nsid, bool for_dump);
 extern int parse_pid_stat(pid_t pid, struct proc_pid_stat *s);
 extern unsigned int parse_pid_loginuid(pid_t pid, int *err, bool ignore_noent);
 extern int parse_pid_oom_score_adj(pid_t pid, int *err);
@@ -180,8 +162,6 @@ extern int get_fd_mntid(int fd, int *mnt_id);
 struct pid;
 extern int parse_threads(int pid, struct pid **_t, int *_n);
 
-extern int check_mnt_id(void);
-
 /*
  * This struct describes a group controlled by one controller.
  * The @name is the controller name or 'name=...' for named cgroups.
@@ -205,12 +185,6 @@ extern void put_ctls(struct list_head *);
 
 int collect_controllers(struct list_head *cgroups, unsigned int *n_cgroups);
 
-/* callback for AUFS support */
-extern int aufs_parse(struct mount_info *mi);
-
-/* callback for OverlayFS support */
-extern int overlayfs_parse(struct mount_info *mi);
-
 int parse_children(pid_t pid, pid_t **_c, int *_n);
 
 #endif /* __CR_PROC_PARSE_H__ */
diff --git a/criu/include/sysfs_parse.h b/criu/include/sysfs_parse.h
index 3d49b4c..3ba06ed 100644
--- a/criu/include/sysfs_parse.h
+++ b/criu/include/sysfs_parse.h
@@ -6,6 +6,9 @@
 #define SBINFO_PATH_LEN	(sizeof SYSFS_AUFS + SBINFO_LEN) /* /sys/fs/aufs/<sbinfo> */
 #define AUFSBR_PATH_LEN	(SBINFO_PATH_LEN + 6 + 1)	/* /sys/fs/aufs/<sbinfo>/br%3d */
 
+struct mount_info;
+struct vma_area;
+
 extern int parse_aufs_branches(struct mount_info *mi);
 extern int fixup_aufs_vma_fd(struct vma_area *vma, int vm_file_fd);
 extern void free_aufs_branches(void);
diff --git a/criu/mount.c b/criu/mount.c
index a995d84..c39d58c 100644
--- a/criu/mount.c
+++ b/criu/mount.c
@@ -21,7 +21,6 @@
 #include "plugin.h"
 #include "mount.h"
 #include "pstree.h"
-#include "proc_parse.h"
 #include "image.h"
 #include "namespaces.h"
 #include "protobuf.h"
-- 
2.7.4



More information about the CRIU mailing list