Index: projects/bectl/lib/libbe/libbe.3 =================================================================== --- projects/bectl/lib/libbe/libbe.3 (revision 337597) +++ projects/bectl/lib/libbe/libbe.3 (revision 337598) @@ -1,186 +1,191 @@ .\" .\" SPDX-License-Identifier: BSD-2-Clause-FreeBSD .\" .\" Copyright (c) 2017 Kyle Kneitinger .\" All rights reserved. .\" .\" Redistribution and use in source and binary forms, with or without .\" modification, are permitted provided that the following conditions .\" are met: .\" 1. Redistributions of source code must retain the above copyright .\" notice, this list of conditions and the following disclaimer. .\" 2. Redistributions in binary form must reproduce the above copyright .\" notice, this list of conditions and the following disclaimer in the .\" documentation and/or other materials provided with the distribution. .\" .\" THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' AND .\" ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE .\" IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE .\" ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE .\" FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL .\" DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS .\" OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) .\" HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT .\" LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY .\" OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF .\" SUCH DAMAGE. .\" -.\" This manual page is based on the mp(3X) manual page from Sun Release -.\" 4.1, dated 7 September 1989. It's an old, crufty, and relatively ugly -.\" manual page, but it does document what appears to be the "traditional" -.\" libmp interface. -.\" .\" $FreeBSD$ .\" .Dd August 10, 2018 .Dt LIBBE 3 .Os .Sh NAME .Nm libbe -.Nd library for creating, destroying and modifying ZFS boot environments. +.Nd library for creating, destroying and modifying ZFS boot environments +.Sh LIBRARY +.Lb be .Sh SYNOPSIS .In be.h .Pp -Function prototypes are given in the main body of the text. +Function prototypes are given in the +.Sx FUNCTION OVERVIEW +section. .Pp Applications using this interface must be linked with .Fl l Ns Ar be .Sh DESCRIPTION -.Pp .Nm interfaces with libzfs to provide a set of functions for various operations regarding ZFS boot environments including "deep" boot environments in which a boot environments has child datasets. .Pp A context structure is passed to each function, allowing for a small amount of state to be retained, such as errors from previous operations. .\" TODO: describe break on err functionality -.Pp +.Sh FUNCTION OVERVIEW .Ft "libbe_handle_t *" Ns -.Fn libbe_init "void" ; +.Fn libbe_init void ; .Pp .Ft void .Fn libbe_close "libbe_handle_t *" ; .Pp -.Ft "const char *" Ns +.Ft const char * Ns .Fn be_active_name "libbe_handle_t *" ; .Pp -.Ft "const char *" Ns +.Ft const char * Ns .Fn be_active_path "libbe_handle_t *" ; .Pp -.Ft "const char *" Ns +.Ft const char * Ns +.Fn be_nextboot_name "libbe_handle_t *" ; +.Pp +.Ft const char * Ns +.Fn be_nextboot_path "libbe_handle_t *" ; +.Pp +.Ft const char * Ns .Fn be_root_path "libbe_handle_t *" ; .Pp -.Ft "nvlist_t *" Ns -.Fn libbe_handle_t "libbe_handle_t " ; +.Ft int +.Fn be_create "libbe_handle_t *" "const char *" ; .Pp .Ft int -.Fn be_create "libbe_handle_t *, const char *" ; +.Fn be_create_from_existing "libbe_handle_t *" "const char *" "const char *" ; .Pp .Ft int -.Fn be_create_from_existing "libbe_handle_t *, const char *, const char *" ; +.Fn be_create_from_existing_snap "libbe_handle_t *" "const char *" "const char *" ; .Pp .Ft int -.Fn be_rename "libbe_handle_t *, const char *, const char *" ; +.Fn be_rename "libbe_handle_t *" "const char *" "const char *" ; .Pp +.Ft int +.Fn be_activate "libbe_handle_t *" "const char *" "bool" ; .\" TODO: Write up of destroy options .\" typedef enum { .\" BE_DESTROY_FORCE = 1 << 0, .\" } be_destroy_opt_t; .Ft int -.Fn be_destroy "libbe_handle_t *, const char *, int" ; +.Fn be_destroy "libbe_handle_t *" "const char *" "int" ; .Pp .Ft void -.Fn be_nicenum "uint64_t, char *, size_t" ; +.Fn be_nicenum uint64_t" "char *" "size_t" ; .Pp .\" TODO: Write up of mount options .\" typedef enum { .\" BE_MNT_FORCE = 1 << 0, .\" BE_MNT_DEEP = 1 << 1, .\" } be_mount_opt_t; .Ft int -.Fn be_mount "libbe_handle_t *, char *, char *, int" ; +.Fn be_mount "libbe_handle_t *" "char *" "char *" "int" ; .Pp .Ft int -.Fn be_mounted_at "libbe_handle_t *, const char *, nvlist_t" ; +.Fn be_mounted_at "libbe_handle_t *" "const char *" "nvlist_t" ; .Pp .Ft int -.Fn be_unmount "libbe_handle_t *, char *, int" ; +.Fn be_unmount "libbe_handle_t *" "char *" "int" ; .Pp .Ft int .Fn libbe_errno "libbe_handle_t *" ; .Pp -.Ft "const char *" Ns +.Ft const char * Ns .Fn libbe_error_description "libbe_handle_t *" ; .Pp .Ft void -.Fn libbe_print_on_error "libbe_handle_t *, bool" ; +.Fn libbe_print_on_error "libbe_handle_t *" "bool" ; .Pp .Ft int -.Fn be_root_concat "libbe_handle_t *, const char *, char *" ; +.Fn be_root_concat "libbe_handle_t *" "const char *" "char *" ; .Pp .Ft int -.Fn be_validate_name "libbe_handle_t *, const char *" ; +.Fn be_validate_name "libbe_handle_t *" "const char *" ; .Pp .Ft int -.Fn be_validate_snap "libbe_handle_t *, const char *" ; +.Fn be_validate_snap "libbe_handle_t *" "const char *" ; .Pp .Ft bool -.Fn be_exists "libbe_handle_t *, char *" ; +.Fn be_exists "libbe_handle_t *" "char *" ; .Pp .Ft int -.Fn be_export "libbe_handle_t *, const char *, int fd" ; +.Fn be_export "libbe_handle_t *" "const char *" "int fd" ; .Pp .Ft int -.Fn be_import "libbe_handle_t *, const char *, int fd" ; +.Fn be_import "libbe_handle_t *" "const char *" "int fd" ; .Pp .Ft int .Fn be_prop_list_alloc "nvlist_t **" ; .Pp .Ft int -.Fn be_get_bootenv_props "libbe_handle_t *, nvlist_t *" ; +.Fn be_get_bootenv_props "libbe_handle_t *" "nvlist_t *" ; .Pp .Ft int -.Fn be_get_dataset_props "libbe_handle_t *, const char *, nvlist_t *" ; +.Fn be_get_dataset_props "libbe_handle_t *" "const char *" "nvlist_t *" ; .Pp .Ft int -.Fn be_get_dataset_snapshots "libbe_handle_t *, const char *, nvlist_t *" ; +.Fn be_get_dataset_snapshots "libbe_handle_t *" "const char *" "nvlist_t *" ; .Pp .Ft void .Fn be_prop_list_free "nvlist_t *" ; .Sh DIAGNOSTICS Upon error, one of the following values will be returned. .\" TODO: make each entry on its own line. .Bd -ragged -offset indent BE_ERR_SUCCESS, BE_ERR_INVALIDNAME, BE_ERR_EXISTS, BE_ERR_NOENT, BE_ERR_PERMS, BE_ERR_DESTROYACT, BE_ERR_DESTROYMNT, BE_ERR_BADPATH, BE_ERR_PATHBUSY, BE_ERR_PATHLEN, BE_ERR_INVORIGIN, BE_ERR_NOORIGIN, BE_ERR_MOUNTED, BE_ERR_NOMOUNT, BE_ERR_ZFSOPEN, BE_ERR_ZFSCLONE, BE_ERR_IO, BE_ERR_NOPOOL, BE_ERR_NOMEM, BE_ERR_UNKNOWN .Ed .Sh SEE ALSO -.Xr be 1 , +.Xr be 1 .Sh HISTORY .Nm -and it's corresponding command, -.Xr be 3 , +and its corresponding command, +.Xr bectl 8 , were written as a 2017 Google Summer of Code project with Allan Jude serving as a mentor. .\" TODO: update when implementation complete. .\" .Sh BUGS - Index: projects/bectl/sbin/bectl/bectl.8 =================================================================== --- projects/bectl/sbin/bectl/bectl.8 (revision 337597) +++ projects/bectl/sbin/bectl/bectl.8 (revision 337598) @@ -1,262 +1,254 @@ .\" .\" SPDX-License-Identifier: BSD-2-Clause-FreeBSD .\" .\" Copyright (c) 2017 Kyle J. Kneitinger .\" All rights reserved. .\" .\" Redistribution and use in source and binary forms, with or without .\" modification, are permitted provided that the following conditions .\" are met: .\" 1. Redistributions of source code must retain the above copyright .\" notice, this list of conditions and the following disclaimer. .\" 2. Redistributions in binary form must reproduce the above copyright .\" notice, this list of conditions and the following disclaimer in the .\" documentation and/or other materials provided with the distribution. .\" .\" .\" @(#)be.1 .\" .\" $FreeBSD$ .\" -.Dd August 5, 2018 +.Dd August 10, 2018 .Dt BECTL 8 -.Os FreeBSD +.Os .Sh NAME .Nm bectl .Nd Utility to manage Boot Environments on ZFS .Sh SYNOPSIS .Nm activate .Op Fl t .Ao Ar beName Ac .Nm create .Op Fl r .Op Fl e Ar nonActiveBe | Fl e Ar beName@snapshot .Ao Ar beName Ac .Nm create .Op Fl r .Ao Ar beName@snapshot Ac .Nm destroy .Op Fl F .Ao Ar beName | beName@snapshot Ac .Nm jail .Oo Fl o Ar key Ns = Ns Ar value | Fl u Ar key Oc Ns ... .Ao Ar jailID | jailName Ac .Ao Ar bootenv Ac .Nm list .Op Fl a .Op Fl D .Op Fl H .Op Fl s .Nm mount .Ao Ar beName Ac .Op mountpoint .Nm rename .Ao Ar origBeName Ac .Ao Ar newBeName Ac .Nm { ujail | unjail } .Ao Ar jailID | jailName Ac .Ao Ar bootenv Ac .Nm { umount | unmount } .Op Fl f .Ao Ar beName Ac .Sh DESCRIPTION The .Nm command is used to setup and interact with ZFS boot environments, which are bootable clones of datasets. .Pp .Em Boot Environments allows the system to be upgraded, while preserving the old system environment in a separate ZFS dataset. -.Pp .Sh COMMANDS The following commands are supported by .Nm : .Bl -tag -width activate .It Ic activate .Op Fl t .Ar .Pp Activate the given .Ar beName -as the default boot filesystem. If the +as the default boot filesystem. +If the .Op Fl t flag is given, this takes effect only for the next boot. -.Pp .It Ic create .Op Fl r .Op Fl e Ar nonActiveBe | Fl e Ar beName@snapshot .Ao Ar beName Ac .Pp Creates a new boot environment named .Ar beName . If the -e param is specified, the new environment will be cloned from the given .Ar nonActiveBe | Ar beName@snapshot . If the .Op Fl r flag is given, a recursive boot environment will be made. -.Pp .It Ic create .Op Fl r .Ao Ar beName@snapshot Ac .Pp Creates a snapshot of the existing boot environment named .Ar beName . If the .Op Fl r flag is given, a recursive boot environment will be made. -.Pp .It Ic destroy .Op Fl F .Ao Ar beName | beName@snapshot Ac .Pp Destroys the given .Ar beName boot environment or .Ar beName@snapshot snapshot. Specifying .Fl F will automatically unmount without confirmation. -.Pp .It Ic jail .Oo Fl o Ar key Ns = Ns Ar value | Fl u Ar key Oc Ns ... .Ao Ar jailID | jailName Ac .Ao Ar bootenv Ac .Pp Creates a jail of the given boot environment. Multiple .Fl o and .Fl u arguments may be specified. .Fl o will set a jail parameter, and .Fl u will unset a jail parameter. .Pp The .Va name , .Va host.hostname , and .Va path may not actually be unset. Attempts to unset any of these will revert them to the default values specified below, if they have been overwritten by .Fl o . .Pp All .Ar key , .Ar value pairs are interpreted as jail parameters as described in .Xr jail 8 . The following default parameters are provided: .Bl -tag -width -indent .It Va allow.mount Ns = Ns Ar true .It Va allow.mount.devfs Ns = Ns Ar true .It Va enforce_statfs Ns = Ns Ar 1 .It Va name Ns = Ns Ar bootenv .It Va host.hostname Ns = Ns Ar bootenv .It Va path Set to a path in /tmp generated by -.Xr libbe 8 . +.Xr libbe 3 . .El .Pp All default parameters may be overwritten. .It Ic list .Op Fl a .Op Fl D .Op Fl H .Op Fl s .Pp Displays all boot environments. The Active field indicates whether the boot environment is active now (N); active on reboot (R); or both (NR). .Pp If .Fl a is used, display all datasets. If .Fl D is used, display the full space usage for each boot environment, assuming all other boot environments were destroyed. The .Fl H -option is used for scripting. It does not print headers and separate fields by a single tab instead of arbitrary white space. +option is used for scripting. +It does not print headers and separate fields by a single tab instead of arbitrary white space. If .Fl s is used, display all snapshots as well. -.Pp .It Ic mount .Ao Ar beName Ac .Op mountpoint .Pp Temporarily mount the boot environment. Mount at the specified .Ar mountpoint if provided. -.Pp .It Ic rename Ao Ar origBeName Ac Ao Ar newBeName Ac .Pp Renames the given nonactive .Ar origBeName to the given .Ar newBeName -.Pp .It Ic unmount .Op Fl f .Ao Ar beName Ac .Pp Unmount the given boot environment, if it is mounted. Specifying .Fl f will force the unmount if busy. -.Pp .It Ic unjail Ao Ar jailID | jailName | beName Ac .Pp Destroys the jail created from the given boot environment. -.Pp .El .Sh EXAMPLES .Bl -bullet .It To fill in with jail upgrade example when behavior is firm. -.Pp +.El .Sh SEE ALSO .Xr jail 8 , .Xr zfs 8 , .Xr zpool 8 .Sh HISTORY .Nm is based on .Xr beadm 1 and was implemented as a project for the 2017 Summer of Code, along with .Xr libbe 3 . .Sh AUTHORS .Bl -bullet .It -Kyle Kneitinger (kneitinger) +.An Kyle Kneitinger (kneitinger) .Ar kyle@kneit.in .Pp Creator of .Nm . .It -Slawomir Wojciech Wojtczak (vermaden) +.An Slawomir Wojciech Wojtczak (vermaden) .Ar vermaden@interia.pl .Pp Creator and maintainer of .Xr beadm 1 . .It -Bryan Drewery (bdrewery) +.An Bryan Drewery (bdrewery) .Ar bryan@shatow.net .Pp Wrote the original .Xr beadm 1 manual page that this one is derived from. .El