1*28f16a0fSKyle Evans.\" 2*28f16a0fSKyle Evans.\" Copyright (c) 2017 Kyle Kneitinger 3*28f16a0fSKyle Evans.\" All rights reserved. 4*28f16a0fSKyle Evans.\" 5*28f16a0fSKyle Evans.\" Redistribution and use in source and binary forms, with or without 6*28f16a0fSKyle Evans.\" modification, are permitted provided that the following conditions 7*28f16a0fSKyle Evans.\" are met: 8*28f16a0fSKyle Evans.\" 1. Redistributions of source code must retain the above copyright 9*28f16a0fSKyle Evans.\" notice, this list of conditions and the following disclaimer. 10*28f16a0fSKyle Evans.\" 2. Redistributions in binary form must reproduce the above copyright 11*28f16a0fSKyle Evans.\" notice, this list of conditions and the following disclaimer in the 12*28f16a0fSKyle Evans.\" documentation and/or other materials provided with the distribution. 13*28f16a0fSKyle Evans.\" 14*28f16a0fSKyle Evans.\" THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' AND 15*28f16a0fSKyle Evans.\" ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE 16*28f16a0fSKyle Evans.\" IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE 17*28f16a0fSKyle Evans.\" ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE 18*28f16a0fSKyle Evans.\" FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL 19*28f16a0fSKyle Evans.\" DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS 20*28f16a0fSKyle Evans.\" OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) 21*28f16a0fSKyle Evans.\" HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT 22*28f16a0fSKyle Evans.\" LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY 23*28f16a0fSKyle Evans.\" OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF 24*28f16a0fSKyle Evans.\" SUCH DAMAGE. 25*28f16a0fSKyle Evans.\" 26*28f16a0fSKyle Evans.\" This manual page is based on the mp(3X) manual page from Sun Release 27*28f16a0fSKyle Evans.\" 4.1, dated 7 September 1989. It's an old, crufty, and relatively ugly 28*28f16a0fSKyle Evans.\" manual page, but it does document what appears to be the "traditional" 29*28f16a0fSKyle Evans.\" libmp interface. 30*28f16a0fSKyle Evans.\" 31*28f16a0fSKyle Evans.\" $FreeBSD$ 32*28f16a0fSKyle Evans.\" 33*28f16a0fSKyle Evans.Dd August 28, 2017 34*28f16a0fSKyle Evans.Dt LIBBE 3 35*28f16a0fSKyle Evans.Os 36*28f16a0fSKyle Evans.Sh NAME 37*28f16a0fSKyle Evans.Nm libbe 38*28f16a0fSKyle Evans.Nd library for creating, destroying and modifying ZFS boot environments. 39*28f16a0fSKyle Evans.Sh SYNOPSIS 40*28f16a0fSKyle Evans.In be.h 41*28f16a0fSKyle Evans.Pp 42*28f16a0fSKyle EvansFunction prototypes are given in the main body of the text. 43*28f16a0fSKyle Evans.Pp 44*28f16a0fSKyle EvansApplications using this interface must be linked with 45*28f16a0fSKyle Evans.Fl l Ns Ar be 46*28f16a0fSKyle Evans.Sh DESCRIPTION 47*28f16a0fSKyle Evans.Pp 48*28f16a0fSKyle Evans.Nm 49*28f16a0fSKyle Evansinterfaces with libzfs to provide a set of functions for various operations 50*28f16a0fSKyle Evansregarding ZFS boot environments including "deep" boot environments in which 51*28f16a0fSKyle Evansa boot environments has child datasets. 52*28f16a0fSKyle Evans.Pp 53*28f16a0fSKyle EvansA context structure is passed to each function, allowing for a small amount 54*28f16a0fSKyle Evansof state to be retained, such as errors from previous operations. 55*28f16a0fSKyle Evans.\" TODO: describe break on err functionality 56*28f16a0fSKyle Evans.Pp 57*28f16a0fSKyle Evans.Ft "libbe_handle_t *" Ns 58*28f16a0fSKyle Evans.Fn libbe_init "void" ; 59*28f16a0fSKyle Evans.Pp 60*28f16a0fSKyle Evans.Ft void 61*28f16a0fSKyle Evans.Fn libbe_close "libbe_handle_t *" ; 62*28f16a0fSKyle Evans.Pp 63*28f16a0fSKyle Evans.Ft "const char *" Ns 64*28f16a0fSKyle Evans.Fn be_active_name "libbe_handle_t *" ; 65*28f16a0fSKyle Evans.Pp 66*28f16a0fSKyle Evans.Ft "const char *" Ns 67*28f16a0fSKyle Evans.Fn be_active_path "libbe_handle_t *" ; 68*28f16a0fSKyle Evans.Pp 69*28f16a0fSKyle Evans.Ft "const char *" Ns 70*28f16a0fSKyle Evans.Fn be_root_path "libbe_handle_t *" ; 71*28f16a0fSKyle Evans.Pp 72*28f16a0fSKyle Evans.Ft "nvlist_t *" Ns 73*28f16a0fSKyle Evans.Fn libbe_handle_t "libbe_handle_t " ; 74*28f16a0fSKyle Evans.Pp 75*28f16a0fSKyle Evans.Ft int 76*28f16a0fSKyle Evans.Fn be_create "libbe_handle_t *, char *" ; 77*28f16a0fSKyle Evans.Pp 78*28f16a0fSKyle Evans.Ft int 79*28f16a0fSKyle Evans.Fn be_create_from_existing "libbe_handle_t *, char *, char *" ; 80*28f16a0fSKyle Evans.Pp 81*28f16a0fSKyle Evans.Ft int 82*28f16a0fSKyle Evans.Fn be_rename "libbe_handle_t *, char *, char *" ; 83*28f16a0fSKyle Evans.Pp 84*28f16a0fSKyle Evans.\" TODO: Write up of destroy options 85*28f16a0fSKyle Evans.\" typedef enum { 86*28f16a0fSKyle Evans.\" BE_DESTROY_FORCE = 1 << 0, 87*28f16a0fSKyle Evans.\" } be_destroy_opt_t; 88*28f16a0fSKyle Evans.Ft int 89*28f16a0fSKyle Evans.Fn be_destroy "libbe_handle_t *, char *, int" ; 90*28f16a0fSKyle Evans.Pp 91*28f16a0fSKyle Evans.\" TODO: Write up of mount options 92*28f16a0fSKyle Evans.\" typedef enum { 93*28f16a0fSKyle Evans.\" BE_MNT_FORCE = 1 << 0, 94*28f16a0fSKyle Evans.\" BE_MNT_DEEP = 1 << 1, 95*28f16a0fSKyle Evans.\" } be_mount_opt_t; 96*28f16a0fSKyle Evans.Ft int 97*28f16a0fSKyle Evans.Fn be_mount "libbe_handle_t *, char *, char *, int" ; 98*28f16a0fSKyle Evans.Pp 99*28f16a0fSKyle Evans.Ft int 100*28f16a0fSKyle Evans.Fn be_unmount "libbe_handle_t *, char *, int" ; 101*28f16a0fSKyle Evans.Pp 102*28f16a0fSKyle Evans.Ft int 103*28f16a0fSKyle Evans.Fn libbe_errno "libbe_handle_t *" ; 104*28f16a0fSKyle Evans.Pp 105*28f16a0fSKyle Evans.Ft "const char *" Ns 106*28f16a0fSKyle Evans.Fn libbe_error_description "libbe_handle_t *" ; 107*28f16a0fSKyle Evans.Pp 108*28f16a0fSKyle Evans.Ft void 109*28f16a0fSKyle Evans.Fn libbe_print_on_error "libbe_handle_t *, bool" ; 110*28f16a0fSKyle Evans.Pp 111*28f16a0fSKyle Evans.Ft int 112*28f16a0fSKyle Evans.Fn be_root_concat "libbe_handle_t *, char *, char *" ; 113*28f16a0fSKyle Evans.Pp 114*28f16a0fSKyle Evans.Ft int 115*28f16a0fSKyle Evans.Fn be_validate_name "libbe_handle_t *, char *" ; 116*28f16a0fSKyle Evans.Pp 117*28f16a0fSKyle Evans.Ft int 118*28f16a0fSKyle Evans.Fn be_validate_snap "libbe_handle_t *, char *" ; 119*28f16a0fSKyle Evans.Pp 120*28f16a0fSKyle Evans.Ft bool 121*28f16a0fSKyle Evans.Fn be_exists "libbe_handle_t *, char *" ; 122*28f16a0fSKyle Evans.Pp 123*28f16a0fSKyle Evans.Ft int 124*28f16a0fSKyle Evans.Fn be_export "libbe_handle_t *, char *, int fd" ; 125*28f16a0fSKyle Evans.Pp 126*28f16a0fSKyle Evans.Ft int 127*28f16a0fSKyle Evans.Fn be_import "libbe_handle_t *, char *, int fd" ; 128*28f16a0fSKyle Evans.Pp 129*28f16a0fSKyle Evans.Ft int 130*28f16a0fSKyle Evans.Fn be_add_child "libbe_handle_t *, char *, bool" ; 131*28f16a0fSKyle Evans.Pp 132*28f16a0fSKyle Evans.\" .Ft void 133*28f16a0fSKyle Evans.\" .Fn mp_mfree "MINT *mp" ; 134*28f16a0fSKyle Evans.\" .Bd -ragged -offset indent 135*28f16a0fSKyle Evans.\" .Fn mp_itom 136*28f16a0fSKyle Evans.\" returns an 137*28f16a0fSKyle Evans.\" .Vt MINT 138*28f16a0fSKyle Evans.\" with the value of 139*28f16a0fSKyle Evans.\" .Fa n . 140*28f16a0fSKyle Evans.\" .Fn mp_xtom 141*28f16a0fSKyle Evans.\" returns an 142*28f16a0fSKyle Evans.\" .Vt MINT 143*28f16a0fSKyle Evans.\" with the value of 144*28f16a0fSKyle Evans.\" .Fa s , 145*28f16a0fSKyle Evans.\" which is treated to be in hexadecimal. 146*28f16a0fSKyle Evans.\" The return values from 147*28f16a0fSKyle Evans.\" .Fn mp_itom 148*28f16a0fSKyle Evans.\" and 149*28f16a0fSKyle Evans.\" .Fn mp_xtom 150*28f16a0fSKyle Evans.\" must be released with 151*28f16a0fSKyle Evans.\" .Fn mp_mfree 152*28f16a0fSKyle Evans.\" when they are no longer needed. 153*28f16a0fSKyle Evans.\" .Fn mp_mtox 154*28f16a0fSKyle Evans.\" returns a null-terminated hexadecimal string having the value of 155*28f16a0fSKyle Evans.\" .Fa mp ; 156*28f16a0fSKyle Evans.\" its return value must be released with 157*28f16a0fSKyle Evans.\" .Fn free 158*28f16a0fSKyle Evans.\" .Pq Xr free 3 159*28f16a0fSKyle Evans.\" when it is no longer needed. 160*28f16a0fSKyle Evans.\" .Ed 161*28f16a0fSKyle Evans.\" .Pp 162*28f16a0fSKyle Evans.Sh DIAGNOSTICS 163*28f16a0fSKyle EvansUpon error, one of the following values will be returned. 164*28f16a0fSKyle Evans.\" TODO: make each entry on its own line. 165*28f16a0fSKyle Evans.Bd -ragged -offset indent 166*28f16a0fSKyle EvansBE_ERR_SUCCESS, 167*28f16a0fSKyle EvansBE_ERR_INVALIDNAME, 168*28f16a0fSKyle EvansBE_ERR_EXISTS, 169*28f16a0fSKyle EvansBE_ERR_NOENT, 170*28f16a0fSKyle EvansBE_ERR_PERMS, 171*28f16a0fSKyle EvansBE_ERR_DESTROYACT, 172*28f16a0fSKyle EvansBE_ERR_DESTROYMNT, 173*28f16a0fSKyle EvansBE_ERR_PATHLEN, 174*28f16a0fSKyle EvansBE_ERR_INVORIGIN, 175*28f16a0fSKyle EvansBE_ERR_NOORIGIN, 176*28f16a0fSKyle EvansBE_ERR_MOUNTED, 177*28f16a0fSKyle EvansBE_ERR_NOMOUNT, 178*28f16a0fSKyle EvansBE_ERR_ZFSOPEN, 179*28f16a0fSKyle EvansBE_ERR_ZFSCLONE, 180*28f16a0fSKyle EvansBE_ERR_UNKNOWN 181*28f16a0fSKyle Evans.Ed 182*28f16a0fSKyle Evans.Sh SEE ALSO 183*28f16a0fSKyle Evans.Xr be 1 , 184*28f16a0fSKyle Evans.Sh HISTORY 185*28f16a0fSKyle Evans.Nm 186*28f16a0fSKyle Evansand it's corresponding command, 187*28f16a0fSKyle Evans.Xr be 3 , 188*28f16a0fSKyle Evanswere written as a 2017 Google Summer of Code project with Allan Jude serving 189*28f16a0fSKyle Evansas a mentor. 190*28f16a0fSKyle Evans.\" TODO: update when implementation complete. 191*28f16a0fSKyle Evans.\" .Sh BUGS 192*28f16a0fSKyle Evans 193