Commit 8644d2ba authored by Cyrill Gorcunov's avatar Cyrill Gorcunov Committed by Pavel Emelyanov

files-reg: Add try_collect_special_file

The idea is to be able to lookup for special id
which might be not present and we should not
yield the error.
Signed-off-by: 's avatarCyrill Gorcunov <gorcunov@openvz.org>
Acked-by: 's avatarTycho Andersen <tycho.andersen@canonical.com>
Signed-off-by: 's avatarPavel Emelyanov <xemul@parallels.com>
parent cb546f84
...@@ -1127,7 +1127,7 @@ static struct file_desc_ops reg_desc_ops = { ...@@ -1127,7 +1127,7 @@ static struct file_desc_ops reg_desc_ops = {
.collect_fd = collect_reg_fd, .collect_fd = collect_reg_fd,
}; };
struct file_desc *collect_special_file(u32 id) struct file_desc *try_collect_special_file(u32 id, int optional)
{ {
struct file_desc *fdesc; struct file_desc *fdesc;
...@@ -1140,6 +1140,7 @@ struct file_desc *collect_special_file(u32 id) ...@@ -1140,6 +1140,7 @@ struct file_desc *collect_special_file(u32 id)
fdesc = find_file_desc_raw(FD_TYPES__REG, id); fdesc = find_file_desc_raw(FD_TYPES__REG, id);
if (fdesc == NULL) { if (fdesc == NULL) {
if (!optional)
pr_err("No entry for reg-file-ID %#x\n", id); pr_err("No entry for reg-file-ID %#x\n", id);
return NULL; return NULL;
} }
......
...@@ -40,7 +40,9 @@ extern int dump_one_reg_file(int lfd, u32 id, const struct fd_parms *p); ...@@ -40,7 +40,9 @@ extern int dump_one_reg_file(int lfd, u32 id, const struct fd_parms *p);
extern struct file_remap *lookup_ghost_remap(u32 dev, u32 ino); extern struct file_remap *lookup_ghost_remap(u32 dev, u32 ino);
extern void remap_put(struct file_remap *remap); extern void remap_put(struct file_remap *remap);
extern struct file_desc *collect_special_file(u32 id);
extern struct file_desc *try_collect_special_file(u32 id, int optional);
#define collect_special_file(id) try_collect_special_file(id, 0)
extern struct collect_image_info reg_file_cinfo; extern struct collect_image_info reg_file_cinfo;
extern struct collect_image_info remap_cinfo; extern struct collect_image_info remap_cinfo;
......
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