From owner-svn-src-head@freebsd.org Fri Aug 24 20:45:01 2018 Return-Path: Delivered-To: svn-src-head@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 E18421093773; Fri, 24 Aug 2018 20:45:00 +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 973CC75DE7; Fri, 24 Aug 2018 20:45:00 +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 7470C16251; Fri, 24 Aug 2018 20:45:00 +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 w7OKj0Bk091078; Fri, 24 Aug 2018 20:45:00 GMT (envelope-from kevans@FreeBSD.org) Received: (from kevans@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id w7OKixi5091059; Fri, 24 Aug 2018 20:44:59 GMT (envelope-from kevans@FreeBSD.org) Message-Id: <201808242044.w7OKixi5091059@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: kevans set sender to kevans@FreeBSD.org using -f From: Kyle Evans Date: Fri, 24 Aug 2018 20:44:59 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r338303 - in head: . lib/libbe sbin/bectl tools/build/mk X-SVN-Group: head X-SVN-Commit-Author: kevans X-SVN-Commit-Paths: in head: . lib/libbe sbin/bectl tools/build/mk X-SVN-Commit-Revision: 338303 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.27 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Fri, 24 Aug 2018 20:45:01 -0000 Author: kevans Date: Fri Aug 24 20:44:58 2018 New Revision: 338303 URL: https://svnweb.freebsd.org/changeset/base/338303 Log: libbe(3)/bectl(8): Make consistent with beadm vermaden (maintainer of beadm) points out the following inconsistencies: - "missing command" is not printed prior to usage if the error is simply a missing command; this should be obvious from the context - "bectl rename" isn't using the "don't unmount" flag (zfs rename -u), so the active BE can't be renamed. It doesn't make sense in our context to *not* use -u, so use it. Documentation updates reflect the above and note an inconsistency with the 'destroy' command that is consistent with other parts of the base system. A fix for libbe(3) not properly being installed to /lib is included. SHLIBDIR should have been added when it was moved in r337995. Approved by: re (kib) Modified: head/ObsoleteFiles.inc head/lib/libbe/Makefile head/lib/libbe/be.c head/lib/libbe/libbe.3 head/sbin/bectl/bectl.8 head/sbin/bectl/bectl.c head/tools/build/mk/OptionalObsoleteFiles.inc Modified: head/ObsoleteFiles.inc ============================================================================== --- head/ObsoleteFiles.inc Fri Aug 24 18:47:50 2018 (r338302) +++ head/ObsoleteFiles.inc Fri Aug 24 20:44:58 2018 (r338303) @@ -38,6 +38,8 @@ # xargs -n1 | sort | uniq -d; # done +# 20180824: libbe(3) SHLIBDIR fixed to reflect correct location +OLD_LIBS+=usr/lib/libbe.so.1 # 20180819: Remove deprecated arc4random(3) stir/addrandom interfaces OLD_FILES+=usr/share/man/man3/arc4random_addrandom.3.gz OLD_FILES+=usr/share/man/man3/arc4random_stir.3.gz Modified: head/lib/libbe/Makefile ============================================================================== --- head/lib/libbe/Makefile Fri Aug 24 18:47:50 2018 (r338302) +++ head/lib/libbe/Makefile Fri Aug 24 20:44:58 2018 (r338303) @@ -2,6 +2,7 @@ PACKAGE= lib${LIB} LIB= be +SHLIBDIR?= /lib SHLIB_MAJOR= 1 SHLIB_MINOR= 0 Modified: head/lib/libbe/be.c ============================================================================== --- head/lib/libbe/be.c Fri Aug 24 18:47:50 2018 (r338302) +++ head/lib/libbe/be.c Fri Aug 24 20:44:58 2018 (r338303) @@ -623,10 +623,6 @@ be_rename(libbe_handle_t *lbh, const char *old, const if ((err = be_root_concat(lbh, new, full_new)) != 0) return (set_error(lbh, err)); - /* Check if old is active BE */ - if (strcmp(full_old, be_active_path(lbh)) == 0) - return (set_error(lbh, BE_ERR_MOUNTED)); - if (!zfs_dataset_exists(lbh->lzh, full_old, ZFS_TYPE_DATASET)) return (set_error(lbh, BE_ERR_NOENT)); @@ -637,14 +633,10 @@ be_rename(libbe_handle_t *lbh, const char *old, const ZFS_TYPE_FILESYSTEM)) == NULL) return (set_error(lbh, BE_ERR_ZFSOPEN)); - /* XXX TODO: Allow a force flag */ - if (zfs_is_mounted(zfs_hdl, NULL)) { - zfs_close(zfs_hdl); - return (set_error(lbh, BE_ERR_MOUNTED)); - } - /* recurse, nounmount, forceunmount */ - struct renameflags flags = { 0, 0, 0 }; + struct renameflags flags = { + .nounmount = 1, + }; err = zfs_rename(zfs_hdl, NULL, full_new, flags); Modified: head/lib/libbe/libbe.3 ============================================================================== --- head/lib/libbe/libbe.3 Fri Aug 24 18:47:50 2018 (r338302) +++ head/lib/libbe/libbe.3 Fri Aug 24 20:44:58 2018 (r338303) @@ -28,7 +28,7 @@ .\" .\" $FreeBSD$ .\" -.Dd August 16, 2018 +.Dd August 24, 2018 .Dt LIBBE 3 .Os .Sh NAME @@ -222,7 +222,12 @@ snapshot. .Pp The .Fn be_rename -function renames a boot environment. +function renames a boot environment without unmounting it, as if renamed with +the +.Fl u +argument were passed to +.Nm zfs +.Cm rename .Pp The .Fn be_activate Modified: head/sbin/bectl/bectl.8 ============================================================================== --- head/sbin/bectl/bectl.8 Fri Aug 24 18:47:50 2018 (r338302) +++ head/sbin/bectl/bectl.8 Fri Aug 24 20:44:58 2018 (r338303) @@ -18,7 +18,7 @@ .\" .\" $FreeBSD$ .\" -.Dd August 22, 2018 +.Dd August 24, 2018 .Dt BECTL 8 .Os .Sh NAME @@ -132,7 +132,8 @@ Destroys the given .Ar beName boot environment or .Ar beName@snapshot -snapshot. +snapshot without confirmation, unlike in +.Nm beadm . Specifying .Fl F will automatically unmount without confirmation. @@ -239,10 +240,11 @@ Mount at the specified .Ar mountpoint if provided. .It Cm rename Ar origBeName newBeName -Renames the given nonactive +Renames the given .Ar origBeName to the given .Ar newBeName . +The boot environment will not be unmounted in order for this rename to occur. .It Cm unjail Brq Ar jailID | jailName | beName Destroys the jail created from the given boot environment. .It Xo Modified: head/sbin/bectl/bectl.c ============================================================================== --- head/sbin/bectl/bectl.c Fri Aug 24 18:47:50 2018 (r338302) +++ head/sbin/bectl/bectl.c Fri Aug 24 20:44:58 2018 (r338303) @@ -491,10 +491,8 @@ main(int argc, char *argv[]) const char *command; int command_index, rc; - if (argc < 2) { - fprintf(stderr, "missing command\n"); + if (argc < 2) return (usage(false)); - } command = argv[1]; Modified: head/tools/build/mk/OptionalObsoleteFiles.inc ============================================================================== --- head/tools/build/mk/OptionalObsoleteFiles.inc Fri Aug 24 18:47:50 2018 (r338302) +++ head/tools/build/mk/OptionalObsoleteFiles.inc Fri Aug 24 20:44:58 2018 (r338303) @@ -1288,7 +1288,7 @@ OLD_FILES+=usr/bin/ztest OLD_FILES+=usr/lib/libbe.a OLD_FILES+=usr/lib/libbe_p.a OLD_FILES+=usr/lib/libbe.so -OLD_LIBS+=usr/lib/libbe.so.1 +OLD_LIBS+=lib/libbe.so.1 OLD_FILES+=usr/lib/libzfs.a OLD_LIBS+=usr/lib/libzfs.so OLD_FILES+=usr/lib/libzfs_core.a