Skip site navigation (1)Skip section navigation (2)
Date:      Sat, 11 Aug 2018 01:02:27 +0000 (UTC)
From:      Kyle Evans <kevans@FreeBSD.org>
To:        src-committers@freebsd.org, svn-src-projects@freebsd.org
Subject:   svn commit: r337596 - in projects/bectl: lib/libbe sbin/bectl
Message-ID:  <201808110102.w7B12RlQ040373@repo.freebsd.org>

next in thread | raw e-mail | index | archive | help
Author: kevans
Date: Sat Aug 11 01:02:27 2018
New Revision: 337596
URL: https://svnweb.freebsd.org/changeset/base/337596

Log:
  libbe(3)/bectl(8): Kill off the 'add' functionality for now
  
  The mostly-undocumented 'add' functionality, from initial read-through, is
  intended for construction of deep ("bdrewery style") boot environments.
  However, it's mostly broken at this point. `#if SOON` it out on both sides
  so that we're not exposing a broken API/feature.
  
  Work will resume on it in due time.

Modified:
  projects/bectl/lib/libbe/be.c
  projects/bectl/lib/libbe/be.h
  projects/bectl/sbin/bectl/bectl.c

Modified: projects/bectl/lib/libbe/be.c
==============================================================================
--- projects/bectl/lib/libbe/be.c	Sat Aug 11 00:08:59 2018	(r337595)
+++ projects/bectl/lib/libbe/be.c	Sat Aug 11 01:02:27 2018	(r337596)
@@ -44,9 +44,11 @@ __FBSDID("$FreeBSD$");
 #include "be.h"
 #include "be_impl.h"
 
+#if SOON
 static int be_create_child_noent(libbe_handle_t *lbh, const char *active,
     const char *child_path);
 static int be_create_child_cloned(libbe_handle_t *lbh, const char *active);
+#endif
 
 /*
  * Iterator function for locating the rootfs amongst the children of the
@@ -725,6 +727,7 @@ be_import(libbe_handle_t *lbh, const char *bootenv, in
 	return (be_destroy(lbh, nbuf, 0));
 }
 
+#if SOON
 static int
 be_create_child_noent(libbe_handle_t *lbh, const char *active,
     const char *child_path)
@@ -778,7 +781,7 @@ be_create_child_noent(libbe_handle_t *lbh, const char 
 static int
 be_create_child_cloned(libbe_handle_t *lbh, const char *active)
 {
-	char buf[BE_MAXPATHLEN];
+	char buf[BE_MAXPATHLEN], tmp[BE_MAXPATHLEN];;
 	zfs_handle_t *zfs;
 	int err;
 
@@ -788,10 +791,12 @@ be_create_child_cloned(libbe_handle_t *lbh, const char
 	 * Establish if the existing path is a zfs dataset or just
 	 * the subdirectory of one
 	 */
-	strlcpy(buf, "/tmp/be_snap.XXXXX", sizeof(buf));
-	if (mktemp(buf) == NULL)
+	strlcpy(tmp, "tmp/be_snap.XXXXX", sizeof(tmp));
+	if (mktemp(tmp) == NULL)
 		return (set_error(lbh, BE_ERR_UNKNOWN));
 
+	be_root_concat(lbh, tmp, buf);
+	printf("Here %s?\n", buf);
 	if ((err = zfs_snapshot(lbh->lzh, buf, false, NULL)) != 0) {
 		switch (err) {
 		case EZFS_INVALIDNAME:
@@ -865,6 +870,7 @@ be_add_child(libbe_handle_t *lbh, const char *child_pa
 		return (be_create_child_cloned(lbh, active));
 	return (set_error(lbh, BE_ERR_EXISTS));
 }
+#endif	/* SOON */
 
 static int
 be_set_nextboot(libbe_handle_t *lbh, nvlist_t *config, uint64_t pool_guid,

Modified: projects/bectl/lib/libbe/be.h
==============================================================================
--- projects/bectl/lib/libbe/be.h	Sat Aug 11 00:08:59 2018	(r337595)
+++ projects/bectl/lib/libbe/be.h	Sat Aug 11 01:02:27 2018	(r337596)
@@ -123,7 +123,9 @@ bool be_exists(libbe_handle_t *, char *);
 int be_export(libbe_handle_t *, const char *, int fd);
 int be_import(libbe_handle_t *, const char *, int fd);
 
+#if SOON
 int be_add_child(libbe_handle_t *, const char *, bool);
+#endif
 void be_nicenum(uint64_t num, char *buf, size_t buflen);
 
 #endif  /* _LIBBE_H */

Modified: projects/bectl/sbin/bectl/bectl.c
==============================================================================
--- projects/bectl/sbin/bectl/bectl.c	Sat Aug 11 00:08:59 2018	(r337595)
+++ projects/bectl/sbin/bectl/bectl.c	Sat Aug 11 01:02:27 2018	(r337596)
@@ -51,7 +51,9 @@ static int bectl_cmd_create(int argc, char *argv[]);
 static int bectl_cmd_destroy(int argc, char *argv[]);
 static int bectl_cmd_export(int argc, char *argv[]);
 static int bectl_cmd_import(int argc, char *argv[]);
+#if SOON
 static int bectl_cmd_add(int argc, char *argv[]);
+#endif
 static int bectl_cmd_mount(int argc, char *argv[]);
 static int bectl_cmd_rename(int argc, char *argv[]);
 static int bectl_cmd_unmount(int argc, char *argv[]);
@@ -72,7 +74,9 @@ usage(bool explicit)
 	    "\tbectl destroy [-F] beName | beName@snapshot⟩\n"
 	    "\tbectl export sourceBe\n"
 	    "\tbectl import targetBe\n"
+#if SOON
 	    "\tbectl add (path)*\n"
+#endif
 	    "\tbectl jail [ -o key=value | -u key ]... bootenv\n"
 	    "\tbectl list [-a] [-D] [-H] [-s]\n"
 	    "\tbectl mount beName [mountpoint]\n"
@@ -100,7 +104,9 @@ static struct command_map_entry command_map[] =
 	{ "destroy",  bectl_cmd_destroy  },
 	{ "export",   bectl_cmd_export   },
 	{ "import",   bectl_cmd_import   },
+#if SOON
 	{ "add",      bectl_cmd_add      },
+#endif
 	{ "jail",     bectl_cmd_jail     },
 	{ "list",     bectl_cmd_list     },
 	{ "mount",    bectl_cmd_mount    },
@@ -295,7 +301,7 @@ bectl_cmd_import(int argc, char *argv[])
 	return (err);
 }
 
-
+#if SOON
 static int
 bectl_cmd_add(int argc, char *argv[])
 {
@@ -313,7 +319,7 @@ bectl_cmd_add(int argc, char *argv[])
 
 	return (0);
 }
-
+#endif
 
 static int
 bectl_cmd_destroy(int argc, char *argv[])



Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?201808110102.w7B12RlQ040373>