[CRIU] [crtools-bot for Kinsbursky Stanislav ] restore: shmid_id structure from find_shmem_id() function

Cyrill Gorcunov gorcunov at openvz.org
Wed Feb 15 04:30:34 EST 2012


The commit is pushed to "master" and will appear on git://github.com/cyrillos/crtools.git
------>
commit a5c6c02f49063d5015d266afbd9e09758855d19f
Author: Kinsbursky Stanislav <skinsbursky at openvz.org>
Date:   Tue Feb 14 20:19:56 2012 +0300

    restore: shmid_id structure from find_shmem_id() function
    
    Returning shmid value of not enough, because SYSV IPC shmid equal to zero is a
    valid value.
    
    Signed-off-by: Stanislav Kinsbursky <skinsbursky at openvz.org>
    Acked-by: Pavel Emelyanov <xemul at parallels.com>
    Signed-off-by: Cyrill Gorcunov <gorcunov at openvz.org>
---
 cr-restore.c |   14 +++++++-------
 1 files changed, 7 insertions(+), 7 deletions(-)

diff --git a/cr-restore.c b/cr-restore.c
index 4c3c75b..3613d7b 100644
--- a/cr-restore.c
+++ b/cr-restore.c
@@ -440,15 +440,15 @@ static int prepare_shared(int ps_fd)
 	return ret;
 }
 
-static unsigned long find_shmem_id(unsigned long addr)
+static struct shmem_id *find_shmem_id(unsigned long addr)
 {
 	struct shmem_id *si;
 
 	for (si = shmem_ids; si; si = si->next)
 		if (si->addr <= addr && si->end >= addr)
-			return si->shmid;
+			return si;
 
-	return 0;
+	return NULL;
 }
 
 static int save_shmem_id(struct shmem_entry *e)
@@ -529,13 +529,13 @@ find_shmem_page(struct shmems *shms, unsigned long addr, unsigned long shmid)
 static int try_fixup_shared_map(int pid, struct vma_entry *vi, int fd)
 {
 	struct shmem_info *si;
-	unsigned long shmid;
+	struct shmem_id *shmid;
 
 	shmid = find_shmem_id(vi->start);
 	if (!shmid)
 		return 0;
 
-	si = find_shmem(shmems, vi->start, shmid);
+	si = find_shmem(shmems, vi->start, shmid->shmid);
 	pr_info("%d: Search for %016lx shmem %p/%d\n", pid, vi->start, si, si ? si->pid : -1);
 
 	if (!si) {
@@ -610,7 +610,7 @@ static int fixup_vma_fds(int pid, int fd)
 static inline bool should_restore_page(int pid, unsigned long va)
 {
 	struct shmem_info *si;
-	unsigned long shmid;
+	struct shmem_id *shmid;
 
 	/*
 	 * If this is not a shmem virtual address
@@ -620,7 +620,7 @@ static inline bool should_restore_page(int pid, unsigned long va)
 	if (!shmid)
 		return true;
 
-	si = find_shmem_page(shmems, va, shmid);
+	si = find_shmem_page(shmems, va, shmid->shmid);
 	return si->pid == pid;
 }
 


More information about the CRIU mailing list