mirror of
https://github.com/checkpoint-restore/criu
synced 2025-09-02 15:25:21 +00:00
crtools: Remove tmpl pointer from fdset
All the places we need one in can use the direct reference on template. Signed-off-by: Pavel Emelyanov <xemul@parallels.com> Signed-off-by: Cyrill Gorcunov <gorcunov@openvz.org>
This commit is contained in:
committed by
Cyrill Gorcunov
parent
f316a79e66
commit
ee13367486
10
crtools.c
10
crtools.c
@@ -98,11 +98,9 @@ struct cr_fdset *alloc_cr_fdset(pid_t pid)
|
|||||||
goto err;
|
goto err;
|
||||||
|
|
||||||
for (i = 0; i < CR_FD_MAX; i++) {
|
for (i = 0; i < CR_FD_MAX; i++) {
|
||||||
cr_fdset->desc[i].tmpl = &fdset_template[i];
|
|
||||||
ret = get_image_path(cr_fdset->desc[i].path,
|
ret = get_image_path(cr_fdset->desc[i].path,
|
||||||
sizeof(cr_fdset->desc[i].path),
|
sizeof(cr_fdset->desc[i].path),
|
||||||
cr_fdset->desc[i].tmpl->fmt,
|
fdset_template[i].fmt, pid);
|
||||||
pid);
|
|
||||||
if (ret) {
|
if (ret) {
|
||||||
xfree(cr_fdset);
|
xfree(cr_fdset);
|
||||||
return NULL;
|
return NULL;
|
||||||
@@ -118,7 +116,6 @@ int prep_cr_fdset_for_dump(struct cr_fdset *cr_fdset,
|
|||||||
unsigned long use_mask)
|
unsigned long use_mask)
|
||||||
{
|
{
|
||||||
unsigned int i;
|
unsigned int i;
|
||||||
u32 magic;
|
|
||||||
int ret = -1;
|
int ret = -1;
|
||||||
|
|
||||||
if (!cr_fdset)
|
if (!cr_fdset)
|
||||||
@@ -152,8 +149,7 @@ int prep_cr_fdset_for_dump(struct cr_fdset *cr_fdset,
|
|||||||
cr_fdset->desc[i].path,
|
cr_fdset->desc[i].path,
|
||||||
cr_fdset->desc[i].fd);
|
cr_fdset->desc[i].fd);
|
||||||
|
|
||||||
magic = cr_fdset->desc[i].tmpl->magic;
|
write_ptr_safe(cr_fdset->desc[i].fd, &fdset_template[i].magic, err);
|
||||||
write_ptr_safe(cr_fdset->desc[i].fd, &magic, err);
|
|
||||||
}
|
}
|
||||||
ret = 0;
|
ret = 0;
|
||||||
err:
|
err:
|
||||||
@@ -190,7 +186,7 @@ int prep_cr_fdset_for_restore(struct cr_fdset *cr_fdset,
|
|||||||
cr_fdset->desc[i].fd);
|
cr_fdset->desc[i].fd);
|
||||||
|
|
||||||
read_ptr_safe(cr_fdset->desc[i].fd, &magic, err);
|
read_ptr_safe(cr_fdset->desc[i].fd, &magic, err);
|
||||||
if (magic != cr_fdset->desc[i].tmpl->magic) {
|
if (magic != fdset_template[i].magic) {
|
||||||
pr_err("Magic doesn't match for %s\n",
|
pr_err("Magic doesn't match for %s\n",
|
||||||
cr_fdset->desc[i].path);
|
cr_fdset->desc[i].path);
|
||||||
goto err;
|
goto err;
|
||||||
|
@@ -72,7 +72,6 @@ extern int open_image_ro_nocheck(const char *fmt, int pid);
|
|||||||
|
|
||||||
/* file descriptors */
|
/* file descriptors */
|
||||||
struct cr_fd_desc {
|
struct cr_fd_desc {
|
||||||
struct cr_fd_desc_tmpl *tmpl; /* template we refer to */
|
|
||||||
char path[PATH_MAX]; /* the path, based on pid */
|
char path[PATH_MAX]; /* the path, based on pid */
|
||||||
int fd; /* descriptor for open/close */
|
int fd; /* descriptor for open/close */
|
||||||
};
|
};
|
||||||
|
Reference in New Issue
Block a user