Commit 347d670f authored by Pavel Emelyanov's avatar Pavel Emelyanov

tty: Setup tty slavery via post_cb engine

Signed-off-by: 's avatarPavel Emelyanov <xemul@virtuozzo.com>
parent 92eb5ff5
...@@ -268,10 +268,6 @@ static int root_prepare_shared(void) ...@@ -268,10 +268,6 @@ static int root_prepare_shared(void)
if (ret < 0) if (ret < 0)
goto err; goto err;
ret = tty_setup_slavery();
if (ret)
goto err;
ret = prepare_restorer_blob(); ret = prepare_restorer_blob();
if (ret) if (ret)
goto err; goto err;
......
...@@ -22,7 +22,6 @@ extern int dump_verify_tty_sids(void); ...@@ -22,7 +22,6 @@ extern int dump_verify_tty_sids(void);
extern struct collect_image_info tty_info_cinfo; extern struct collect_image_info tty_info_cinfo;
extern struct collect_image_info tty_cinfo; extern struct collect_image_info tty_cinfo;
extern int prepare_shared_tty(void); extern int prepare_shared_tty(void);
extern int tty_setup_slavery(void);
extern int tty_verify_active_pairs(void); extern int tty_verify_active_pairs(void);
......
...@@ -15,6 +15,7 @@ ...@@ -15,6 +15,7 @@
#include "compiler.h" #include "compiler.h"
#include "asm/types.h" #include "asm/types.h"
#include "crtools.h"
#include "files.h" #include "files.h"
#include "cr_options.h" #include "cr_options.h"
#include "imgset.h" #include "imgset.h"
...@@ -1221,7 +1222,7 @@ static int tty_setup_orphan_slavery(void) ...@@ -1221,7 +1222,7 @@ static int tty_setup_orphan_slavery(void)
return 0; return 0;
} }
int tty_setup_slavery(void) static int tty_setup_slavery(void * unused)
{ {
struct tty_info *info, *peer, *m; struct tty_info *info, *peer, *m;
...@@ -1452,6 +1453,15 @@ static int collect_one_tty(void *obj, ProtobufCMessage *msg) ...@@ -1452,6 +1453,15 @@ static int collect_one_tty(void *obj, ProtobufCMessage *msg)
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 (list_empty(&all_ttys))
/*
* XXX -- not every tty requires this.
* Check that we have such here and queue
* post-cb only if required.
*/
if (add_post_prepare_cb(tty_setup_slavery, NULL))
return -1;
list_add(&info->list, &all_ttys); list_add(&info->list, &all_ttys);
return file_desc_add(&info->d, info->tfe->id, &tty_desc_ops); return file_desc_add(&info->d, info->tfe->id, &tty_desc_ops);
} }
......
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