[lxc-devel] [PATCH 5/5] use defined rootfs mount point

Daniel Lezcano dlezcano at fr.ibm.com
Wed May 12 11:00:26 UTC 2010


From: Daniel Lezcano <daniel.lezcano at free.fr>

As we defined a path where to mount the rootfs, we can use without
ambiguity because it is defined by default at compile time or by the
configuration.

Signed-off-by: Daniel Lezcano <dlezcano at fr.ibm.com>
---
 src/lxc/conf.c |   13 ++++++++-----
 1 files changed, 8 insertions(+), 5 deletions(-)

diff --git a/src/lxc/conf.c b/src/lxc/conf.c
index 55eb715..2b8ddf4 100644
--- a/src/lxc/conf.c
+++ b/src/lxc/conf.c
@@ -582,19 +582,22 @@ static int setup_rootfs_pivot_root(const char *rootfs, const char *pivotdir)
 
 static int setup_rootfs(const struct lxc_rootfs *rootfs)
 {
-	const char *tmpfs = "/tmp";
+	char *mpath = LXCROOTFSMOUNT;
 
 	if (!rootfs->path)
 		return 0;
 
-	if (mount(rootfs->path, tmpfs, "none", MS_BIND|MS_REC, NULL)) {
-		SYSERROR("failed to mount '%s'->'%s'", rootfs->path, "/tmp");
+	if (rootfs->mount)
+		mpath = rootfs->mount;
+
+	if (mount(rootfs->path, mpath, "none", MS_BIND|MS_REC, NULL)) {
+		SYSERROR("failed to mount '%s'->'%s'", rootfs->path, mpath);
 		return -1;
 	}
 
-	DEBUG("mounted '%s' on '%s'", rootfs->path, tmpfs);
+	DEBUG("mounted '%s' on '%s'", rootfs->path, mpath);
 
-	if (setup_rootfs_pivot_root(tmpfs, rootfs->pivot)) {
+	if (setup_rootfs_pivot_root(mpath, rootfs->pivot)) {
 		ERROR("failed to pivot_root to '%s'", rootfs->pivot);
 		return -1;
 	}
-- 
1.6.3.3





More information about the lxc-devel mailing list