mirror of
https://github.com/checkpoint-restore/criu
synced 2025-08-30 22:05:36 +00:00
tty: Merge tty post actions
No need to schedule both post-actions, we can merge them. This also sanitizes the "void *unised" arguments for both. ✓ travis-ci: success for Sanitize initialization bits Signed-off-by: Pavel Emelyanov <xemul@virtuozzo.com>
This commit is contained in:
committed by
Andrei Vagin
parent
77443aa520
commit
a216fb1e5e
18
criu/tty.c
18
criu/tty.c
@@ -372,7 +372,7 @@ static int tty_get_index(u32 id)
|
||||
}
|
||||
|
||||
/* Make sure the active pairs do exist */
|
||||
static int tty_verify_active_pairs(void * unused)
|
||||
static int tty_verify_active_pairs(void)
|
||||
{
|
||||
unsigned long i, unpaired_slaves = 0;
|
||||
|
||||
@@ -1360,7 +1360,7 @@ static int tty_setup_orphan_slavery(void)
|
||||
return 0;
|
||||
}
|
||||
|
||||
static int tty_setup_slavery(void * unused)
|
||||
static int tty_setup_slavery(void)
|
||||
{
|
||||
struct tty_info *info, *peer, *m;
|
||||
|
||||
@@ -1556,6 +1556,15 @@ struct collect_image_info tty_info_cinfo = {
|
||||
.collect = collect_one_tty_info_entry,
|
||||
};
|
||||
|
||||
static int prep_tty_restore(void *unused)
|
||||
{
|
||||
if (tty_verify_active_pairs())
|
||||
return -1;
|
||||
if (tty_setup_slavery())
|
||||
return -1;
|
||||
return 0;
|
||||
}
|
||||
|
||||
static int collect_one_tty(void *obj, ProtobufCMessage *msg, struct cr_img *i)
|
||||
{
|
||||
struct tty_info *info = obj;
|
||||
@@ -1626,8 +1635,7 @@ static int collect_one_tty(void *obj, ProtobufCMessage *msg, struct cr_img *i)
|
||||
|
||||
pr_info("Collected tty ID %#x (%s)\n", info->tfe->id, info->driver->name);
|
||||
|
||||
if (add_post_prepare_cb_once(tty_verify_active_pairs, NULL) ||
|
||||
add_post_prepare_cb_once(tty_setup_slavery, NULL))
|
||||
if (add_post_prepare_cb_once(prep_tty_restore, NULL))
|
||||
return -1;
|
||||
|
||||
info->fdstore_id = -1;
|
||||
@@ -2152,7 +2160,7 @@ int tty_post_actions(void)
|
||||
{
|
||||
if (tty_verify_ctty())
|
||||
return -1;
|
||||
if (tty_verify_active_pairs(NULL))
|
||||
if (tty_verify_active_pairs())
|
||||
return -1;
|
||||
else if (tty_dump_queued_data())
|
||||
return -1;
|
||||
|
Reference in New Issue
Block a user