Commit 906f0813 authored by Cyrill Gorcunov's avatar Cyrill Gorcunov Committed by Pavel Emelyanov

pipes: Use pde as a reference in pipe_data_rst

Need it for PB transition.
Signed-off-by: 's avatarCyrill Gorcunov <gorcunov@openvz.org>
Signed-off-by: 's avatarPavel Emelyanov <xemul@parallels.com>
parent 12a0462f
......@@ -21,7 +21,7 @@ struct pipe_data_dump {
extern int dump_one_pipe_data(struct pipe_data_dump *pd, int lfd, const struct fd_parms *p);
struct pipe_data_rst {
struct pipe_data_entry pde;
struct pipe_data_entry *pde;
struct pipe_data_rst *next;
};
......
......@@ -53,21 +53,24 @@ int collect_pipe_data(int img_type, struct pipe_data_rst **hash)
r = xmalloc(sizeof(*r));
if (!r)
break;
r->pde = xmalloc(sizeof(*r->pde));
if (!r->pde)
break;
ret = read_img_eof(fd, &r->pde);
ret = read_img_eof(fd, r->pde);
if (ret <= 0)
break;
off = r->pde.off + lseek(fd, 0, SEEK_CUR);
lseek(fd, r->pde.bytes + r->pde.off, SEEK_CUR);
r->pde.off = off;
off = r->pde->off + lseek(fd, 0, SEEK_CUR);
lseek(fd, r->pde->bytes + r->pde->off, SEEK_CUR);
r->pde->off = off;
ret = r->pde.pipe_id & PIPE_DATA_HASH_MASK;
ret = r->pde->pipe_id & PIPE_DATA_HASH_MASK;
r->next = hash[ret];
hash[ret] = r;
pr_info("Collected pipe data for %#x (chain %u)\n",
r->pde.pipe_id, ret);
r->pde->pipe_id, ret);
}
close(fd);
......@@ -128,7 +131,7 @@ int restore_pipe_data(int img_type, int pfd, u32 id, struct pipe_data_rst **hash
struct pipe_data_rst *pd;
for (pd = hash[id & PIPE_DATA_HASH_MASK]; pd != NULL; pd = pd->next)
if (pd->pde.pipe_id == id)
if (pd->pde->pipe_id == id)
break;
if (!pd) { /* no data for this pipe */
......@@ -140,11 +143,11 @@ int restore_pipe_data(int img_type, int pfd, u32 id, struct pipe_data_rst **hash
if (img < 0)
return -1;
pr_info("\t\tSplicing data size=%u off=%u\n", pd->pde.bytes, pd->pde.off);
lseek(img, pd->pde.off, SEEK_SET);
pr_info("\t\tSplicing data size=%u off=%u\n", pd->pde->bytes, pd->pde->off);
lseek(img, pd->pde->off, SEEK_SET);
while (size != pd->pde.bytes) {
ret = splice(img, NULL, pfd, NULL, pd->pde.bytes - size, 0);
while (size != pd->pde->bytes) {
ret = splice(img, NULL, pfd, NULL, pd->pde->bytes - size, 0);
if (ret < 0) {
pr_perror("%#x: Error splicing data", id);
goto err;
......@@ -152,7 +155,7 @@ int restore_pipe_data(int img_type, int pfd, u32 id, struct pipe_data_rst **hash
if (ret == 0) {
pr_err("%#x: Wanted to restore %d bytes, but got %d\n",
id, pd->pde.bytes, size);
id, pd->pde->bytes, size);
ret = -1;
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