From owner-svn-src-projects@freebsd.org Sat Aug 11 01:02:28 2018 Return-Path: Delivered-To: svn-src-projects@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id 5E751105209E for ; Sat, 11 Aug 2018 01:02:28 +0000 (UTC) (envelope-from kevans@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client CN "mxrelay.nyi.freebsd.org", Issuer "Let's Encrypt Authority X3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 144068363A; Sat, 11 Aug 2018 01:02:28 +0000 (UTC) (envelope-from kevans@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id E99F5100BC; Sat, 11 Aug 2018 01:02:27 +0000 (UTC) (envelope-from kevans@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id w7B12R3a040376; Sat, 11 Aug 2018 01:02:27 GMT (envelope-from kevans@FreeBSD.org) Received: (from kevans@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id w7B12RlQ040373; Sat, 11 Aug 2018 01:02:27 GMT (envelope-from kevans@FreeBSD.org) Message-Id: <201808110102.w7B12RlQ040373@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: kevans set sender to kevans@FreeBSD.org using -f From: Kyle Evans Date: Sat, 11 Aug 2018 01:02:27 +0000 (UTC) To: src-committers@freebsd.org, svn-src-projects@freebsd.org Subject: svn commit: r337596 - in projects/bectl: lib/libbe sbin/bectl X-SVN-Group: projects X-SVN-Commit-Author: kevans X-SVN-Commit-Paths: in projects/bectl: lib/libbe sbin/bectl X-SVN-Commit-Revision: 337596 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-projects@freebsd.org X-Mailman-Version: 2.1.27 Precedence: list List-Id: "SVN commit messages for the src " projects" tree" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sat, 11 Aug 2018 01:02:28 -0000 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[])