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