[lxc-devel] [lxc/master] Comment the lxc_rootfs structure

hallyn on Github lxc-bot at linuxcontainers.org
Wed Feb 3 03:28:32 UTC 2016


A non-text attachment was scrubbed...
Name: not available
Type: text/x-mailbox
Size: 697 bytes
Desc: not available
URL: <http://lists.linuxcontainers.org/pipermail/lxc-devel/attachments/20160203/d3a8ef3e/attachment.bin>
-------------- next part --------------
From f64f184ba10d9f6431d1f8a2fca37afc15040048 Mon Sep 17 00:00:00 2001
From: Serge Hallyn <serge.hallyn at ubuntu.com>
Date: Tue, 2 Feb 2016 19:20:05 -0800
Subject: [PATCH] Comment the lxc_rootfs structure

Comment rootfs.path and rootfs.mount so people can better figure
out which to use.

Remove the unused pivotdir argument from setup_rootfs_pivot_root().
Remove the unused pivot member of the lxc_rootfs struct.  And just
return 0 (success) when someone passes a lxc.pivotdir entry.  One
day we'll turn that into an error, but not yet...

Signed-off-by: Serge Hallyn <serge.hallyn at ubuntu.com>
---
 src/lxc/conf.c    | 5 ++---
 src/lxc/conf.h    | 6 +++---
 src/lxc/confile.c | 4 +---
 3 files changed, 6 insertions(+), 9 deletions(-)

diff --git a/src/lxc/conf.c b/src/lxc/conf.c
index e3cf447..fd3231d 100644
--- a/src/lxc/conf.c
+++ b/src/lxc/conf.c
@@ -998,7 +998,7 @@ static int setup_tty(struct lxc_conf *conf)
 }
 
 
-static int setup_rootfs_pivot_root(const char *rootfs, const char *pivotdir)
+static int setup_rootfs_pivot_root(const char *rootfs)
 {
 	int oldroot = -1, newroot = -1;
 
@@ -1330,7 +1330,7 @@ static int setup_pivot_root(const struct lxc_rootfs *rootfs)
 	if (detect_ramfs_rootfs()) {
 		if (prepare_ramfs_root(rootfs->mount))
 			return -1;
-	} else if (setup_rootfs_pivot_root(rootfs->mount, rootfs->pivot)) {
+	} else if (setup_rootfs_pivot_root(rootfs->mount)) {
 		ERROR("failed to setup pivot root");
 		return -1;
 	}
@@ -4196,7 +4196,6 @@ void lxc_conf_free(struct lxc_conf *conf)
 	free(conf->rootfs.mount);
 	free(conf->rootfs.options);
 	free(conf->rootfs.path);
-	free(conf->rootfs.pivot);
 	free(conf->logfile);
 	if (conf->logfd != -1)
 		close(conf->logfd);
diff --git a/src/lxc/conf.h b/src/lxc/conf.h
index f2323f6..d3cd0b3 100644
--- a/src/lxc/conf.h
+++ b/src/lxc/conf.h
@@ -217,13 +217,13 @@ struct lxc_console {
 /*
  * Defines a structure to store the rootfs location, the
  * optionals pivot_root, rootfs mount paths
- * @rootfs     : a path to the rootfs
- * @pivot_root : a path to a pivot_root location to be used
+ * @path       : the rootfs source (directory or device)
+ * @mount      : where it is mounted
+ * @options    : mount options
  */
 struct lxc_rootfs {
 	char *path;
 	char *mount;
-	char *pivot;
 	char *options;
 };
 
diff --git a/src/lxc/confile.c b/src/lxc/confile.c
index c81ba45..6fcfb12 100644
--- a/src/lxc/confile.c
+++ b/src/lxc/confile.c
@@ -1857,7 +1857,7 @@ static int config_pivotdir(const char *key, const char *value,
 			   struct lxc_conf *lxc_conf)
 {
 	WARN("lxc.pivotdir is ignored.  It will soon become an error.");
-	return config_path_item(&lxc_conf->rootfs.pivot, value);
+	return 0;
 }
 
 static int config_utsname(const char *key, const char *value,
@@ -2478,8 +2478,6 @@ int lxc_get_config_item(struct lxc_conf *c, const char *key, char *retv,
 		v = c->rootfs.options;
 	else if (strcmp(key, "lxc.rootfs") == 0)
 		v = c->rootfs.path;
-	else if (strcmp(key, "lxc.pivotdir") == 0)
-		v = c->rootfs.pivot;
 	else if (strcmp(key, "lxc.cap.drop") == 0)
 		return lxc_get_item_cap_drop(c, retv, inlen);
 	else if (strcmp(key, "lxc.cap.keep") == 0)


More information about the lxc-devel mailing list