Move configuration informations from the handler structure to
the configuration structure.

Signed-off-by: Daniel Lezcano <dlezcano@fr.ibm.com>
---
 src/lxc/commands.c |    2 +-
 src/lxc/conf.c     |   19 ++++++++++---------
 src/lxc/conf.h     |   40 +++++++++++++++++++++-------------------
 src/lxc/console.c  |    2 +-
 src/lxc/start.c    |   14 +++++++-------
 src/lxc/start.h    |    4 +---
 6 files changed, 41 insertions(+), 40 deletions(-)

Index: lxc/src/lxc/conf.c
===================================================================
--- lxc.orig/src/lxc/conf.c
+++ lxc/src/lxc/conf.c
@@ -1236,6 +1236,7 @@ int lxc_conf_init(struct lxc_conf *conf)
 	conf->utsname = NULL;
 	conf->tty = 0;
 	conf->pts = 0;
+	conf->console[0] = '\0';
 	lxc_list_init(&conf->cgroup);
 	lxc_list_init(&conf->networks);
 	return 0;
@@ -1613,44 +1614,44 @@ void lxc_delete_tty(struct lxc_tty_info 
 	tty_info->nbtty = 0;
 }
 
-int lxc_setup(const char *name, struct lxc_handler *handler)
+int lxc_setup(const char *name, struct lxc_conf *lxc_conf)
 {
-	if (setup_utsname(handler->lxc_conf.utsname)) {
+	if (setup_utsname(lxc_conf->utsname)) {
 		ERROR("failed to setup the utsname for '%s'", name);
 		return -1;
 	}
 
-	if (!lxc_list_empty(&handler->lxc_conf.networks) && setup_network(name)) {
+	if (!lxc_list_empty(&lxc_conf->networks) && setup_network(name)) {
 		ERROR("failed to setup the network for '%s'", name);
 		return -1;
 	}
 
-	if (setup_cgroup(name, &handler->lxc_conf.cgroup)) {
+	if (setup_cgroup(name, &lxc_conf->cgroup)) {
 		ERROR("failed to setup the cgroups for '%s'", name);
 		return -1;
 	}
 
-	if (setup_mount(handler->lxc_conf.fstab)) {
+	if (setup_mount(lxc_conf->fstab)) {
 		ERROR("failed to setup the mounts for '%s'", name);
 		return -1;
 	}
 
-	if (setup_console(handler->lxc_conf.rootfs, handler->tty)) {
+	if (setup_console(lxc_conf->rootfs, lxc_conf->console)) {
 		ERROR("failed to setup the console for '%s'", name);
 		return -1;
 	}
 
-	if (setup_tty(handler->lxc_conf.rootfs, &handler->tty_info)) {
+	if (setup_tty(lxc_conf->rootfs, &lxc_conf->tty_info)) {
 		ERROR("failed to setup the ttys for '%s'", name);
 		return -1;
 	}
 
-	if (setup_rootfs(handler->lxc_conf.rootfs)) {
+	if (setup_rootfs(lxc_conf->rootfs)) {
 		ERROR("failed to set rootfs for '%s'", name);
 		return -1;
 	}
 
-	if (setup_pts(handler->lxc_conf.pts)) {
+	if (setup_pts(lxc_conf->pts)) {
 		ERROR("failed to setup the new pts instance");
 		return -1;
 	}
Index: lxc/src/lxc/conf.h
===================================================================
--- lxc.orig/src/lxc/conf.h
+++ lxc/src/lxc/conf.h
@@ -110,24 +110,6 @@ struct lxc_cgroup {
 };
 
 /*
- * Defines the global container configuration
- * @rootfs  : the root directory to run the container
- * @mount   : the list of mount points
- * @network : the network configuration
- * @utsname : the container utsname
- */
-struct lxc_conf {
-	const char *rcfile;
-	char *rootfs;
-	char *fstab;
-	int tty;
-	int pts;
-	struct utsname *utsname;
-	struct lxc_list cgroup;
-	struct lxc_list networks;
-};
-
-/*
  * Defines a structure containing a pty information for
  * virtualizing a tty
  * @name   : the path name of the slave pty side
@@ -152,6 +134,26 @@ struct lxc_tty_info {
 };
 
 /*
+ * Defines the global container configuration
+ * @rootfs  : the root directory to run the container
+ * @mount   : the list of mount points
+ * @network : the network configuration
+ * @utsname : the container utsname
+ */
+struct lxc_conf {
+	const char *rcfile;
+	char *rootfs;
+	char *fstab;
+	int tty;
+	int pts;
+	struct utsname *utsname;
+	struct lxc_list cgroup;
+	struct lxc_list networks;
+	struct lxc_tty_info tty_info;
+	char console[MAXPATHLEN];
+};
+
+/*
  * Initialize the lxc configuration structure
  */
 extern int lxc_conf_init(struct lxc_conf *conf);
@@ -179,7 +181,7 @@ extern void lxc_delete_tty(struct lxc_tt
 
 struct lxc_handler;
 
-extern int lxc_setup(const char *name, struct lxc_handler *handler);
+extern int lxc_setup(const char *name, struct lxc_conf *lxc_conf);
 
 extern int conf_has(const char *name, const char *info);
 
Index: lxc/src/lxc/start.c
===================================================================
--- lxc.orig/src/lxc/start.c
+++ lxc/src/lxc/start.c
@@ -256,7 +256,7 @@ struct lxc_handler *lxc_init(const char 
 		goto out_put_lock;
 	}
 
-	if (lxc_conf_init(&handler->lxc_conf)) {
+	if (lxc_conf_init(&handler->conf)) {
 		ERROR("failed to initialize the configuration");
 		goto out_aborting;
 	}
@@ -265,18 +265,18 @@ struct lxc_handler *lxc_init(const char 
 
 	if (!access(path, F_OK)) {
 
-		if (lxc_config_read(path, &handler->lxc_conf)) {
+		if (lxc_config_read(path, &handler->conf)) {
 			ERROR("failed to read the configuration file");
 			goto out_aborting;
 		}
 	}
 
-	if (console_init(handler->tty, sizeof(handler->tty))) {
+	if (console_init(handler->conf.console, sizeof(handler->conf.console))) {
 		ERROR("failed to initialize the console");
 		goto out_aborting;
 	}
 
-	if (lxc_create_tty(name, &handler->tty_info)) {
+	if (lxc_create_tty(name, &handler->conf.tty_info)) {
 		ERROR("failed to create the ttys");
 		goto out_aborting;
 	}
@@ -301,7 +301,7 @@ out:
 	return handler;
 
 out_delete_tty:
-	lxc_delete_tty(&handler->tty_info);
+	lxc_delete_tty(&handler->conf.tty_info);
 out_aborting:
 	set_state(name, handler, ABORTING);
 out_put_lock:
@@ -323,7 +323,7 @@ void lxc_fini(const char *name, struct l
 
 	if (handler) {
 		remove_init_pid(name, handler->pid);
-		lxc_delete_tty(&handler->tty_info);
+		lxc_delete_tty(&handler->conf.tty_info);
 		lxc_put_lock(handler->lock);
 		free(handler);
 	}
@@ -377,7 +377,7 @@ static int do_start(void *arg)
 	}
 
 	/* Setup the container, ip, names, utsname, ... */
-	if (lxc_setup(name, handler)) {
+	if (lxc_setup(name, &handler->conf)) {
 		ERROR("failed to setup the container");
 		goto out_warn_father;
 	}
Index: lxc/src/lxc/start.h
===================================================================
--- lxc.orig/src/lxc/start.h
+++ lxc/src/lxc/start.h
@@ -28,11 +28,9 @@ struct lxc_handler {
 
 	int sigfd;
 	int lock;
-	char tty[MAXPATHLEN];
 	char nsgroup[MAXPATHLEN];
 	sigset_t oldmask;
-	struct lxc_tty_info tty_info;
-	struct lxc_conf lxc_conf;
+	struct lxc_conf conf;
 };
 
 extern struct lxc_handler *lxc_init(const char *name);
Index: lxc/src/lxc/commands.c
===================================================================
--- lxc.orig/src/lxc/commands.c
+++ lxc/src/lxc/commands.c
@@ -132,7 +132,7 @@ static int trigger_command(int fd, struc
 static void command_fd_cleanup(int fd, struct lxc_handler *handler,
 			       struct lxc_epoll_descr *descr)
 {
-	lxc_console_remove_fd(fd, &handler->tty_info);
+	lxc_console_remove_fd(fd, &handler->conf.tty_info);
 	lxc_mainloop_del_handler(descr, fd);
 	close(fd);
 }
Index: lxc/src/lxc/console.c
===================================================================
--- lxc.orig/src/lxc/console.c
+++ lxc/src/lxc/console.c
@@ -95,7 +95,7 @@ extern int lxc_console_callback(int fd, 
 			struct lxc_handler *handler)
 {
 	int ttynum = request->data;
-	struct lxc_tty_info *tty_info = &handler->tty_info;
+	struct lxc_tty_info *tty_info = &handler->conf.tty_info;
 
 	if (ttynum > 0) {
 		if (ttynum > tty_info->nbtty)



