Commit 03a5e05a authored by Cyrill Gorcunov's avatar Cyrill Gorcunov

Rename 'name' member of cr_fd_desc to 'path'

It might contain working directory path as well.
Signed-off-by: 's avatarCyrill Gorcunov <gorcunov@openvz.org>
Acked-by: 's avatarPavel Emelianov <xemul@parallels.com>
parent bcba2f73
...@@ -557,7 +557,7 @@ static int cr_show_all(unsigned long pid, struct cr_options *opts) ...@@ -557,7 +557,7 @@ static int cr_show_all(unsigned long pid, struct cr_options *opts)
* time here, but this saves us from code duplication. * time here, but this saves us from code duplication.
*/ */
lseek(cr_fdset->desc[CR_FD_PSTREE].fd, MAGIC_OFFSET, SEEK_SET); lseek(cr_fdset->desc[CR_FD_PSTREE].fd, MAGIC_OFFSET, SEEK_SET);
show_pstree(cr_fdset->desc[CR_FD_PSTREE].name, show_pstree(cr_fdset->desc[CR_FD_PSTREE].path,
cr_fdset->desc[CR_FD_PSTREE].fd, cr_fdset->desc[CR_FD_PSTREE].fd,
true); true);
...@@ -575,7 +575,7 @@ static int cr_show_all(unsigned long pid, struct cr_options *opts) ...@@ -575,7 +575,7 @@ static int cr_show_all(unsigned long pid, struct cr_options *opts)
goto out; goto out;
lseek(cr_fdset->desc[CR_FD_CORE].fd, MAGIC_OFFSET, SEEK_SET); lseek(cr_fdset->desc[CR_FD_CORE].fd, MAGIC_OFFSET, SEEK_SET);
show_core(cr_fdset->desc[CR_FD_CORE].name, show_core(cr_fdset->desc[CR_FD_CORE].path,
cr_fdset->desc[CR_FD_CORE].fd, cr_fdset->desc[CR_FD_CORE].fd,
true, opts->show_pages_content); true, opts->show_pages_content);
...@@ -601,7 +601,7 @@ static int cr_show_all(unsigned long pid, struct cr_options *opts) ...@@ -601,7 +601,7 @@ static int cr_show_all(unsigned long pid, struct cr_options *opts)
pr_info("----------------------------------------\n"); pr_info("----------------------------------------\n");
lseek(cr_fdset_th->desc[CR_FD_CORE].fd, MAGIC_OFFSET, SEEK_SET); lseek(cr_fdset_th->desc[CR_FD_CORE].fd, MAGIC_OFFSET, SEEK_SET);
show_core(cr_fdset_th->desc[CR_FD_CORE].name, show_core(cr_fdset_th->desc[CR_FD_CORE].path,
cr_fdset_th->desc[CR_FD_CORE].fd, cr_fdset_th->desc[CR_FD_CORE].fd,
false, opts->show_pages_content); false, opts->show_pages_content);
...@@ -612,16 +612,16 @@ static int cr_show_all(unsigned long pid, struct cr_options *opts) ...@@ -612,16 +612,16 @@ static int cr_show_all(unsigned long pid, struct cr_options *opts)
} }
} }
show_pipes(cr_fdset->desc[CR_FD_PIPES].name, show_pipes(cr_fdset->desc[CR_FD_PIPES].path,
cr_fdset->desc[CR_FD_PIPES].fd, true); cr_fdset->desc[CR_FD_PIPES].fd, true);
show_files(cr_fdset->desc[CR_FD_FDINFO].name, show_files(cr_fdset->desc[CR_FD_FDINFO].path,
cr_fdset->desc[CR_FD_FDINFO].fd, true); cr_fdset->desc[CR_FD_FDINFO].fd, true);
show_shmem(cr_fdset->desc[CR_FD_SHMEM].name, show_shmem(cr_fdset->desc[CR_FD_SHMEM].path,
cr_fdset->desc[CR_FD_SHMEM].fd, true); cr_fdset->desc[CR_FD_SHMEM].fd, true);
show_sigacts(cr_fdset->desc[CR_FD_SIGACT].name, show_sigacts(cr_fdset->desc[CR_FD_SIGACT].path,
cr_fdset->desc[CR_FD_SIGACT].fd, true); cr_fdset->desc[CR_FD_SIGACT].fd, true);
close_cr_fdset(cr_fdset); close_cr_fdset(cr_fdset);
......
...@@ -100,8 +100,8 @@ struct cr_fdset *alloc_cr_fdset(pid_t pid) ...@@ -100,8 +100,8 @@ struct cr_fdset *alloc_cr_fdset(pid_t pid)
for (i = 0; i < CR_FD_MAX; i++) { for (i = 0; i < CR_FD_MAX; i++) {
cr_fdset->desc[i].tmpl = &fdset_template[i]; cr_fdset->desc[i].tmpl = &fdset_template[i];
ret = get_image_path(cr_fdset->desc[i].name, ret = get_image_path(cr_fdset->desc[i].path,
sizeof(cr_fdset->desc[i].name), sizeof(cr_fdset->desc[i].path),
cr_fdset->desc[i].tmpl->fmt, cr_fdset->desc[i].tmpl->fmt,
pid); pid);
if (ret) { if (ret) {
...@@ -131,26 +131,26 @@ int prep_cr_fdset_for_dump(struct cr_fdset *cr_fdset, ...@@ -131,26 +131,26 @@ int prep_cr_fdset_for_dump(struct cr_fdset *cr_fdset,
if (!(use_mask & CR_FD_DESC_USE(i))) if (!(use_mask & CR_FD_DESC_USE(i)))
continue; continue;
ret = unlink(cr_fdset->desc[i].name); ret = unlink(cr_fdset->desc[i].path);
if (ret && errno != ENOENT) { if (ret && errno != ENOENT) {
pr_perror("Unable to unlink %s (%s)\n", pr_perror("Unable to unlink %s (%s)\n",
cr_fdset->desc[i].name, cr_fdset->desc[i].path,
strerror(errno)); strerror(errno));
goto err; goto err;
} else } else
ret = -1; ret = -1;
cr_fdset->desc[i].fd = open(cr_fdset->desc[i].name, cr_fdset->desc[i].fd = open(cr_fdset->desc[i].path,
O_RDWR | O_CREAT | O_EXCL, O_RDWR | O_CREAT | O_EXCL,
CR_FD_PERM); CR_FD_PERM);
if (cr_fdset->desc[i].fd < 0) { if (cr_fdset->desc[i].fd < 0) {
pr_perror("Unable to open %s (%s)\n", pr_perror("Unable to open %s (%s)\n",
cr_fdset->desc[i].name, cr_fdset->desc[i].path,
strerror(errno)); strerror(errno));
goto err; goto err;
} }
pr_debug("Opened %s with %d\n", pr_debug("Opened %s with %d\n",
cr_fdset->desc[i].name, cr_fdset->desc[i].path,
cr_fdset->desc[i].fd); cr_fdset->desc[i].fd);
magic = cr_fdset->desc[i].tmpl->magic; magic = cr_fdset->desc[i].tmpl->magic;
...@@ -177,23 +177,23 @@ int prep_cr_fdset_for_restore(struct cr_fdset *cr_fdset, ...@@ -177,23 +177,23 @@ int prep_cr_fdset_for_restore(struct cr_fdset *cr_fdset,
if (!(use_mask & CR_FD_DESC_USE(i))) if (!(use_mask & CR_FD_DESC_USE(i)))
continue; continue;
cr_fdset->desc[i].fd = open(cr_fdset->desc[i].name, cr_fdset->desc[i].fd = open(cr_fdset->desc[i].path,
O_RDWR, CR_FD_PERM); O_RDWR, CR_FD_PERM);
if (cr_fdset->desc[i].fd < 0) { if (cr_fdset->desc[i].fd < 0) {
pr_perror("Unable to open %s (%s)\n", pr_perror("Unable to open %s (%s)\n",
cr_fdset->desc[i].name, cr_fdset->desc[i].path,
strerror(errno)); strerror(errno));
goto err; goto err;
} }
pr_debug("Opened %s with %d\n", pr_debug("Opened %s with %d\n",
cr_fdset->desc[i].name, cr_fdset->desc[i].path,
cr_fdset->desc[i].fd); cr_fdset->desc[i].fd);
read_ptr_safe(cr_fdset->desc[i].fd, &magic, err); read_ptr_safe(cr_fdset->desc[i].fd, &magic, err);
if (magic != cr_fdset->desc[i].tmpl->magic) { if (magic != cr_fdset->desc[i].tmpl->magic) {
pr_err("Magic doesn't match for %s\n", pr_err("Magic doesn't match for %s\n",
cr_fdset->desc[i].name); cr_fdset->desc[i].path);
goto err; goto err;
} }
...@@ -216,7 +216,7 @@ void close_cr_fdset(struct cr_fdset *cr_fdset) ...@@ -216,7 +216,7 @@ void close_cr_fdset(struct cr_fdset *cr_fdset)
if (cr_fdset->desc[i].fd >= 0) { if (cr_fdset->desc[i].fd >= 0) {
pr_debug("Closed %s with %d\n", pr_debug("Closed %s with %d\n",
cr_fdset->desc[i].name, cr_fdset->desc[i].path,
cr_fdset->desc[i].fd); cr_fdset->desc[i].fd);
close(cr_fdset->desc[i].fd); close(cr_fdset->desc[i].fd);
cr_fdset->desc[i].fd = -1; cr_fdset->desc[i].fd = -1;
......
...@@ -70,7 +70,7 @@ extern char image_dir[]; ...@@ -70,7 +70,7 @@ extern char image_dir[];
/* file descriptors */ /* file descriptors */
struct cr_fd_desc { struct cr_fd_desc {
struct cr_fd_desc_tmpl *tmpl; /* template we refer to */ struct cr_fd_desc_tmpl *tmpl; /* template we refer to */
char name[64]; /* the name, based on pid */ char path[PATH_MAX]; /* the path, based on pid */
int fd; /* descriptor for open/close */ int fd; /* descriptor for open/close */
}; };
......
...@@ -350,7 +350,7 @@ int parasite_dump_sigacts_seized(struct parasite_ctl *ctl, struct cr_fdset *cr_f ...@@ -350,7 +350,7 @@ int parasite_dump_sigacts_seized(struct parasite_ctl *ctl, struct cr_fdset *cr_f
pr_info("Dumping sigactions (pid: %d)\n", ctl->pid); pr_info("Dumping sigactions (pid: %d)\n", ctl->pid);
pr_info("----------------------------------------\n"); pr_info("----------------------------------------\n");
path_len = strlen(cr_fdset->desc[CR_FD_SIGACT].name); path_len = strlen(cr_fdset->desc[CR_FD_SIGACT].path);
if (path_len > sizeof(parasite_sigacts.open_path)) { if (path_len > sizeof(parasite_sigacts.open_path)) {
pr_panic("Dumping sigactions path is too long (%d while %d allowed)\n", pr_panic("Dumping sigactions path is too long (%d while %d allowed)\n",
...@@ -364,7 +364,7 @@ int parasite_dump_sigacts_seized(struct parasite_ctl *ctl, struct cr_fdset *cr_f ...@@ -364,7 +364,7 @@ int parasite_dump_sigacts_seized(struct parasite_ctl *ctl, struct cr_fdset *cr_f
} }
strncpy(parasite_sigacts.open_path, strncpy(parasite_sigacts.open_path,
cr_fdset->desc[CR_FD_SIGACT].name, cr_fdset->desc[CR_FD_SIGACT].path,
sizeof(parasite_sigacts.open_path)); sizeof(parasite_sigacts.open_path));
parasite_sigacts.open_flags = O_WRONLY; parasite_sigacts.open_flags = O_WRONLY;
...@@ -402,8 +402,8 @@ int parasite_dump_pages_seized(struct parasite_ctl *ctl, struct list_head *vma_a ...@@ -402,8 +402,8 @@ int parasite_dump_pages_seized(struct parasite_ctl *ctl, struct list_head *vma_a
pr_info("Dumping pages (type: %d pid: %d)\n", fd_type, ctl->pid); pr_info("Dumping pages (type: %d pid: %d)\n", fd_type, ctl->pid);
pr_info("----------------------------------------\n"); pr_info("----------------------------------------\n");
path_len = strlen(cr_fdset->desc[fd_type].name); path_len = strlen(cr_fdset->desc[fd_type].path);
pr_info("Dumping pages %s\n", cr_fdset->desc[fd_type].name); pr_info("Dumping pages %s\n", cr_fdset->desc[fd_type].path);
if (path_len > sizeof(parasite_dumppages.open_path)) { if (path_len > sizeof(parasite_dumppages.open_path)) {
pr_panic("Dumping pages path is too long (%d while %d allowed)\n", pr_panic("Dumping pages path is too long (%d while %d allowed)\n",
...@@ -423,7 +423,7 @@ int parasite_dump_pages_seized(struct parasite_ctl *ctl, struct list_head *vma_a ...@@ -423,7 +423,7 @@ int parasite_dump_pages_seized(struct parasite_ctl *ctl, struct list_head *vma_a
fsync(cr_fdset->desc[fd_type].fd); fsync(cr_fdset->desc[fd_type].fd);
strncpy(parasite_dumppages.open_path, strncpy(parasite_dumppages.open_path,
cr_fdset->desc[fd_type].name, cr_fdset->desc[fd_type].path,
sizeof(parasite_dumppages.open_path)); sizeof(parasite_dumppages.open_path));
parasite_dumppages.open_flags = O_WRONLY; parasite_dumppages.open_flags = O_WRONLY;
......
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