Commit 8b187454 authored by Cyrill Gorcunov's avatar Cyrill Gorcunov

files: Rename prepare_fdinfo_global to prepare_shared_fdinfo

This function simply allocates shared memory. Name it so
and move it closer to the variables it referes on.
Signed-off-by: 's avatarCyrill Gorcunov <gorcunov@openvz.org>
Acked-by: 's avatarPavel Emelyanov <xemul@parallels.com>
parent 5cadfef1
......@@ -400,7 +400,7 @@ static int prepare_shared(int ps_fd)
return -1;
}
if (prepare_fdinfo_global())
if (prepare_shared_fdinfo())
return -1;
while (1) {
......
......@@ -28,6 +28,22 @@ static int nr_fdinfo_list;
static struct fmap_fd *fmap_fds;
int prepare_shared_fdinfo(void)
{
fdinfo_descs = mmap(NULL, 4096, PROT_READ | PROT_WRITE, MAP_SHARED | MAP_ANON, 0, 0);
if (fdinfo_descs == MAP_FAILED) {
pr_perror("Can't map fdinfo_descs");
return -1;
}
fdinfo_list = mmap(NULL, 4096, PROT_READ | PROT_WRITE, MAP_SHARED | MAP_ANON, 0, 0);
if (fdinfo_list == MAP_FAILED) {
pr_perror("Can't map fdinfo_list");
return -1;
}
return 0;
}
static struct fdinfo_desc *find_fd(char *id)
{
struct fdinfo_desc *fi;
......@@ -54,22 +70,6 @@ static int get_file_path(char *path, struct fdinfo_entry *fe, int fd)
return 0;
}
int prepare_fdinfo_global()
{
fdinfo_descs = mmap(NULL, 4096, PROT_READ | PROT_WRITE, MAP_SHARED | MAP_ANON, 0, 0);
if (fdinfo_descs == MAP_FAILED) {
pr_perror("Can't map fdinfo_descs");
return -1;
}
fdinfo_list = mmap(NULL, 4096, PROT_READ | PROT_WRITE, MAP_SHARED | MAP_ANON, 0, 0);
if (fdinfo_list == MAP_FAILED) {
pr_perror("Can't map fdinfo_list");
return -1;
}
return 0;
}
static int collect_fd(int pid, struct fdinfo_entry *e)
{
int i;
......
......@@ -39,7 +39,7 @@ struct fdinfo_list_entry {
extern int prepare_fds(int pid);
extern int prepare_fd_pid(int pid);
extern int prepare_fdinfo_global(void);
extern int prepare_shared_fdinfo(void);
extern int try_fixup_file_map(int pid, struct vma_entry *vma_entry, int fd);
#endif /* FILES_H_ */
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