1b179da01SKyle Evans /*- 2b179da01SKyle Evans * SPDX-License-Identifier: BSD-2-Clause-FreeBSD 328f16a0fSKyle Evans * 428f16a0fSKyle Evans * Copyright (c) 2017 Kyle J. Kneitinger <kyle@kneit.in> 528f16a0fSKyle Evans * 628f16a0fSKyle Evans * Redistribution and use in source and binary forms, with or without 728f16a0fSKyle Evans * modification, are permitted provided that the following conditions 828f16a0fSKyle Evans * are met: 928f16a0fSKyle Evans * 1. Redistributions of source code must retain the above copyright 1028f16a0fSKyle Evans * notice, this list of conditions and the following disclaimer. 1128f16a0fSKyle Evans * 2. Redistributions in binary form must reproduce the above copyright 1228f16a0fSKyle Evans * notice, this list of conditions and the following disclaimer in the 1328f16a0fSKyle Evans * documentation and/or other materials provided with the distribution. 1428f16a0fSKyle Evans * 1528f16a0fSKyle Evans * THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND 1628f16a0fSKyle Evans * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE 1728f16a0fSKyle Evans * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE 1828f16a0fSKyle Evans * ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE 1928f16a0fSKyle Evans * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL 2028f16a0fSKyle Evans * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS 2128f16a0fSKyle Evans * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) 2228f16a0fSKyle Evans * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT 2328f16a0fSKyle Evans * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY 2428f16a0fSKyle Evans * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF 2528f16a0fSKyle Evans * SUCH DAMAGE. 26b6e7c421SKyle Evans * 27b6e7c421SKyle Evans * $FreeBSD$ 2828f16a0fSKyle Evans */ 2928f16a0fSKyle Evans 3028f16a0fSKyle Evans #ifndef _LIBBE_IMPL_H 3128f16a0fSKyle Evans #define _LIBBE_IMPL_H 3228f16a0fSKyle Evans 3328f16a0fSKyle Evans #include <libzfs.h> 3428f16a0fSKyle Evans 3528f16a0fSKyle Evans #include "be.h" 3628f16a0fSKyle Evans 3728f16a0fSKyle Evans struct libbe_handle { 3855b0e92bSKyle Evans char root[BE_MAXPATHLEN]; 3955b0e92bSKyle Evans char rootfs[BE_MAXPATHLEN]; 4055b0e92bSKyle Evans char bootfs[BE_MAXPATHLEN]; 41fc13fc1cSKyle Evans size_t altroot_len; 42fc13fc1cSKyle Evans zpool_handle_t *active_phandle; 43fc13fc1cSKyle Evans libzfs_handle_t *lzh; 4428f16a0fSKyle Evans be_error_t error; 4528f16a0fSKyle Evans bool print_on_err; 4628f16a0fSKyle Evans }; 4728f16a0fSKyle Evans 4828f16a0fSKyle Evans struct libbe_deep_clone { 4928f16a0fSKyle Evans libbe_handle_t *lbh; 50b29bf2f8SKyle Evans const char *bename; 51b29bf2f8SKyle Evans const char *snapname; 52fa30d9edSKyle Evans int depth; 53fa30d9edSKyle Evans int depth_limit; 5428f16a0fSKyle Evans }; 5528f16a0fSKyle Evans 5628f16a0fSKyle Evans struct libbe_dccb { 57fc13fc1cSKyle Evans libbe_handle_t *lbh; 5828f16a0fSKyle Evans zfs_handle_t *zhp; 5928f16a0fSKyle Evans nvlist_t *props; 6028f16a0fSKyle Evans }; 6128f16a0fSKyle Evans 62843e39ceSKyle Evans typedef struct prop_data { 63843e39ceSKyle Evans nvlist_t *list; 64843e39ceSKyle Evans libbe_handle_t *lbh; 654146029bSKyle Evans bool single_object; /* list will contain props directly */ 66*e307eb94SToomas Soome char *bootonce; 67843e39ceSKyle Evans } prop_data_t; 68843e39ceSKyle Evans 69843e39ceSKyle Evans int prop_list_builder_cb(zfs_handle_t *, void *); 705468566eSKyle Evans int be_proplist_update(prop_data_t *); 71843e39ceSKyle Evans 72fc13fc1cSKyle Evans char *be_mountpoint_augmented(libbe_handle_t *lbh, char *mountpoint); 73fc13fc1cSKyle Evans 7420b7b8d8SKyle Evans /* Clobbers any previous errors */ 7528f16a0fSKyle Evans int set_error(libbe_handle_t *, be_error_t); 7628f16a0fSKyle Evans 7728f16a0fSKyle Evans #endif /* _LIBBE_IMPL_H */ 78