mirror of
https://github.com/checkpoint-restore/criu
synced 2025-09-01 23:05:39 +00:00
vma: Vma allocation helper is now function
Signed-off-by: Pavel Emelyanov <xemul@parallels.com>
This commit is contained in:
@@ -118,21 +118,6 @@ extern void pr_vma(unsigned int loglevel, const struct vma_area *vma_area);
|
|||||||
} while (0)
|
} while (0)
|
||||||
#define pr_info_vma_list(head) pr_vma_list(LOG_INFO, head)
|
#define pr_info_vma_list(head) pr_vma_list(LOG_INFO, head)
|
||||||
|
|
||||||
/*
|
|
||||||
* Note since VMA_AREA_NONE = 0 we can skip assignment
|
|
||||||
* here and simply rely on xzalloc
|
|
||||||
*/
|
|
||||||
#define alloc_vma_area() \
|
|
||||||
({ \
|
|
||||||
struct vma_area *p__ = xzalloc(sizeof(*p__)); \
|
|
||||||
if (p__) { \
|
|
||||||
vma_entry__init(&p__->vma); \
|
|
||||||
p__->vm_file_fd = -1; \
|
|
||||||
p__->vma.fd = -1; \
|
|
||||||
} \
|
|
||||||
p__; \
|
|
||||||
})
|
|
||||||
|
|
||||||
extern int move_img_fd(int *img_fd, int want_fd);
|
extern int move_img_fd(int *img_fd, int want_fd);
|
||||||
extern int close_safe(int *fd);
|
extern int close_safe(int *fd);
|
||||||
|
|
||||||
|
@@ -31,6 +31,7 @@ struct vma_area {
|
|||||||
struct stat *st;
|
struct stat *st;
|
||||||
};
|
};
|
||||||
|
|
||||||
|
extern struct vma_area *alloc_vma_area(void);
|
||||||
extern int collect_mappings(pid_t pid, struct vm_area_list *vma_area_list);
|
extern int collect_mappings(pid_t pid, struct vm_area_list *vma_area_list);
|
||||||
extern void free_mappings(struct vm_area_list *vma_area_list);
|
extern void free_mappings(struct vm_area_list *vma_area_list);
|
||||||
extern bool privately_dump_vma(struct vma_area *vma);
|
extern bool privately_dump_vma(struct vma_area *vma);
|
||||||
|
18
util.c
18
util.c
@@ -642,3 +642,21 @@ out:
|
|||||||
close(fd);
|
close(fd);
|
||||||
return ret;
|
return ret;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/*
|
||||||
|
* Note since VMA_AREA_NONE = 0 we can skip assignment
|
||||||
|
* here and simply rely on xzalloc
|
||||||
|
*/
|
||||||
|
struct vma_area *alloc_vma_area(void)
|
||||||
|
{
|
||||||
|
struct vma_area *p;
|
||||||
|
|
||||||
|
p = xzalloc(sizeof(*p));
|
||||||
|
if (p) {
|
||||||
|
vma_entry__init(&p->vma);
|
||||||
|
p->vm_file_fd = -1;
|
||||||
|
p->vma.fd = -1;
|
||||||
|
}
|
||||||
|
|
||||||
|
return p;
|
||||||
|
}
|
||||||
|
Reference in New Issue
Block a user