mirror of
https://github.com/checkpoint-restore/criu
synced 2025-08-30 05:48:05 +00:00
tty: Get driver for info once
Since we need tty driver for info, we may lookup the guy when collecting info, not when attaching it to a file. Signed-off-by: Pavel Emelyanov <xemul@virtuozzo.com> Signed-off-by: Andrei Vagin <avagin@virtuozzo.com>
This commit is contained in:
parent
081a312604
commit
c93edee2cb
15
criu/tty.c
15
criu/tty.c
@ -1504,6 +1504,7 @@ static int collect_one_tty_info_entry(void *obj, ProtobufCMessage *msg, struct c
|
||||
{
|
||||
struct tty_info *info, *n;
|
||||
TtyInfoEntry *tie;
|
||||
struct tty_driver *driver;
|
||||
|
||||
tie = pb_msg(msg, TtyInfoEntry);
|
||||
|
||||
@ -1529,11 +1530,19 @@ static int collect_one_tty_info_entry(void *obj, ProtobufCMessage *msg, struct c
|
||||
return -1;
|
||||
}
|
||||
|
||||
driver = get_tty_driver(tie->rdev, tie->dev);
|
||||
if (driver == NULL) {
|
||||
pr_err("Unable to find a tty driver (rdev %#x dev %#x)\n",
|
||||
tie->rdev, tie->dev);
|
||||
return -1;
|
||||
}
|
||||
|
||||
list_for_each_entry_safe(info, n, &collected_ttys, list) {
|
||||
if (info->tfe->tty_info_id != tie->id)
|
||||
continue;
|
||||
|
||||
info->tie = tie;
|
||||
info->driver = driver;
|
||||
list_move_tail(&info->list, &all_ttys);
|
||||
|
||||
if (tty_info_setup(info))
|
||||
@ -1578,12 +1587,6 @@ static int collect_one_tty(void *obj, ProtobufCMessage *msg, struct cr_img *i)
|
||||
static int tty_info_setup(struct tty_info *info)
|
||||
{
|
||||
INIT_LIST_HEAD(&info->sibling);
|
||||
info->driver = get_tty_driver(info->tie->rdev, info->tie->dev);
|
||||
if (info->driver == NULL) {
|
||||
pr_err("Unable to find a tty driver (rdev %#x dev %#x)\n",
|
||||
info->tie->rdev, info->tie->dev);
|
||||
return -1;
|
||||
}
|
||||
info->create = tty_is_master(info);
|
||||
info->inherit = false;
|
||||
info->ctl_tty = NULL;
|
||||
|
Loading…
x
Reference in New Issue
Block a user