[CRIU] [crtools-bot for Cyrill Gorcunov ] files: Rename prepare_fdinfo_global to prepare_shared_fdinfo

Cyrill Gorcunov gorcunov at openvz.org
Tue Feb 28 10:13:47 EST 2012


The commit is pushed to "master" and will appear on git://github.com/cyrillos/crtools.git
------>
commit 8b187454b49d5b93fa4ec6376b658f8f45399657
Author: Cyrill Gorcunov <gorcunov at openvz.org>
Date:   Wed Feb 22 18:51:27 2012 +0400

    files: Rename prepare_fdinfo_global to prepare_shared_fdinfo
    
    This function simply allocates shared memory. Name it so
    and move it closer to the variables it referes on.
    
    Signed-off-by: Cyrill Gorcunov <gorcunov at openvz.org>
    Acked-by: Pavel Emelyanov <xemul at parallels.com>
---
 cr-restore.c    |    2 +-
 files.c         |   32 ++++++++++++++++----------------
 include/files.h |    2 +-
 3 files changed, 18 insertions(+), 18 deletions(-)

diff --git a/cr-restore.c b/cr-restore.c
index 3982154..4d281f1 100644
--- a/cr-restore.c
+++ b/cr-restore.c
@@ -400,7 +400,7 @@ static int prepare_shared(int ps_fd)
 		return -1;
 	}
 
-	if (prepare_fdinfo_global())
+	if (prepare_shared_fdinfo())
 		return -1;
 
 	while (1) {
diff --git a/files.c b/files.c
index 73be79f..56b3311 100644
--- a/files.c
+++ b/files.c
@@ -28,6 +28,22 @@ static int nr_fdinfo_list;
 
 static struct fmap_fd *fmap_fds;
 
+int prepare_shared_fdinfo(void)
+{
+	fdinfo_descs = mmap(NULL, 4096, PROT_READ | PROT_WRITE, MAP_SHARED | MAP_ANON, 0, 0);
+	if (fdinfo_descs == MAP_FAILED) {
+		pr_perror("Can't map fdinfo_descs");
+		return -1;
+	}
+
+	fdinfo_list = mmap(NULL, 4096, PROT_READ | PROT_WRITE, MAP_SHARED | MAP_ANON, 0, 0);
+	if (fdinfo_list == MAP_FAILED) {
+		pr_perror("Can't map fdinfo_list");
+		return -1;
+	}
+	return 0;
+}
+
 static struct fdinfo_desc *find_fd(char *id)
 {
 	struct fdinfo_desc *fi;
@@ -54,22 +70,6 @@ static int get_file_path(char *path, struct fdinfo_entry *fe, int fd)
 	return 0;
 }
 
-int prepare_fdinfo_global()
-{
-	fdinfo_descs = mmap(NULL, 4096, PROT_READ | PROT_WRITE, MAP_SHARED | MAP_ANON, 0, 0);
-	if (fdinfo_descs == MAP_FAILED) {
-		pr_perror("Can't map fdinfo_descs");
-		return -1;
-	}
-
-	fdinfo_list = mmap(NULL, 4096, PROT_READ | PROT_WRITE, MAP_SHARED | MAP_ANON, 0, 0);
-	if (fdinfo_list == MAP_FAILED) {
-		pr_perror("Can't map fdinfo_list");
-		return -1;
-	}
-	return 0;
-}
-
 static int collect_fd(int pid, struct fdinfo_entry *e)
 {
 	int i;
diff --git a/include/files.h b/include/files.h
index 3b203be..f311e93 100644
--- a/include/files.h
+++ b/include/files.h
@@ -39,7 +39,7 @@ struct fdinfo_list_entry {
 
 extern int prepare_fds(int pid);
 extern int prepare_fd_pid(int pid);
-extern int prepare_fdinfo_global(void);
+extern int prepare_shared_fdinfo(void);
 extern int try_fixup_file_map(int pid, struct vma_entry *vma_entry, int fd);
 
 #endif /* FILES_H_ */


More information about the CRIU mailing list