128f16a0fSKyle Evans.\" 2b179da01SKyle Evans.\" SPDX-License-Identifier: BSD-2-Clause-FreeBSD 3b179da01SKyle Evans.\" 428f16a0fSKyle Evans.\" Copyright (c) 2017 Kyle Kneitinger 528f16a0fSKyle Evans.\" All rights reserved. 67c2cc9b2SKyle Evans.\" Copyright (c) 2018 Kyle Evans <kevans@FreeBSD.org> 728f16a0fSKyle Evans.\" 828f16a0fSKyle Evans.\" Redistribution and use in source and binary forms, with or without 928f16a0fSKyle Evans.\" modification, are permitted provided that the following conditions 1028f16a0fSKyle Evans.\" are met: 1128f16a0fSKyle Evans.\" 1. Redistributions of source code must retain the above copyright 1228f16a0fSKyle Evans.\" notice, this list of conditions and the following disclaimer. 1328f16a0fSKyle Evans.\" 2. Redistributions in binary form must reproduce the above copyright 1428f16a0fSKyle Evans.\" notice, this list of conditions and the following disclaimer in the 1528f16a0fSKyle Evans.\" documentation and/or other materials provided with the distribution. 1628f16a0fSKyle Evans.\" 1728f16a0fSKyle Evans.\" THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' AND 1828f16a0fSKyle Evans.\" ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE 1928f16a0fSKyle Evans.\" IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE 2028f16a0fSKyle Evans.\" ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE 2128f16a0fSKyle Evans.\" FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL 2228f16a0fSKyle Evans.\" DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS 2328f16a0fSKyle Evans.\" OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) 2428f16a0fSKyle Evans.\" HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT 2528f16a0fSKyle Evans.\" LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY 2628f16a0fSKyle Evans.\" OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF 2728f16a0fSKyle Evans.\" SUCH DAMAGE. 2828f16a0fSKyle Evans.\" 2928f16a0fSKyle Evans.\" $FreeBSD$ 3028f16a0fSKyle Evans.\" 31*a8e44f4dSKyle Evans.Dd August 16, 2018 3228f16a0fSKyle Evans.Dt LIBBE 3 3328f16a0fSKyle Evans.Os 3428f16a0fSKyle Evans.Sh NAME 3528f16a0fSKyle Evans.Nm libbe 3684e61219SKyle Evans.Nd library for creating, destroying and modifying ZFS boot environments 3784e61219SKyle Evans.Sh LIBRARY 387c2cc9b2SKyle Evans.Lb libbe 3928f16a0fSKyle Evans.Sh SYNOPSIS 4028f16a0fSKyle Evans.In be.h 417c2cc9b2SKyle Evans.Ft "libbe_handle_t *hdl" Ns 427c2cc9b2SKyle Evans.Fn libbe_init void 4328f16a0fSKyle Evans.Pp 447c2cc9b2SKyle Evans.Ft void 457c2cc9b2SKyle Evans.Fn libbe_close "libbe_handle_t *hdl" 4628f16a0fSKyle Evans.Pp 477c2cc9b2SKyle Evans.Ft const char * Ns 487c2cc9b2SKyle Evans.Fn be_active_name "libbe_handle_t *hdl" 497c2cc9b2SKyle Evans.Pp 507c2cc9b2SKyle Evans.Ft const char * Ns 517c2cc9b2SKyle Evans.Fn be_active_path "libbe_handle_t *hdl" 527c2cc9b2SKyle Evans.Pp 537c2cc9b2SKyle Evans.Ft const char * Ns 547c2cc9b2SKyle Evans.Fn be_nextboot_name "libbe_handle_t *hdl" 557c2cc9b2SKyle Evans.Pp 567c2cc9b2SKyle Evans.Ft const char * Ns 577c2cc9b2SKyle Evans.Fn be_nextboot_path "libbe_handle_t *hdl" 587c2cc9b2SKyle Evans.Pp 597c2cc9b2SKyle Evans.Ft const char * Ns 607c2cc9b2SKyle Evans.Fn be_root_path "libbe_handle_t *hdl" 617c2cc9b2SKyle Evans.Pp 627c2cc9b2SKyle Evans.Ft int 637c2cc9b2SKyle Evans.Fn be_create "libbe_handle_t *hdl" "const char *be_name" 647c2cc9b2SKyle Evans.Pp 657c2cc9b2SKyle Evans.Ft int 667c2cc9b2SKyle Evans.Fn be_create_from_existing "libbe_handle_t *hdl" "const char *be_name" "const char *be_origin" 677c2cc9b2SKyle Evans.Pp 687c2cc9b2SKyle Evans.Ft int 697c2cc9b2SKyle Evans.Fn be_create_from_existing_snap "libbe_handle_t *hdl" "const char *be_name" "const char *snap" 707c2cc9b2SKyle Evans.Pp 717c2cc9b2SKyle Evans.Ft int 727c2cc9b2SKyle Evans.Fn be_rename "libbe_handle_t *hdl" "const char *be_old" "const char *be_new" 737c2cc9b2SKyle Evans.Pp 747c2cc9b2SKyle Evans.Ft int 757c2cc9b2SKyle Evans.Fn be_activate "libbe_handle_t *hdl" "const char *be_name" "bool temporary" 767c2cc9b2SKyle Evans.Ft int 777c2cc9b2SKyle Evans.Fn be_destroy "libbe_handle_t *hdl" "const char *be_name" "int options" 787c2cc9b2SKyle Evans.Pp 797c2cc9b2SKyle Evans.Ft void 807c2cc9b2SKyle Evans.Fn be_nicenum "uint64_t num" "char *buf" "size_t bufsz" 817c2cc9b2SKyle Evans.Pp 827c2cc9b2SKyle Evans.\" TODO: Write up of mount options 837c2cc9b2SKyle Evans.\" typedef enum { 847c2cc9b2SKyle Evans.\" BE_MNT_FORCE = 1 << 0, 857c2cc9b2SKyle Evans.\" BE_MNT_DEEP = 1 << 1, 867c2cc9b2SKyle Evans.\" } be_mount_opt_t 877c2cc9b2SKyle Evans.Ft int 887c2cc9b2SKyle Evans.Fn be_mount "libbe_handle_t *hdl" "char *be_name" "char *mntpoint" "int flags" "char *result" 897c2cc9b2SKyle Evans.Pp 907c2cc9b2SKyle Evans.Ft int 917c2cc9b2SKyle Evans.Fn be_mounted_at "libbe_handle_t *hdl" "const char *path" "nvlist_t *details" 927c2cc9b2SKyle Evans.Pp 937c2cc9b2SKyle Evans.Ft int 947c2cc9b2SKyle Evans.Fn be_unmount "libbe_handle_t *hdl" "char *be_name" "int flags" 957c2cc9b2SKyle Evans.Pp 967c2cc9b2SKyle Evans.Ft int 977c2cc9b2SKyle Evans.Fn libbe_errno "libbe_handle_t *hdl" 987c2cc9b2SKyle Evans.Pp 997c2cc9b2SKyle Evans.Ft const char * Ns 1007c2cc9b2SKyle Evans.Fn libbe_error_description "libbe_handle_t *hdl" 1017c2cc9b2SKyle Evans.Pp 1027c2cc9b2SKyle Evans.Ft void 1037c2cc9b2SKyle Evans.Fn libbe_print_on_error "libbe_handle_t *hdl" "bool doprint" 1047c2cc9b2SKyle Evans.Pp 1057c2cc9b2SKyle Evans.Ft int 1067c2cc9b2SKyle Evans.Fn be_root_concat "libbe_handle_t *hdl" "const char *be_name" "char *result" 1077c2cc9b2SKyle Evans.Pp 1087c2cc9b2SKyle Evans.Ft int 1097c2cc9b2SKyle Evans.Fn be_validate_name "libbe_handle_t *hdl" "const char *be_name" 1107c2cc9b2SKyle Evans.Pp 1117c2cc9b2SKyle Evans.Ft int 1127c2cc9b2SKyle Evans.Fn be_validate_snap "libbe_handle_t *hdl" "const char *snap" 1137c2cc9b2SKyle Evans.Pp 1147c2cc9b2SKyle Evans.Ft bool 1157c2cc9b2SKyle Evans.Fn be_exists "libbe_handle_t *hdl" "char *be_name" 1167c2cc9b2SKyle Evans.Pp 1177c2cc9b2SKyle Evans.Ft int 1187c2cc9b2SKyle Evans.Fn be_export "libbe_handle_t *hdl" "const char *be_name" "int fd" 1197c2cc9b2SKyle Evans.Pp 1207c2cc9b2SKyle Evans.Ft int 1217c2cc9b2SKyle Evans.Fn be_import "libbe_handle_t *hdl" "const char *be_name" "int fd" 1227c2cc9b2SKyle Evans.Pp 1237c2cc9b2SKyle Evans.Ft int 1247c2cc9b2SKyle Evans.Fn be_prop_list_alloc "nvlist_t **prop_list" 1257c2cc9b2SKyle Evans.Pp 1267c2cc9b2SKyle Evans.Ft int 1277c2cc9b2SKyle Evans.Fn be_get_bootenv_props "libbe_handle_t *hdl" "nvlist_t *be_list" 1287c2cc9b2SKyle Evans.Pp 1297c2cc9b2SKyle Evans.Ft int 1307c2cc9b2SKyle Evans.Fn be_get_dataset_props "libbe_handle_t *hdl" "const char *ds_name" "nvlist_t *props" 1317c2cc9b2SKyle Evans.Pp 1327c2cc9b2SKyle Evans.Ft int 1337c2cc9b2SKyle Evans.Fn be_get_dataset_snapshots "libbe_handle_t *hdl" "const char *ds_name" "nvlist_t *snap_list" 1347c2cc9b2SKyle Evans.Pp 1357c2cc9b2SKyle Evans.Ft void 1367c2cc9b2SKyle Evans.Fn be_prop_list_free "nvlist_t *prop_list" 13728f16a0fSKyle Evans.Sh DESCRIPTION 13828f16a0fSKyle Evans.Nm 13928f16a0fSKyle Evansinterfaces with libzfs to provide a set of functions for various operations 14028f16a0fSKyle Evansregarding ZFS boot environments including "deep" boot environments in which 14128f16a0fSKyle Evansa boot environments has child datasets. 14228f16a0fSKyle Evans.Pp 14328f16a0fSKyle EvansA context structure is passed to each function, allowing for a small amount 14428f16a0fSKyle Evansof state to be retained, such as errors from previous operations. 1457c2cc9b2SKyle Evans.Nm 1467c2cc9b2SKyle Evansmay be configured to print the corresponding error message to 1477c2cc9b2SKyle Evans.Dv stderr 1487c2cc9b2SKyle Evanswhen an error is encountered with 1497c2cc9b2SKyle Evans.Fn libbe_print_on_error . 15028f16a0fSKyle Evans.Pp 1517c2cc9b2SKyle EvansAll functions returning an 1527c2cc9b2SKyle Evans.Vt int 1537c2cc9b2SKyle Evansreturn 0 on success, or a 1547c2cc9b2SKyle Evans.Nm 1557c2cc9b2SKyle Evanserrno otherwise as described in 1567c2cc9b2SKyle Evans.Sx DIAGNOSTICS . 15728f16a0fSKyle Evans.Pp 1587c2cc9b2SKyle EvansThe 1597c2cc9b2SKyle Evans.Fn libbe_init 1607c2cc9b2SKyle Evansfunction initializes 1617c2cc9b2SKyle Evans.Nm , 1627c2cc9b2SKyle Evansreturning a 1637c2cc9b2SKyle Evans.Vt "libbe_handle_t *" 1647c2cc9b2SKyle Evanson success, or 1657c2cc9b2SKyle Evans.Dv NULL 1667c2cc9b2SKyle Evanson error. 1677c2cc9b2SKyle EvansAn error may occur if: 1687c2cc9b2SKyle Evans.Bl -column 1697c2cc9b2SKyle Evans.It /boot and / are not on the same filesystem and device, 1707c2cc9b2SKyle Evans.It libzfs fails to initialize, 1717c2cc9b2SKyle Evans.It The system has not been properly booted with a ZFS boot 1727c2cc9b2SKyle Evansenvironment, 173d2a6bc9fSKyle Evans.It Nm 1747c2cc9b2SKyle Evansfails to open the zpool the active boot environment resides on, or 175d2a6bc9fSKyle Evans.It Nm 1767c2cc9b2SKyle Evansfails to locate the boot environment that is currently mounted. 1777c2cc9b2SKyle Evans.El 17828f16a0fSKyle Evans.Pp 1797c2cc9b2SKyle EvansThe 1807c2cc9b2SKyle Evans.Fn libbe_close 1817c2cc9b2SKyle Evansfunction frees all resources previously acquired in 1827c2cc9b2SKyle Evans.Fn libbe_init , 1837c2cc9b2SKyle Evansinvalidating the handle in the process. 18428f16a0fSKyle Evans.Pp 1857c2cc9b2SKyle EvansThe 1867c2cc9b2SKyle Evans.Fn be_active_name 1877c2cc9b2SKyle Evansfunction returns the name of the currently booted boot environment, 18884e61219SKyle Evans.Pp 1897c2cc9b2SKyle EvansThe 1907c2cc9b2SKyle Evans.Fn be_active_path 1917c2cc9b2SKyle Evansfunction returns the full path of the currently booted boot environment. 19284e61219SKyle Evans.Pp 1937c2cc9b2SKyle EvansThe 1947c2cc9b2SKyle Evans.Fn be_nextboot_name 1957c2cc9b2SKyle Evansfunction returns the name of the boot environment that will be active on reboot. 19628f16a0fSKyle Evans.Pp 1977c2cc9b2SKyle EvansThe 1987c2cc9b2SKyle Evans.Fn be_nextboot_path 1997c2cc9b2SKyle Evansfunction returns the full path of the boot environment that will be 2007c2cc9b2SKyle Evansactive on reboot. 20128f16a0fSKyle Evans.Pp 2027c2cc9b2SKyle EvansThe 2037c2cc9b2SKyle Evans.Fn be_root_path 2047c2cc9b2SKyle Evansfunction returns the boot environment root path. 20528f16a0fSKyle Evans.Pp 2067c2cc9b2SKyle EvansThe 2077c2cc9b2SKyle Evans.Fn be_create 2087c2cc9b2SKyle Evansfunction creates a boot environment with the given name. 2097c2cc9b2SKyle EvansIt will be created from a snapshot of the currently booted boot environment. 21028f16a0fSKyle Evans.Pp 2117c2cc9b2SKyle EvansThe 2127c2cc9b2SKyle Evans.Fn be_create_from_existing 2137c2cc9b2SKyle Evansfunction creates a boot environment with the given name from the name of an 2147c2cc9b2SKyle Evansexisting boot environment. 2157c2cc9b2SKyle EvansA snapshot will be made of the base boot environment, and the new boot 2167c2cc9b2SKyle Evansenvironment will be created from that. 21728f16a0fSKyle Evans.Pp 2187c2cc9b2SKyle EvansThe 2197c2cc9b2SKyle Evans.Fn be_create_from_existing_snap 2207c2cc9b2SKyle Evansfunction creates a boot environment with the given name from an existing 2217c2cc9b2SKyle Evanssnapshot. 22228f16a0fSKyle Evans.Pp 2237c2cc9b2SKyle EvansThe 2247c2cc9b2SKyle Evans.Fn be_rename 2257c2cc9b2SKyle Evansfunction renames a boot environment. 2269b1662e6SKyle Evans.Pp 2277c2cc9b2SKyle EvansThe 2287c2cc9b2SKyle Evans.Fn be_activate 2297c2cc9b2SKyle Evansfunction makes a boot environment active on the next boot. 2307c2cc9b2SKyle EvansIf the 2317c2cc9b2SKyle Evans.Fa temporary 2327c2cc9b2SKyle Evansflag is set, then it will be active for the next boot only, as done by 2337c2cc9b2SKyle Evans.Xr zfsbootcfg 8 . 2347c2cc9b2SKyle EvansNext boot functionality is currently only available when booting in x86 BIOS 2357c2cc9b2SKyle Evansmode. 23628f16a0fSKyle Evans.Pp 2377c2cc9b2SKyle EvansThe 2387c2cc9b2SKyle Evans.Fn be_destroy 2397c2cc9b2SKyle Evansfunction will recursively destroy the given boot environment. 2407c2cc9b2SKyle EvansIt will not destroy a mounted boot environment unless the 2417c2cc9b2SKyle Evans.Dv BE_DESTROY_FORCE 2427c2cc9b2SKyle Evansoption is set in 2437c2cc9b2SKyle Evans.Fa options . 244843e39ceSKyle Evans.Pp 2457c2cc9b2SKyle EvansThe 2467c2cc9b2SKyle Evans.Fn be_nicenum 2477c2cc9b2SKyle Evansfunction will format 2487c2cc9b2SKyle Evans.Fa name 2497c2cc9b2SKyle Evansin a traditional ZFS humanized format, similar to 2507c2cc9b2SKyle Evans.Xr humanize_number 3 . 2517c2cc9b2SKyle EvansThis function effectively proxies 2527c2cc9b2SKyle Evans.Fn zfs_nicenum 2537c2cc9b2SKyle Evansfrom libzfs. 25428f16a0fSKyle Evans.Pp 2557c2cc9b2SKyle EvansThe 2567c2cc9b2SKyle Evans.Fn be_mount 2577c2cc9b2SKyle Evansfunction will mount the given boot environment. 2587c2cc9b2SKyle EvansIf 2597c2cc9b2SKyle Evans.Fa mountpoint 2607c2cc9b2SKyle Evansis 2617c2cc9b2SKyle Evans.Dv NULL , 2627c2cc9b2SKyle Evansa mount point will be generated in 2637c2cc9b2SKyle Evans.Pa /tmp 2647c2cc9b2SKyle Evansusing 2657c2cc9b2SKyle Evans.Xr mkdtemp 3 . 2667c2cc9b2SKyle EvansIf 2677c2cc9b2SKyle Evans.Fa result 2687c2cc9b2SKyle Evansis not 2697c2cc9b2SKyle Evans.Dv NULL , 270*a8e44f4dSKyle Evansit should be large enough to accommodate 271*a8e44f4dSKyle Evans.Dv BE_MAXPATHLEN 272*a8e44f4dSKyle Evansincluding the null terminator. 2737c2cc9b2SKyle Evansthe final mount point will be copied into it. 2747c2cc9b2SKyle EvansSetting the 2757c2cc9b2SKyle Evans.Dv BE_MNT_FORCE 2767c2cc9b2SKyle Evansflag will pass 2777c2cc9b2SKyle Evans.Dv MNT_FORCE 2787c2cc9b2SKyle Evansto the underlying 2797c2cc9b2SKyle Evans.Xr mount 2 2807c2cc9b2SKyle Evanscall. 28128f16a0fSKyle Evans.Pp 2827c2cc9b2SKyle EvansThe 2837c2cc9b2SKyle Evans.Fn be_mounted_at 2847c2cc9b2SKyle Evansfunction will check if there is a boot environment mounted at the given 2857c2cc9b2SKyle Evans.Fa path . 2867c2cc9b2SKyle EvansIf 2877c2cc9b2SKyle Evans.Fa details 2887c2cc9b2SKyle Evansis not 2897c2cc9b2SKyle Evans.Dv NULL , 2907c2cc9b2SKyle Evansit will be populated with a list of the mounted dataset's properties. 2917c2cc9b2SKyle EvansThis list of properties matches the properties collected by 2927c2cc9b2SKyle Evans.Fn be_get_bootenv_props . 29328f16a0fSKyle Evans.Pp 2947c2cc9b2SKyle EvansThe 2957c2cc9b2SKyle Evans.Fn be_unmount 2967c2cc9b2SKyle Evansfunction will unmount the given boot environment. 2977c2cc9b2SKyle EvansSetting the 2987c2cc9b2SKyle Evans.Dv BE_MNT_FORCE 2997c2cc9b2SKyle Evansflag will pass 3007c2cc9b2SKyle Evans.Dv MNT_FORCE 3017c2cc9b2SKyle Evansto the underlying 3027c2cc9b2SKyle Evans.Xr mount 2 3037c2cc9b2SKyle Evanscall. 30428f16a0fSKyle Evans.Pp 3057c2cc9b2SKyle EvansThe 3067c2cc9b2SKyle Evans.Fn libbe_errno 3077c2cc9b2SKyle Evansfunction returns the 3087c2cc9b2SKyle Evans.Nm 3097c2cc9b2SKyle Evanserrno. 31028f16a0fSKyle Evans.Pp 3117c2cc9b2SKyle EvansThe 3127c2cc9b2SKyle Evans.Fn libbe_error_description 3137c2cc9b2SKyle Evansfunction returns a string description of the currently set 3147c2cc9b2SKyle Evans.Nm 3157c2cc9b2SKyle Evanserrno. 31628f16a0fSKyle Evans.Pp 3177c2cc9b2SKyle EvansThe 3187c2cc9b2SKyle Evans.Fn libbe_print_on_error 3197c2cc9b2SKyle Evansfunction will change whether or not 3207c2cc9b2SKyle Evans.Nm 3217c2cc9b2SKyle Evansprints the description of any encountered error to 3227c2cc9b2SKyle Evans.Dv stderr , 3237c2cc9b2SKyle Evansbased on 3247c2cc9b2SKyle Evans.Fa doprint . 32528f16a0fSKyle Evans.Pp 3267c2cc9b2SKyle EvansThe 3277c2cc9b2SKyle Evans.Fn be_root_concat 3287c2cc9b2SKyle Evansfunction will concatenate the boot environment root and the given boot 3297c2cc9b2SKyle Evansenvironment name into 3307c2cc9b2SKyle Evans.Fa result . 33128f16a0fSKyle Evans.Pp 3327c2cc9b2SKyle EvansThe 3337c2cc9b2SKyle Evans.Fn be_validate_name 3347c2cc9b2SKyle Evansfunction will validate the given boot environment name. 33528f16a0fSKyle Evans.Pp 3367c2cc9b2SKyle EvansThe 3377c2cc9b2SKyle Evans.Fn be_validate_snap 3387c2cc9b2SKyle Evansfunction will validate the given snapshot name. 3397c2cc9b2SKyle EvansThe snapshot must have a valid name, exist, and have a mountpoint of 3407c2cc9b2SKyle Evans.Pa / . 3417c2cc9b2SKyle EvansThis function does not set the internal library error state. 34228f16a0fSKyle Evans.Pp 3437c2cc9b2SKyle EvansThe 3447c2cc9b2SKyle Evans.Fn be_exists 3457c2cc9b2SKyle Evansfunction will check whether the given boot environment exists and has a 3467c2cc9b2SKyle Evansmountpoint of 3477c2cc9b2SKyle Evans.Pa / . 348734e362fSKyle Evans.Pp 3497c2cc9b2SKyle EvansThe 3507c2cc9b2SKyle Evans.Fn be_export 3517c2cc9b2SKyle Evansfunction will export the given boot environment to the file specified by 3527c2cc9b2SKyle Evans.Fa fd . 3537c2cc9b2SKyle EvansA snapshot will be created of the boot environment prior to export. 354734e362fSKyle Evans.Pp 3557c2cc9b2SKyle EvansThe 3567c2cc9b2SKyle Evans.Fn be_import 3577c2cc9b2SKyle Evansfunction will import the boot environment in the file specified by 3587c2cc9b2SKyle Evans.Fa fd , 3597c2cc9b2SKyle Evansand give it the name 3607c2cc9b2SKyle Evans.Fa be_name . 3614146029bSKyle Evans.Pp 3627c2cc9b2SKyle EvansThe 3637c2cc9b2SKyle Evans.Fn be_prop_list_alloc 3647c2cc9b2SKyle Evansfunction allocates a property list suitable for passing to 3657c2cc9b2SKyle Evans.Fn be_get_bootenv_props , 3667c2cc9b2SKyle Evans.Fn be_get_dataset_props , 3677c2cc9b2SKyle Evansor 3687c2cc9b2SKyle Evans.Fn be_get_dataset_snapshots . 3697c2cc9b2SKyle EvansIt should be freed later by 3707c2cc9b2SKyle Evans.Fa be_prop_list_free . 37196c5db58SKyle Evans.Pp 3727c2cc9b2SKyle EvansThe 3737c2cc9b2SKyle Evans.Fn be_get_bootenv_props 3747c2cc9b2SKyle Evansfunction will populate 3757c2cc9b2SKyle Evans.Fa be_list 3767c2cc9b2SKyle Evanswith 3777c2cc9b2SKyle Evans.Vt nvpair_t 3787c2cc9b2SKyle Evansof boot environment names paired with an 3797c2cc9b2SKyle Evans.Vt nvlist_t 3807c2cc9b2SKyle Evansof their properties. 3817c2cc9b2SKyle EvansThe following properties are currently collected as appropriate: 3827c2cc9b2SKyle Evans.Bl -column "Returned name" 3837c2cc9b2SKyle Evans.It Sy Returned name Ta Sy Description 3847c2cc9b2SKyle Evans.It dataset Ta - 3857c2cc9b2SKyle Evans.It name Ta Boot environment name 3867c2cc9b2SKyle Evans.It mounted Ta Current mount point 3877c2cc9b2SKyle Evans.It mountpoint Ta Do mountpoint Dc property 3887c2cc9b2SKyle Evans.It origin Ta Do origin Dc property 3897c2cc9b2SKyle Evans.It creation Ta Do creation Dc property 3907c2cc9b2SKyle Evans.It active Ta Currently booted environment 3917c2cc9b2SKyle Evans.It used Ta Literal Do used Dc property 3927c2cc9b2SKyle Evans.It usedds Ta Literal Do usedds Dc property 3937c2cc9b2SKyle Evans.It usedsnap Ta Literal Do usedrefreserv Dc property 3947c2cc9b2SKyle Evans.It referenced Ta Literal Do referenced Dc property 3957c2cc9b2SKyle Evans.It nextboot Ta Active on next boot 3967c2cc9b2SKyle Evans.El 3977c2cc9b2SKyle Evans.Pp 3987c2cc9b2SKyle EvansOnly the 3997c2cc9b2SKyle Evans.Dq dataset , 4007c2cc9b2SKyle Evans.Dq name , 4017c2cc9b2SKyle Evans.Dq active , 4027c2cc9b2SKyle Evansand 4037c2cc9b2SKyle Evans.Dq nextboot 4047c2cc9b2SKyle Evansreturned values will always be present. 4057c2cc9b2SKyle EvansAll other properties may be omitted if not available. 4067c2cc9b2SKyle Evans.Pp 4077c2cc9b2SKyle EvansThe 4087c2cc9b2SKyle Evans.Fn be_get_dataset_props 4097c2cc9b2SKyle Evansfunction will get properties of the specified dataset. 4107c2cc9b2SKyle Evans.Fa props 4117c2cc9b2SKyle Evansis populated directly with a list of the properties as returned by 4127c2cc9b2SKyle Evans.Fn be_get_bootenv_props . 4137c2cc9b2SKyle Evans.Pp 4147c2cc9b2SKyle EvansThe 4157c2cc9b2SKyle Evans.Fn be_get_dataset_snapshots 4167c2cc9b2SKyle Evansfunction will retrieve all snapshots of the given dataset. 4177c2cc9b2SKyle Evans.Fa snap_list 4187c2cc9b2SKyle Evanswill be populated with a list of 4197c2cc9b2SKyle Evans.Vt nvpair_t 4207c2cc9b2SKyle Evansexactly as specified by 4217c2cc9b2SKyle Evans.Fn be_get_bootenv_props . 4227c2cc9b2SKyle Evans.Pp 4237c2cc9b2SKyle EvansThe 4247c2cc9b2SKyle Evans.Fn be_prop_list_free 4257c2cc9b2SKyle Evansfunction will free the property list. 42628f16a0fSKyle Evans.Sh DIAGNOSTICS 42728f16a0fSKyle EvansUpon error, one of the following values will be returned. 42828f16a0fSKyle Evans.\" TODO: make each entry on its own line. 42928f16a0fSKyle Evans.Bd -ragged -offset indent 43028f16a0fSKyle EvansBE_ERR_SUCCESS, 43128f16a0fSKyle EvansBE_ERR_INVALIDNAME, 43228f16a0fSKyle EvansBE_ERR_EXISTS, 43328f16a0fSKyle EvansBE_ERR_NOENT, 43428f16a0fSKyle EvansBE_ERR_PERMS, 43528f16a0fSKyle EvansBE_ERR_DESTROYACT, 43628f16a0fSKyle EvansBE_ERR_DESTROYMNT, 437f1ca70d3SKyle EvansBE_ERR_BADPATH, 438f1ca70d3SKyle EvansBE_ERR_PATHBUSY, 43928f16a0fSKyle EvansBE_ERR_PATHLEN, 44028f16a0fSKyle EvansBE_ERR_INVORIGIN, 44128f16a0fSKyle EvansBE_ERR_NOORIGIN, 44228f16a0fSKyle EvansBE_ERR_MOUNTED, 44328f16a0fSKyle EvansBE_ERR_NOMOUNT, 44428f16a0fSKyle EvansBE_ERR_ZFSOPEN, 44528f16a0fSKyle EvansBE_ERR_ZFSCLONE, 446f1ca70d3SKyle EvansBE_ERR_IO, 44711f2a123SKyle EvansBE_ERR_NOPOOL, 44811f2a123SKyle EvansBE_ERR_NOMEM, 44928f16a0fSKyle EvansBE_ERR_UNKNOWN 45028f16a0fSKyle Evans.Ed 45128f16a0fSKyle Evans.Sh SEE ALSO 45284e61219SKyle Evans.Xr be 1 45328f16a0fSKyle Evans.Sh HISTORY 45428f16a0fSKyle Evans.Nm 45584e61219SKyle Evansand its corresponding command, 45684e61219SKyle Evans.Xr bectl 8 , 45728f16a0fSKyle Evanswere written as a 2017 Google Summer of Code project with Allan Jude serving 45828f16a0fSKyle Evansas a mentor. 4597c2cc9b2SKyle EvansLater work was done by 4607c2cc9b2SKyle Evans.An Kyle Evans Aq Mt kevans@FreeBSD.org . 461