Commit 0d1dfc2e authored by Andrey Vagin's avatar Andrey Vagin Committed by Pavel Emelyanov

crtools: move all stuff about vma together

Signed-off-by: 's avatarAndrey Vagin <avagin@openvz.org>
Signed-off-by: 's avatarPavel Emelyanov <xemul@parallels.com>
parent 824403a0
#include <sys/types.h> #include <sys/types.h>
#include "vdso.h" #include "vdso.h"
#include "vma.h"
#include "log.h" #include "log.h"
#ifdef LOG_PREFIX #ifdef LOG_PREFIX
......
...@@ -15,6 +15,7 @@ ...@@ -15,6 +15,7 @@
#include "compiler.h" #include "compiler.h"
#include "crtools.h" #include "crtools.h"
#include "vdso.h" #include "vdso.h"
#include "vma.h"
#include "log.h" #include "log.h"
#ifdef LOG_PREFIX #ifdef LOG_PREFIX
......
...@@ -15,12 +15,12 @@ ...@@ -15,12 +15,12 @@
#include "parasite-syscall.h" #include "parasite-syscall.h"
#include "parasite.h" #include "parasite.h"
#include "compiler.h" #include "compiler.h"
#include "crtools.h"
#include "kerndat.h" #include "kerndat.h"
#include "vdso.h" #include "vdso.h"
#include "util.h" #include "util.h"
#include "log.h" #include "log.h"
#include "mem.h" #include "mem.h"
#include "vma.h"
#ifdef LOG_PREFIX #ifdef LOG_PREFIX
# undef LOG_PREFIX # undef LOG_PREFIX
......
...@@ -66,6 +66,7 @@ ...@@ -66,6 +66,7 @@
#include "page-pipe.h" #include "page-pipe.h"
#include "posix-timer.h" #include "posix-timer.h"
#include "vdso.h" #include "vdso.h"
#include "vma.h"
#include "cr-service.h" #include "cr-service.h"
#include "asm/dump.h" #include "asm/dump.h"
......
...@@ -3,6 +3,7 @@ ...@@ -3,6 +3,7 @@
#include "crtools.h" #include "crtools.h"
#include "ptrace.h" #include "ptrace.h"
#include "parasite-syscall.h" #include "parasite-syscall.h"
#include "vma.h"
struct syscall_exec_desc { struct syscall_exec_desc {
char *name; char *name;
......
...@@ -63,6 +63,7 @@ ...@@ -63,6 +63,7 @@
#include "vdso.h" #include "vdso.h"
#include "stats.h" #include "stats.h"
#include "tun.h" #include "tun.h"
#include "vma.h"
#include "kerndat.h" #include "kerndat.h"
#include "rst-malloc.h" #include "rst-malloc.h"
......
...@@ -111,34 +111,6 @@ struct cr_fdset *cr_glob_fdset_open(int mode); ...@@ -111,34 +111,6 @@ struct cr_fdset *cr_glob_fdset_open(int mode);
void close_cr_fdset(struct cr_fdset **cr_fdset); 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 { struct fdt {
int nr; /* How many tasks share this fd table */ int nr; /* How many tasks share this fd table */
pid_t pid; /* Who should restore this fd table */ pid_t pid; /* Who should restore this fd table */
...@@ -171,12 +143,6 @@ struct rst_info { ...@@ -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 * 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 * task should do it, and make other(s) wait for it. In order to
......
...@@ -49,10 +49,6 @@ ...@@ -49,10 +49,6 @@
#define VMA_AREA_SYSVIPC (1 << 10) #define VMA_AREA_SYSVIPC (1 << 10)
#define VMA_AREA_SOCKET (1 << 11) #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 CR_CAP_SIZE 2
#define TASK_COMM_LEN 16 #define TASK_COMM_LEN 16
......
#ifndef __CR_SK_QUEUE_H__ #ifndef __CR_SK_QUEUE_H__
#define __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 read_sk_queues(void);
extern int dump_sk_queue(int sock_fd, int sock_id); extern int dump_sk_queue(int sock_fd, int sock_id);
extern int restore_sk_queue(int fd, unsigned int peer_id); extern int restore_sk_queue(int fd, unsigned int peer_id);
......
#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
...@@ -13,6 +13,7 @@ ...@@ -13,6 +13,7 @@
#include "log.h" #include "log.h"
#include "kerndat.h" #include "kerndat.h"
#include "stats.h" #include "stats.h"
#include "vma.h"
#include "protobuf.h" #include "protobuf.h"
#include "protobuf/pagemap.pb-c.h" #include "protobuf/pagemap.pb-c.h"
......
...@@ -25,6 +25,7 @@ ...@@ -25,6 +25,7 @@
#include "posix-timer.h" #include "posix-timer.h"
#include "net.h" #include "net.h"
#include "mem.h" #include "mem.h"
#include "vma.h"
#include "proc_parse.h" #include "proc_parse.h"
#include <string.h> #include <string.h>
......
...@@ -20,6 +20,7 @@ ...@@ -20,6 +20,7 @@
#include "util.h" #include "util.h"
#include "image.h" #include "image.h"
#include "sk-inet.h" #include "sk-inet.h"
#include "vma.h"
#include "crtools.h" #include "crtools.h"
#include "lock.h" #include "lock.h"
......
...@@ -21,6 +21,7 @@ ...@@ -21,6 +21,7 @@
#include "posix-timer.h" #include "posix-timer.h"
#include "kerndat.h" #include "kerndat.h"
#include "vdso.h" #include "vdso.h"
#include "vma.h"
#include "proc_parse.h" #include "proc_parse.h"
#include "protobuf.h" #include "protobuf.h"
......
...@@ -8,6 +8,8 @@ ...@@ -8,6 +8,8 @@
#include "page-pipe.h" #include "page-pipe.h"
#include "page-xfer.h" #include "page-xfer.h"
#include "rst-malloc.h" #include "rst-malloc.h"
#include "vma.h"
#include "protobuf.h" #include "protobuf.h"
#include "protobuf/pagemap.pb-c.h" #include "protobuf/pagemap.pb-c.h"
......
...@@ -4,13 +4,13 @@ ...@@ -4,13 +4,13 @@
#include <linux/rtnetlink.h> #include <linux/rtnetlink.h>
#include <unistd.h> #include <unistd.h>
#include <string.h> #include <string.h>
#include "crtools.h"
#include "asm/types.h" #include "asm/types.h"
#include "files.h" #include "files.h"
#include "sockets.h" #include "sockets.h"
#include "libnetlink.h" #include "libnetlink.h"
#include "sk-packet.h" #include "sk-packet.h"
#include "packet_diag.h" #include "packet_diag.h"
#include "vma.h"
#include "protobuf.h" #include "protobuf.h"
#include "protobuf/packet-sock.pb-c.h" #include "protobuf/packet-sock.pb-c.h"
......
...@@ -36,6 +36,8 @@ ...@@ -36,6 +36,8 @@
#include "list.h" #include "list.h"
#include "util.h" #include "util.h"
#include "rst-malloc.h" #include "rst-malloc.h"
#include "image.h"
#include "vma.h"
#include "crtools.h" #include "crtools.h"
#include "servicefd.h" #include "servicefd.h"
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment