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

pipes: Make pipes_with_data being static

There is no need to make it xmalloc'ed, it's
global for all processes dumped.
Signed-off-by: 's avatarCyrill Gorcunov <gorcunov@openvz.org>
Signed-off-by: 's avatarPavel Emelyanov <xemul@parallels.com>
parent e6f6c9f1
......@@ -1718,9 +1718,6 @@ int cr_dump_tasks(pid_t pid, const struct cr_options *opts)
if (init_shmem_dump())
goto err;
if (init_pipes_dump())
goto err;
for_each_pstree_item(item) {
if (dump_one_task(item))
goto err;
......@@ -1740,7 +1737,6 @@ int cr_dump_tasks(pid_t pid, const struct cr_options *opts)
fd_id_show_tree();
err:
fini_shmem_dump();
fini_pipes_dump();
close_cr_fdset(&glob_fdset);
/*
......
......@@ -2,8 +2,6 @@
#define __CR_PIPES_H__
extern int collect_pipes(void);
extern void mark_pipe_master(void);
int init_pipes_dump(void);
void fini_pipes_dump(void);
int dump_pipe(struct fd_parms *p, int lfd,
const struct cr_fdset *cr_fdset);
#endif
......@@ -300,9 +300,8 @@ static int open_pipe(struct file_desc *d)
return tmp;
}
#define PIPES_SIZE 1024
static u32 *pipes_with_data; /* pipes for which data already dumped */
static int nr_pipes = 0;
static u32 pipes_with_data[1024]; /* pipes for which data already dumped */
static int nr_pipes;
static int dump_one_pipe_data(int lfd, u32 id, const struct fd_parms *p)
{
......@@ -321,7 +320,7 @@ static int dump_one_pipe_data(int lfd, u32 id, const struct fd_parms *p)
pr_info("Dumping data from pipe %#x fd %d\n", id, lfd);
if (PIPES_SIZE < nr_pipes + 1) {
if (ARRAY_SIZE(pipes_with_data) < nr_pipes + 1) {
pr_err("OOM storing pipe\n");
return -1;
}
......@@ -422,14 +421,3 @@ int dump_pipe(struct fd_parms *p, int lfd,
{
return do_dump_gen_file(p, lfd, &pipe_ops, cr_fdset);
}
int init_pipes_dump(void)
{
pipes_with_data = xmalloc(PIPES_SIZE * sizeof(*pipes_with_data));
return pipes_with_data == NULL ? -1 : 0;
}
void fini_pipes_dump(void)
{
xfree(pipes_with_data);
}
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