mirror of
https://github.com/checkpoint-restore/criu
synced 2025-09-01 06:45:35 +00:00
crtools: move all stuff about vma together
Signed-off-by: Andrey Vagin <avagin@openvz.org> Signed-off-by: Pavel Emelyanov <xemul@parallels.com>
This commit is contained in:
committed by
Pavel Emelyanov
parent
824403a009
commit
0d1dfc2e08
@@ -1,6 +1,7 @@
|
||||
#include <sys/types.h>
|
||||
|
||||
#include "vdso.h"
|
||||
#include "vma.h"
|
||||
#include "log.h"
|
||||
|
||||
#ifdef LOG_PREFIX
|
||||
|
@@ -15,6 +15,7 @@
|
||||
#include "compiler.h"
|
||||
#include "crtools.h"
|
||||
#include "vdso.h"
|
||||
#include "vma.h"
|
||||
#include "log.h"
|
||||
|
||||
#ifdef LOG_PREFIX
|
||||
|
@@ -15,12 +15,12 @@
|
||||
#include "parasite-syscall.h"
|
||||
#include "parasite.h"
|
||||
#include "compiler.h"
|
||||
#include "crtools.h"
|
||||
#include "kerndat.h"
|
||||
#include "vdso.h"
|
||||
#include "util.h"
|
||||
#include "log.h"
|
||||
#include "mem.h"
|
||||
#include "vma.h"
|
||||
|
||||
#ifdef LOG_PREFIX
|
||||
# undef LOG_PREFIX
|
||||
|
@@ -66,6 +66,7 @@
|
||||
#include "page-pipe.h"
|
||||
#include "posix-timer.h"
|
||||
#include "vdso.h"
|
||||
#include "vma.h"
|
||||
#include "cr-service.h"
|
||||
|
||||
#include "asm/dump.h"
|
||||
|
@@ -3,6 +3,7 @@
|
||||
#include "crtools.h"
|
||||
#include "ptrace.h"
|
||||
#include "parasite-syscall.h"
|
||||
#include "vma.h"
|
||||
|
||||
struct syscall_exec_desc {
|
||||
char *name;
|
||||
|
@@ -63,6 +63,7 @@
|
||||
#include "vdso.h"
|
||||
#include "stats.h"
|
||||
#include "tun.h"
|
||||
#include "vma.h"
|
||||
#include "kerndat.h"
|
||||
#include "rst-malloc.h"
|
||||
|
||||
|
@@ -111,34 +111,6 @@ struct cr_fdset *cr_glob_fdset_open(int mode);
|
||||
|
||||
void close_cr_fdset(struct cr_fdset **cr_fdset);
|
||||
|
||||
struct vm_area_list {
|
||||
struct list_head h;
|
||||
unsigned nr;
|
||||
unsigned long priv_size; /* nr of pages in private VMAs */
|
||||
unsigned long longest; /* nr of pages in longest VMA */
|
||||
};
|
||||
|
||||
#define VM_AREA_LIST(name) struct vm_area_list name = { .h = LIST_HEAD_INIT(name.h), .nr = 0, }
|
||||
|
||||
int collect_mappings(pid_t pid, struct vm_area_list *vma_area_list);
|
||||
void free_mappings(struct vm_area_list *vma_area_list);
|
||||
bool privately_dump_vma(struct vma_area *vma);
|
||||
|
||||
struct vma_area {
|
||||
struct list_head list;
|
||||
VmaEntry vma;
|
||||
|
||||
union {
|
||||
int vm_file_fd;
|
||||
int vm_socket_id;
|
||||
};
|
||||
unsigned long *page_bitmap; /* existent pages */
|
||||
unsigned long *ppage_bitmap; /* parent's existent pages */
|
||||
};
|
||||
|
||||
#define vma_area_is(vma_area, s) vma_entry_is(&((vma_area)->vma), s)
|
||||
#define vma_area_len(vma_area) vma_entry_len(&((vma_area)->vma))
|
||||
|
||||
struct fdt {
|
||||
int nr; /* How many tasks share this fd table */
|
||||
pid_t pid; /* Who should restore this fd table */
|
||||
@@ -171,12 +143,6 @@ struct rst_info {
|
||||
};
|
||||
};
|
||||
|
||||
static inline int in_vma_area(struct vma_area *vma, unsigned long addr)
|
||||
{
|
||||
return addr >= (unsigned long)vma->vma.start &&
|
||||
addr < (unsigned long)vma->vma.end;
|
||||
}
|
||||
|
||||
/*
|
||||
* When we have to restore a shared resource, we mush select which
|
||||
* task should do it, and make other(s) wait for it. In order to
|
||||
|
@@ -49,10 +49,6 @@
|
||||
#define VMA_AREA_SYSVIPC (1 << 10)
|
||||
#define VMA_AREA_SOCKET (1 << 11)
|
||||
|
||||
#define vma_premmaped_start(vma) ((vma)->shmid)
|
||||
#define vma_entry_is(vma, s) (((vma)->status & (s)) == (s))
|
||||
#define vma_entry_len(vma) ((vma)->end - (vma)->start)
|
||||
|
||||
#define CR_CAP_SIZE 2
|
||||
|
||||
#define TASK_COMM_LEN 16
|
||||
|
@@ -1,11 +1,6 @@
|
||||
#ifndef __CR_SK_QUEUE_H__
|
||||
#define __CR_SK_QUEUE_H__
|
||||
|
||||
#include "asm/types.h"
|
||||
#include "list.h"
|
||||
#include "crtools.h"
|
||||
#include "image.h"
|
||||
|
||||
extern int read_sk_queues(void);
|
||||
extern int dump_sk_queue(int sock_fd, int sock_id);
|
||||
extern int restore_sk_queue(int fd, unsigned int peer_id);
|
||||
|
41
include/vma.h
Normal file
41
include/vma.h
Normal file
@@ -0,0 +1,41 @@
|
||||
#ifndef __CR_VMA_H__
|
||||
#define __CR_VMA_H__
|
||||
|
||||
struct vm_area_list {
|
||||
struct list_head h;
|
||||
unsigned nr;
|
||||
unsigned long priv_size; /* nr of pages in private VMAs */
|
||||
unsigned long longest; /* nr of pages in longest VMA */
|
||||
};
|
||||
|
||||
#define VM_AREA_LIST(name) struct vm_area_list name = { .h = LIST_HEAD_INIT(name.h), .nr = 0, }
|
||||
|
||||
struct vma_area {
|
||||
struct list_head list;
|
||||
VmaEntry vma;
|
||||
|
||||
union {
|
||||
int vm_file_fd;
|
||||
int vm_socket_id;
|
||||
};
|
||||
unsigned long *page_bitmap; /* existent pages */
|
||||
unsigned long *ppage_bitmap; /* parent's existent pages */
|
||||
};
|
||||
|
||||
int collect_mappings(pid_t pid, struct vm_area_list *vma_area_list);
|
||||
void free_mappings(struct vm_area_list *vma_area_list);
|
||||
bool privately_dump_vma(struct vma_area *vma);
|
||||
|
||||
#define vma_area_is(vma_area, s) vma_entry_is(&((vma_area)->vma), s)
|
||||
#define vma_area_len(vma_area) vma_entry_len(&((vma_area)->vma))
|
||||
#define vma_premmaped_start(vma) ((vma)->shmid)
|
||||
#define vma_entry_is(vma, s) (((vma)->status & (s)) == (s))
|
||||
#define vma_entry_len(vma) ((vma)->end - (vma)->start)
|
||||
|
||||
static inline int in_vma_area(struct vma_area *vma, unsigned long addr)
|
||||
{
|
||||
return addr >= (unsigned long)vma->vma.start &&
|
||||
addr < (unsigned long)vma->vma.end;
|
||||
}
|
||||
|
||||
#endif
|
1
mem.c
1
mem.c
@@ -13,6 +13,7 @@
|
||||
#include "log.h"
|
||||
#include "kerndat.h"
|
||||
#include "stats.h"
|
||||
#include "vma.h"
|
||||
|
||||
#include "protobuf.h"
|
||||
#include "protobuf/pagemap.pb-c.h"
|
||||
|
@@ -25,6 +25,7 @@
|
||||
#include "posix-timer.h"
|
||||
#include "net.h"
|
||||
#include "mem.h"
|
||||
#include "vma.h"
|
||||
#include "proc_parse.h"
|
||||
|
||||
#include <string.h>
|
||||
|
@@ -20,6 +20,7 @@
|
||||
#include "util.h"
|
||||
#include "image.h"
|
||||
#include "sk-inet.h"
|
||||
#include "vma.h"
|
||||
|
||||
#include "crtools.h"
|
||||
#include "lock.h"
|
||||
|
@@ -21,6 +21,7 @@
|
||||
#include "posix-timer.h"
|
||||
#include "kerndat.h"
|
||||
#include "vdso.h"
|
||||
#include "vma.h"
|
||||
|
||||
#include "proc_parse.h"
|
||||
#include "protobuf.h"
|
||||
|
2
shmem.c
2
shmem.c
@@ -8,6 +8,8 @@
|
||||
#include "page-pipe.h"
|
||||
#include "page-xfer.h"
|
||||
#include "rst-malloc.h"
|
||||
#include "vma.h"
|
||||
|
||||
#include "protobuf.h"
|
||||
#include "protobuf/pagemap.pb-c.h"
|
||||
|
||||
|
@@ -4,13 +4,13 @@
|
||||
#include <linux/rtnetlink.h>
|
||||
#include <unistd.h>
|
||||
#include <string.h>
|
||||
#include "crtools.h"
|
||||
#include "asm/types.h"
|
||||
#include "files.h"
|
||||
#include "sockets.h"
|
||||
#include "libnetlink.h"
|
||||
#include "sk-packet.h"
|
||||
#include "packet_diag.h"
|
||||
#include "vma.h"
|
||||
|
||||
#include "protobuf.h"
|
||||
#include "protobuf/packet-sock.pb-c.h"
|
||||
|
Reference in New Issue
Block a user