mirror of
https://github.com/checkpoint-restore/criu
synced 2025-08-31 06:15:24 +00:00
files: Add file_desc_init helper
To use it in tty code even when file descriptor is not added into files chain. Signed-off-by: Cyrill Gorcunov <gorcunov@openvz.org> Acked-by: Tycho Andersen <tycho.andersen@canonical.com> Signed-off-by: Pavel Emelyanov <xemul@parallels.com>
This commit is contained in:
committed by
Pavel Emelyanov
parent
09aa15c7a3
commit
81c598cc05
15
files.c
15
files.c
@@ -60,14 +60,19 @@ int prepare_shared_fdinfo(void)
|
||||
return 0;
|
||||
}
|
||||
|
||||
void file_desc_init(struct file_desc *d, u32 id, struct file_desc_ops *ops)
|
||||
{
|
||||
INIT_LIST_HEAD(&d->fd_info_head);
|
||||
INIT_HLIST_NODE(&d->hash);
|
||||
|
||||
d->id = id;
|
||||
d->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);
|
||||
|
||||
file_desc_init(d, id, ops);
|
||||
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 */
|
||||
}
|
||||
|
||||
|
Reference in New Issue
Block a user