Commit cf8c9ae8 authored by Pavel Emelyanov's avatar Pavel Emelyanov

vma: Reshuffle the struct vma_area

We have some fields, that are dump-only and some that
are restore only (quite a lot of them actually).

Reshuffle them on the vma_area to explicitly show which
one is which. And rename some of them for easier grep.
Signed-off-by: 's avatarPavel Emelyanov <xemul@parallels.com>
parent 92ee1233
......@@ -135,7 +135,7 @@ void free_mappings(struct vm_area_list *vma_area_list)
list_for_each_entry_safe(vma_area, p, &vma_area_list->h, list) {
close_vma_file(vma_area);
if (!vma_area->file_borrowed)
free(vma_area->st);
free(vma_area->vmst);
free(vma_area);
}
......@@ -369,8 +369,8 @@ static int dump_filemap(pid_t pid, struct vma_area *vma_area,
int ret = 0;
u32 id;
BUG_ON(!vma_area->st);
p.stat = *vma_area->st;
BUG_ON(!vma_area->vmst);
p.stat = *vma_area->vmst;
/*
* AUFS support to compensate for the kernel bug
......
......@@ -1062,7 +1062,7 @@ int get_filemap_fd(struct vma_area *vma)
* We open file w/o lseek, as mappings don't care about it
*/
BUG_ON(vma->fd == NULL);
BUG_ON(vma->vmfd == NULL);
if (vma->e->has_fdflags)
flags = vma->e->fdflags;
else if ((vma->e->prot & PROT_WRITE) &&
......@@ -1071,7 +1071,7 @@ int get_filemap_fd(struct vma_area *vma)
else
flags = O_RDONLY;
return open_path(vma->fd, do_open_reg_noseek_flags, &flags);
return open_path(vma->vmfd, do_open_reg_noseek_flags, &flags);
}
static void remap_get(struct file_desc *fdesc, char typ)
......
......@@ -28,24 +28,26 @@ struct vma_area {
VmaEntry *e;
union {
int vm_file_fd;
int vm_socket_id;
struct file_desc *fd;
};
union {
unsigned long *page_bitmap; /* existent pages, restore only */
char *aufs_rpath; /* path from aufs root, dump only */
};
union {
unsigned long *ppage_bitmap; /* parent's existent pages */
char *aufs_fpath; /* full path from global root, dump only */
};
struct /* for dump */ {
union {
int vm_file_fd;
int vm_socket_id;
};
unsigned long premmaped_addr;
char *aufs_rpath; /* path from aufs root */
char *aufs_fpath; /* full path from global root */
bool file_borrowed;
bool file_borrowed;
struct stat *vmst;
};
struct stat *st;
struct /* for restore */ {
struct file_desc *vmfd;
unsigned long *page_bitmap; /* existent pages */
unsigned long *ppage_bitmap; /* parent's existent pages */
unsigned long premmaped_addr; /* restore only */
};
};
};
extern struct vma_area *alloc_vma_area(void);
......
......@@ -377,7 +377,7 @@ static inline int collect_filemap(struct vma_area *vma)
if (!fd)
return -1;
vma->fd = fd;
vma->vmfd = fd;
return 0;
}
......
......@@ -453,11 +453,11 @@ int parse_smaps(pid_t pid, struct vm_area_list *vma_area_list, bool use_map_file
vma_area->e->flags |= (prev->e->flags & MAP_ANONYMOUS);
vma_area->e->status = prev->e->status;
vma_area->e->shmid = prev->e->shmid;
vma_area->st = prev->st;
vma_area->vmst = prev->vmst;
} else if (vma_area->vm_file_fd >= 0) {
struct stat *st_buf;
st_buf = vma_area->st = xmalloc(sizeof(*st_buf));
st_buf = vma_area->vmst = xmalloc(sizeof(*st_buf));
if (!st_buf)
goto err;
......
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