2
0
mirror of https://github.com/checkpoint-restore/criu synced 2025-08-31 14:25:49 +00:00

cleanup: parasite - Drop PARASITE_CMD_RESTORECORE

Signed-off-by: Cyrill Gorcunov <gorcunov@gmail.com>
This commit is contained in:
Cyrill Gorcunov
2011-11-14 18:50:20 +04:00
parent ce40f5d96f
commit 5ae9d9feb8
2 changed files with 0 additions and 75 deletions

View File

@@ -32,7 +32,6 @@ enum {
PARASITE_CMD_KILLME,
PARASITE_CMD_PINGME,
PARASITE_CMD_DUMPPAGES,
PARASITE_CMD_RESTORECORE,
PARASITE_CMD_MAX,
};

View File

@@ -76,77 +76,6 @@ static void sys_write_msg(const char *msg)
sys_write(1, msg, size);
}
static int restore_core(char *corefile)
{
int ret = PARASITE_ERR_FAIL;
int fd_core;
fd_core = (int)sys_open(corefile, O_RDONLY, 0600);
if (fd_core < 0) {
ret = PARASITE_ERR_OPEN;
goto err_open;
}
/* Skip the header */
sys_lseek(fd_core, GET_FILE_OFF_AFTER(struct core_entry), SEEK_SET);
/* First VMA areas */
while (1) {
unsigned long addr;
ret = sys_read(fd_core, &vma, sizeof(vma));
if (ret && ret != sizeof(vma)) {
ret = PARASITE_ERR_CORE_VMA;
goto err;
}
if (vma.start == 0 && vma.end == 0)
break;
/* Make sure it's mapped into proper place */
addr = sys_mmap((void *)vma.start,
vma.end - vma.start,
vma.prot,
vma.flags | MAP_FIXED,
vma.fd,
vma.pgoff);
if (addr != vma.start) {
ret = PARASITE_ERR_MMAP;
goto err;
}
}
/* Now pages */
while (1) {
unsigned long count;
ret = sys_read(fd_core, &page.va, sizeof(page.va));
if (ret && ret != sizeof(page.va)) {
ret = PARASITE_ERR_CORE_PAGE;
goto err;
}
if (page.va == 0)
break;
ret = sys_read(fd_core, page.data, sizeof(page.data));
if (ret && ret != sizeof(page.data)) {
ret = PARASITE_ERR_CORE_PAGE;
goto err;
}
inline_memcpy((void *)page.va, page.data, sizeof(page.data));
}
ret = 0;
err:
sys_close(fd_core);
err_open:
return ret;
}
/*
* This is the main page dumping routine, it's executed
* inside a victim process space.
@@ -285,9 +214,6 @@ static int __used parasite_service(unsigned long cmd, void *args, void *brk)
case PARASITE_CMD_DUMPPAGES:
return dump_pages((parasite_args_cmd_dumppages_t *)args);
break;
case PARASITE_CMD_RESTORECORE:
return restore_core((char *)args);
break;
default:
sys_write_msg("Unknown command to parasite\n");
break;