mirror of
https://github.com/checkpoint-restore/criu
synced 2025-08-30 05:48:05 +00:00
rst: Compact file-descs collects a bit
Signed-off-by: Pavel Emelyanov <xemul@parallels.com>
This commit is contained in:
parent
e03ab6b409
commit
9917c4fe34
@ -122,10 +122,8 @@ static int collect_one_efd(void *obj, ProtobufCMessage *msg)
|
||||
struct eventfd_file_info *info = obj;
|
||||
|
||||
info->efe = pb_msg(msg, EventfdFileEntry);
|
||||
file_desc_add(&info->d, info->efe->id, &eventfd_desc_ops);
|
||||
pr_info_eventfd("Collected ", info->efe);
|
||||
|
||||
return 0;
|
||||
return file_desc_add(&info->d, info->efe->id, &eventfd_desc_ops);
|
||||
}
|
||||
|
||||
int collect_eventfd(void)
|
||||
|
@ -181,10 +181,8 @@ static int collect_one_epoll(void *o, ProtobufCMessage *msg)
|
||||
struct eventpoll_file_info *info = o;
|
||||
|
||||
info->efe = pb_msg(msg, EventpollFileEntry);
|
||||
file_desc_add(&info->d, info->efe->id, &desc_ops);
|
||||
pr_info_eventpoll("Collected ", info->efe);
|
||||
|
||||
return 0;
|
||||
return file_desc_add(&info->d, info->efe->id, &desc_ops);
|
||||
}
|
||||
|
||||
int collect_eventpoll(void)
|
||||
|
5
fifo.c
5
fifo.c
@ -125,8 +125,6 @@ static int collect_one_fifo(void *o, ProtobufCMessage *base)
|
||||
pr_info("Collected fifo entry ID %#x PIPE ID %#x\n",
|
||||
info->fe->id, info->fe->pipe_id);
|
||||
|
||||
file_desc_add(&info->d, info->fe->id, &fifo_desc_ops);
|
||||
|
||||
/* check who will restore the fifo data */
|
||||
list_for_each_entry(f, &fifo_head, list)
|
||||
if (f->fe->pipe_id == info->fe->pipe_id)
|
||||
@ -140,7 +138,8 @@ static int collect_one_fifo(void *o, ProtobufCMessage *base)
|
||||
info->restore_data = false;
|
||||
}
|
||||
|
||||
return 0;
|
||||
return file_desc_add(&info->d, info->fe->id, &fifo_desc_ops);
|
||||
|
||||
}
|
||||
|
||||
int collect_fifo(void)
|
||||
|
@ -556,9 +556,7 @@ static int collect_one_regfile(void *o, ProtobufCMessage *base)
|
||||
rfi->remap = NULL;
|
||||
|
||||
pr_info("Collected [%s] ID %#x\n", rfi->path, rfi->rfe->id);
|
||||
file_desc_add(&rfi->d, rfi->rfe->id, ®_desc_ops);
|
||||
|
||||
return 0;
|
||||
return file_desc_add(&rfi->d, rfi->rfe->id, ®_desc_ops);
|
||||
}
|
||||
|
||||
int prepare_shared_reg_files(void)
|
||||
|
4
files.c
4
files.c
@ -53,13 +53,15 @@ int prepare_shared_fdinfo(void)
|
||||
return 0;
|
||||
}
|
||||
|
||||
void file_desc_add(struct file_desc *d, u32 id, struct file_desc_ops *ops)
|
||||
int file_desc_add(struct file_desc *d, u32 id, struct file_desc_ops *ops)
|
||||
{
|
||||
d->id = id;
|
||||
d->ops = ops;
|
||||
INIT_LIST_HEAD(&d->fd_info_head);
|
||||
|
||||
hlist_add_head(&d->hash, &file_desc_hash[id % FDESC_HASH_SIZE]);
|
||||
|
||||
return 0; /* this is to make tail-calls in collect_one_foo look nice */
|
||||
}
|
||||
|
||||
struct file_desc *find_file_desc_raw(int type, u32 id)
|
||||
|
@ -455,10 +455,8 @@ static int collect_one_inotify(void *o, ProtobufCMessage *msg)
|
||||
info->ife = pb_msg(msg, InotifyFileEntry);
|
||||
INIT_LIST_HEAD(&info->marks);
|
||||
list_add(&info->list, &inotify_info_head);
|
||||
file_desc_add(&info->d, info->ife->id, &inotify_desc_ops);
|
||||
pr_info("Collected id 0x%08x flags 0x%08x\n", info->ife->id, info->ife->flags);
|
||||
|
||||
return 0;
|
||||
return file_desc_add(&info->d, info->ife->id, &inotify_desc_ops);
|
||||
}
|
||||
|
||||
static int collect_one_fanotify(void *o, ProtobufCMessage *msg)
|
||||
@ -468,10 +466,8 @@ static int collect_one_fanotify(void *o, ProtobufCMessage *msg)
|
||||
info->ffe = pb_msg(msg, FanotifyFileEntry);
|
||||
INIT_LIST_HEAD(&info->marks);
|
||||
list_add(&info->list, &fanotify_info_head);
|
||||
file_desc_add(&info->d, info->ffe->id, &fanotify_desc_ops);
|
||||
pr_info("Collected id 0x%08x flags 0x%08x\n", info->ffe->id, info->ffe->flags);
|
||||
|
||||
return 0;
|
||||
return file_desc_add(&info->d, info->ffe->id, &fanotify_desc_ops);
|
||||
}
|
||||
|
||||
static int collect_one_inotify_mark(void *o, ProtobufCMessage *msg)
|
||||
|
@ -117,7 +117,7 @@ struct parasite_drain_fd;
|
||||
int dump_task_files_seized(struct parasite_ctl *ctl, struct pstree_item *item,
|
||||
struct parasite_drain_fd *dfds);
|
||||
|
||||
extern void file_desc_add(struct file_desc *d, u32 id, struct file_desc_ops *ops);
|
||||
extern int file_desc_add(struct file_desc *d, u32 id, struct file_desc_ops *ops);
|
||||
extern struct fdinfo_list_entry *file_master(struct file_desc *d);
|
||||
extern struct file_desc *find_file_desc_raw(int type, u32 id);
|
||||
|
||||
|
@ -293,11 +293,8 @@ static int collect_one_nsfile(void *o, ProtobufCMessage *base)
|
||||
struct ns_file_info *nfi = o;
|
||||
|
||||
nfi->nfe = pb_msg(base, NsFileEntry);
|
||||
|
||||
pr_info("Collected ns file ID %#x NS-ID %#x\n", nfi->nfe->id, nfi->nfe->ns_id);
|
||||
file_desc_add(&nfi->d, nfi->nfe->id, &ns_desc_ops);
|
||||
|
||||
return 0;
|
||||
return file_desc_add(&nfi->d, nfi->nfe->id, &ns_desc_ops);
|
||||
}
|
||||
|
||||
int collect_ns_files(void)
|
||||
|
4
pipes.c
4
pipes.c
@ -375,8 +375,6 @@ static int collect_one_pipe(void *o, ProtobufCMessage *base)
|
||||
pr_info("Collected pipe entry ID %#x PIPE ID %#x\n",
|
||||
pi->pe->id, pi->pe->pipe_id);
|
||||
|
||||
file_desc_add(&pi->d, pi->pe->id, &pipe_desc_ops);
|
||||
|
||||
list_for_each_entry(tmp, &pipes, list)
|
||||
if (pi->pe->pipe_id == tmp->pe->pipe_id)
|
||||
break;
|
||||
@ -387,8 +385,8 @@ static int collect_one_pipe(void *o, ProtobufCMessage *base)
|
||||
list_add(&pi->pipe_list, &tmp->pipe_list);
|
||||
|
||||
list_add_tail(&pi->list, &pipes);
|
||||
return file_desc_add(&pi->d, pi->pe->id, &pipe_desc_ops);
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
int collect_pipes(void)
|
||||
|
@ -117,9 +117,7 @@ static int collect_one_sigfd(void *o, ProtobufCMessage *msg)
|
||||
struct signalfd_info *info = o;
|
||||
|
||||
info->sfe = pb_msg(msg, SignalfdEntry);
|
||||
file_desc_add(&info->d, info->sfe->id, &signalfd_desc_ops);
|
||||
|
||||
return 0;
|
||||
return file_desc_add(&info->d, info->sfe->id, &signalfd_desc_ops);
|
||||
}
|
||||
|
||||
int collect_signalfd(void)
|
||||
|
@ -386,7 +386,6 @@ static int collect_one_inetsk(void *o, ProtobufCMessage *base)
|
||||
struct inet_sk_info *ii = o;
|
||||
|
||||
ii->ie = pb_msg(base, InetSkEntry);
|
||||
file_desc_add(&ii->d, ii->ie->id, &inet_desc_ops);
|
||||
if (tcp_connection(ii->ie))
|
||||
tcp_locked_conn_add(ii);
|
||||
|
||||
@ -399,7 +398,7 @@ static int collect_one_inetsk(void *o, ProtobufCMessage *base)
|
||||
if (ii->port == NULL)
|
||||
return -1;
|
||||
|
||||
return 0;
|
||||
return file_desc_add(&ii->d, ii->ie->id, &inet_desc_ops);
|
||||
}
|
||||
|
||||
int collect_inet_sockets(void)
|
||||
|
@ -231,9 +231,7 @@ static int collect_one_netlink_sk(void *o, ProtobufCMessage *base)
|
||||
struct netlink_sock_info *si = o;
|
||||
|
||||
si->nse = pb_msg(base, NetlinkSkEntry);
|
||||
file_desc_add(&si->d, si->nse->id, &netlink_sock_desc_ops);
|
||||
|
||||
return 0;
|
||||
return file_desc_add(&si->d, si->nse->id, &netlink_sock_desc_ops);
|
||||
}
|
||||
|
||||
int collect_netlink_sockets(void)
|
||||
|
@ -496,9 +496,7 @@ static int collect_one_packet_sk(void *o, ProtobufCMessage *base)
|
||||
struct packet_sock_info *si = o;
|
||||
|
||||
si->pse = pb_msg(base, PacketSockEntry);
|
||||
file_desc_add(&si->d, si->pse->id, &packet_sock_desc_ops);
|
||||
|
||||
return 0;
|
||||
return file_desc_add(&si->d, si->pse->id, &packet_sock_desc_ops);
|
||||
}
|
||||
|
||||
int collect_packet_sockets(void)
|
||||
|
@ -822,10 +822,8 @@ static int collect_one_unixsk(void *o, ProtobufCMessage *base)
|
||||
pr_info(" `- Got %#x peer %#x (name %s)\n",
|
||||
ui->ue->ino, ui->ue->peer,
|
||||
ui->name ? (ui->name[0] ? ui->name : &ui->name[1]) : "-");
|
||||
file_desc_add(&ui->d, ui->ue->id, &unix_desc_ops);
|
||||
list_add_tail(&ui->list, &unix_sockets);
|
||||
|
||||
return 0;
|
||||
return file_desc_add(&ui->d, ui->ue->id, &unix_desc_ops);
|
||||
}
|
||||
|
||||
int collect_unix_sockets(void)
|
||||
|
4
tty.c
4
tty.c
@ -972,9 +972,7 @@ static int collect_one_tty(void *obj, ProtobufCMessage *msg)
|
||||
pr_info("Collected tty ID %#x\n", info->tfe->id);
|
||||
|
||||
list_add(&info->list, &all_ttys);
|
||||
file_desc_add(&info->d, info->tfe->id, &tty_desc_ops);
|
||||
|
||||
return 0;
|
||||
return file_desc_add(&info->d, info->tfe->id, &tty_desc_ops);
|
||||
}
|
||||
|
||||
int collect_tty(void)
|
||||
|
Loading…
x
Reference in New Issue
Block a user