Commit a216fb1e authored by Pavel Emelyanov's avatar Pavel Emelyanov Committed by Andrei Vagin

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: 's avatarPavel Emelyanov <xemul@virtuozzo.com>
parent 77443aa5
...@@ -372,7 +372,7 @@ static int tty_get_index(u32 id) ...@@ -372,7 +372,7 @@ static int tty_get_index(u32 id)
} }
/* Make sure the active pairs do exist */ /* 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; unsigned long i, unpaired_slaves = 0;
...@@ -1360,7 +1360,7 @@ static int tty_setup_orphan_slavery(void) ...@@ -1360,7 +1360,7 @@ static int tty_setup_orphan_slavery(void)
return 0; return 0;
} }
static int tty_setup_slavery(void * unused) static int tty_setup_slavery(void)
{ {
struct tty_info *info, *peer, *m; struct tty_info *info, *peer, *m;
...@@ -1556,6 +1556,15 @@ struct collect_image_info tty_info_cinfo = { ...@@ -1556,6 +1556,15 @@ struct collect_image_info tty_info_cinfo = {
.collect = collect_one_tty_info_entry, .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) static int collect_one_tty(void *obj, ProtobufCMessage *msg, struct cr_img *i)
{ {
struct tty_info *info = obj; struct tty_info *info = obj;
...@@ -1626,8 +1635,7 @@ static int collect_one_tty(void *obj, ProtobufCMessage *msg, struct cr_img *i) ...@@ -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); 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) || if (add_post_prepare_cb_once(prep_tty_restore, NULL))
add_post_prepare_cb_once(tty_setup_slavery, NULL))
return -1; return -1;
info->fdstore_id = -1; info->fdstore_id = -1;
...@@ -2152,7 +2160,7 @@ int tty_post_actions(void) ...@@ -2152,7 +2160,7 @@ int tty_post_actions(void)
{ {
if (tty_verify_ctty()) if (tty_verify_ctty())
return -1; return -1;
if (tty_verify_active_pairs(NULL)) if (tty_verify_active_pairs())
return -1; return -1;
else if (tty_dump_queued_data()) else if (tty_dump_queued_data())
return -1; return -1;
......
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