Commit 5360ed76 authored by Kirill Tkhai's avatar Kirill Tkhai Committed by Pavel Emelyanov

files: Kill file_desc_options::collect_fd()

The only user is fifo, but it uses collect_fd()
to do read only actions (the only change is
fifo_info::reg_d population, which may be easily
moved to open_fifo_fd()).

So, move the collect_special_file() functionality
from collect_fifo_fd() to open_fifo_fd() and
kill collect_fd method at all.
Signed-off-by: 's avatarKirill Tkhai <ktkhai@virtuozzo.com>
parent dc89ac65
......@@ -33,7 +33,6 @@ struct fifo_info {
struct file_desc d;
FifoEntry *fe;
bool restore_data;
struct file_desc *reg_d;
};
static LIST_HEAD(fifo_head);
......@@ -114,29 +113,22 @@ out:
static int open_fifo_fd(struct file_desc *d, int *new_fd)
{
struct fifo_info *info = container_of(d, struct fifo_info, d);
struct file_desc *reg_d;
int fd;
fd = open_path(info->reg_d, do_open_fifo, info);
reg_d = find_file_desc_raw(FD_TYPES__REG, info->fe->id);
BUG_ON(!reg_d);
fd = open_path(reg_d, do_open_fifo, info);
if (fd < 0)
return -1;
*new_fd = fd;
return 0;
}
static void collect_fifo_fd(struct file_desc *d,
struct fdinfo_list_entry *fle, struct rst_info *ri)
{
struct fifo_info *info;
info = container_of(d, struct fifo_info, d);
info->reg_d = collect_special_file(info->fe->id);
BUG_ON(info->reg_d == NULL);
}
static struct file_desc_ops fifo_desc_ops = {
.type = FD_TYPES__FIFO,
.open = open_fifo_fd,
.collect_fd = collect_fifo_fd,
};
static int collect_one_fifo(void *o, ProtobufCMessage *base, struct cr_img *i)
......
......@@ -731,9 +731,6 @@ int collect_fd(int pid, FdinfoEntry *e, struct rst_info *rst_info, bool fake)
if (pid_rst_prio(new_le->pid, le->pid))
break;
if (fdesc->ops->collect_fd)
fdesc->ops->collect_fd(fdesc, new_le, rst_info);
collect_task_fd(new_le, rst_info);
list_add_tail(&new_le->desc_list, &le->desc_list);
......
......@@ -106,13 +106,6 @@ struct file_desc_ops {
* so it shouldn't be saved for any post-actions.
*/
int (*open)(struct file_desc *d, int *new_fd);
/*
* Called to collect a new fd before adding it on desc. Clients
* may chose to collect it to some specific rst_info list. See
* prepare_fds() for details.
*/
void (*collect_fd)(struct file_desc *, struct fdinfo_list_entry *,
struct rst_info *);
char * (*name)(struct file_desc *, char *b, size_t s);
};
......
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