2
0
mirror of https://github.com/checkpoint-restore/criu synced 2025-09-02 15:25:21 +00:00

fifo: Don't lookup reg path twice

Same for previous patch with vmas -- we do it on collect and
on real open. Just put the pointer on fifo_info structure.

Signed-off-by: Pavel Emelyanov <xemul@parallels.com>
This commit is contained in:
Pavel Emelyanov
2014-02-07 13:55:27 +04:00
parent dc7abdfb92
commit b0c0933744
3 changed files with 7 additions and 7 deletions

8
fifo.c
View File

@@ -33,6 +33,7 @@ struct fifo_info {
struct file_desc d; struct file_desc d;
FifoEntry *fe; FifoEntry *fe;
bool restore_data; bool restore_data;
struct file_desc *reg_d;
}; };
static LIST_HEAD(fifo_head); static LIST_HEAD(fifo_head);
@@ -109,7 +110,7 @@ static int open_fifo_fd(struct file_desc *d)
{ {
struct fifo_info *info = container_of(d, struct fifo_info, d); struct fifo_info *info = container_of(d, struct fifo_info, d);
return open_path_by_id(info->fe->id, do_open_fifo, info); return open_path(info->reg_d, do_open_fifo, info);
} }
static void collect_fifo_fd(struct file_desc *d, static void collect_fifo_fd(struct file_desc *d,
@@ -118,9 +119,8 @@ static void collect_fifo_fd(struct file_desc *d,
struct fifo_info *info; struct fifo_info *info;
info = container_of(d, struct fifo_info, d); info = container_of(d, struct fifo_info, d);
if (collect_special_file(info->fe->id) == NULL) info->reg_d = collect_special_file(info->fe->id);
BUG(); BUG_ON(info->reg_d == NULL);
collect_gen_fd(fle, ri); collect_gen_fd(fle, ri);
} }

View File

@@ -581,7 +581,7 @@ const struct fdtype_ops regfile_dump_ops = {
.dump = dump_one_reg_file, .dump = dump_one_reg_file,
}; };
static int open_path(struct file_desc *d, int open_path(struct file_desc *d,
int(*open_cb)(struct reg_file_info *, void *), void *arg) int(*open_cb)(struct reg_file_info *, void *), void *arg)
{ {
struct reg_file_info *rfi; struct reg_file_info *rfi;
@@ -620,7 +620,7 @@ static int open_path(struct file_desc *d,
return tmp; return tmp;
} }
int open_path_by_id(u32 id, int (*open_cb)(struct reg_file_info *, void *), void *arg) static int open_path_by_id(u32 id, int (*open_cb)(struct reg_file_info *, void *), void *arg)
{ {
struct file_desc *fd; struct file_desc *fd;

View File

@@ -24,7 +24,7 @@ struct reg_file_info {
}; };
extern int open_reg_by_id(u32 id); extern int open_reg_by_id(u32 id);
extern int open_path_by_id(u32 id, int (*open_cb)(struct reg_file_info *, void *), void *arg); extern int open_path(struct file_desc *, int (*open_cb)(struct reg_file_info *, void *), void *arg);
extern void clear_ghost_files(void); extern void clear_ghost_files(void);
extern int prepare_shared_reg_files(void); extern int prepare_shared_reg_files(void);