Commit b0c09337 authored by Pavel Emelyanov's avatar Pavel Emelyanov

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: 's avatarPavel Emelyanov <xemul@parallels.com>
parent dc7abdfb
......@@ -33,6 +33,7 @@ struct fifo_info {
struct file_desc d;
FifoEntry *fe;
bool restore_data;
struct file_desc *reg_d;
};
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);
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,
......@@ -118,9 +119,8 @@ static void collect_fifo_fd(struct file_desc *d,
struct fifo_info *info;
info = container_of(d, struct fifo_info, d);
if (collect_special_file(info->fe->id) == NULL)
BUG();
info->reg_d = collect_special_file(info->fe->id);
BUG_ON(info->reg_d == NULL);
collect_gen_fd(fle, ri);
}
......
......@@ -581,7 +581,7 @@ const struct fdtype_ops regfile_dump_ops = {
.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)
{
struct reg_file_info *rfi;
......@@ -620,7 +620,7 @@ static int open_path(struct file_desc *d,
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;
......
......@@ -24,7 +24,7 @@ struct reg_file_info {
};
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 int prepare_shared_reg_files(void);
......
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