Commit a82cb23f authored by Pavel Emelyanov's avatar Pavel Emelyanov

pipe: Dump and restore pipe size

Signed-off-by: 's avatarPavel Emelyanov <xemul@parallels.com>
parent 42d7bc07
...@@ -167,7 +167,7 @@ int restore_pipe_data(int img_type, int pfd, u32 id, struct pipe_data_rst **hash ...@@ -167,7 +167,7 @@ int restore_pipe_data(int img_type, int pfd, u32 id, struct pipe_data_rst **hash
} }
if (!pd->pde->bytes) if (!pd->pde->bytes)
return 0; goto out;
if (!pd->data) { if (!pd->data) {
pr_err("Double data restore occurred on %#x\n", id); pr_err("Double data restore occurred on %#x\n", id);
...@@ -207,7 +207,17 @@ int restore_pipe_data(int img_type, int pfd, u32 id, struct pipe_data_rst **hash ...@@ -207,7 +207,17 @@ int restore_pipe_data(int img_type, int pfd, u32 id, struct pipe_data_rst **hash
munmap(pd->data, pd->pde->bytes); munmap(pd->data, pd->pde->bytes);
pd->data = NULL; pd->data = NULL;
out:
ret = 0; ret = 0;
if (pd->pde->has_size) {
pr_info("Restoring size %#x for %#x\n",
pd->pde->size, pd->pde->pipe_id);
ret = fcntl(pfd, F_SETPIPE_SZ, pd->pde->size);
if (ret < 0)
pr_perror("Can't restore pipe size");
else
ret = 0;
}
err: err:
return ret; return ret;
} }
...@@ -400,6 +410,8 @@ int dump_one_pipe_data(struct pipe_data_dump *pd, int lfd, const struct fd_parms ...@@ -400,6 +410,8 @@ int dump_one_pipe_data(struct pipe_data_dump *pd, int lfd, const struct fd_parms
pde.pipe_id = pipe_id(p); pde.pipe_id = pipe_id(p);
pde.bytes = bytes; pde.bytes = bytes;
pde.has_size = true;
pde.size = pipe_size;
if (pb_write_one(img, &pde, PB_PIPES_DATA)) if (pb_write_one(img, &pde, PB_PIPES_DATA))
goto err_close; goto err_close;
......
message pipe_data_entry { message pipe_data_entry {
required uint32 pipe_id = 1; required uint32 pipe_id = 1;
required uint32 bytes = 2; required uint32 bytes = 2;
optional uint32 size = 3;
} }
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