Commit ee133674 authored by Pavel Emelyanov's avatar Pavel Emelyanov Committed by Cyrill Gorcunov

crtools: Remove tmpl pointer from fdset

All the places we need one in can use the direct reference on template.
Signed-off-by: 's avatarPavel Emelyanov <xemul@parallels.com>
Signed-off-by: 's avatarCyrill Gorcunov <gorcunov@openvz.org>
parent f316a79e
......@@ -98,11 +98,9 @@ struct cr_fdset *alloc_cr_fdset(pid_t pid)
goto err;
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,
sizeof(cr_fdset->desc[i].path),
cr_fdset->desc[i].tmpl->fmt,
pid);
fdset_template[i].fmt, pid);
if (ret) {
xfree(cr_fdset);
return NULL;
......@@ -118,7 +116,6 @@ int prep_cr_fdset_for_dump(struct cr_fdset *cr_fdset,
unsigned long use_mask)
{
unsigned int i;
u32 magic;
int ret = -1;
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].fd);
magic = cr_fdset->desc[i].tmpl->magic;
write_ptr_safe(cr_fdset->desc[i].fd, &magic, err);
write_ptr_safe(cr_fdset->desc[i].fd, &fdset_template[i].magic, err);
}
ret = 0;
err:
......@@ -190,7 +186,7 @@ int prep_cr_fdset_for_restore(struct cr_fdset *cr_fdset,
cr_fdset->desc[i].fd);
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",
cr_fdset->desc[i].path);
goto err;
......
......@@ -72,7 +72,6 @@ extern int open_image_ro_nocheck(const char *fmt, int pid);
/* file descriptors */
struct cr_fd_desc {
struct cr_fd_desc_tmpl *tmpl; /* template we refer to */
char path[PATH_MAX]; /* the path, based on pid */
int fd; /* descriptor for open/close */
};
......
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