xref: /freebsd/lib/libbe/be_impl.h (revision 843e39ce7bf6449f5cbb9144774d589574fda3b1)
128f16a0fSKyle Evans /*
228f16a0fSKyle Evans  * be_impl.h
328f16a0fSKyle Evans  *
428f16a0fSKyle Evans  * Copyright (c) 2017 Kyle J. Kneitinger <kyle@kneit.in>
528f16a0fSKyle Evans  * All rights reserved.
628f16a0fSKyle Evans  *
728f16a0fSKyle Evans  * Redistribution and use in source and binary forms, with or without
828f16a0fSKyle Evans  * modification, are permitted provided that the following conditions
928f16a0fSKyle Evans  * are met:
1028f16a0fSKyle Evans  * 1. Redistributions of source code must retain the above copyright
1128f16a0fSKyle Evans  *    notice, this list of conditions and the following disclaimer.
1228f16a0fSKyle Evans  * 2. Redistributions in binary form must reproduce the above copyright
1328f16a0fSKyle Evans  *    notice, this list of conditions and the following disclaimer in the
1428f16a0fSKyle Evans  *    documentation and/or other materials provided with the distribution.
1528f16a0fSKyle Evans  *
1628f16a0fSKyle Evans  * THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND
1728f16a0fSKyle Evans  * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
1828f16a0fSKyle Evans  * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
1928f16a0fSKyle Evans  * ARE DISCLAIMED.  IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE
2028f16a0fSKyle Evans  * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
2128f16a0fSKyle Evans  * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
2228f16a0fSKyle Evans  * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
2328f16a0fSKyle Evans  * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
2428f16a0fSKyle Evans  * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
2528f16a0fSKyle Evans  * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
2628f16a0fSKyle Evans  * SUCH DAMAGE.
2728f16a0fSKyle Evans  */
2828f16a0fSKyle Evans 
2928f16a0fSKyle Evans #ifndef _LIBBE_IMPL_H
3028f16a0fSKyle Evans #define _LIBBE_IMPL_H
3128f16a0fSKyle Evans 
3228f16a0fSKyle Evans #include <libzfs.h>
3328f16a0fSKyle Evans 
3428f16a0fSKyle Evans #include "be.h"
3528f16a0fSKyle Evans 
3628f16a0fSKyle Evans struct libbe_handle {
3728f16a0fSKyle Evans 	libzfs_handle_t *lzh;
38c3a34c08SKyle Evans 	zpool_handle_t *active_phandle;
3928f16a0fSKyle Evans 	char root[BE_MAXPATHLEN];
40c3a34c08SKyle Evans 	char rootfs[BE_MAXPATHLEN];
41c3a34c08SKyle Evans 	char bootfs[BE_MAXPATHLEN];
4228f16a0fSKyle Evans 	be_error_t error;
4328f16a0fSKyle Evans 	bool print_on_err;
4428f16a0fSKyle Evans };
4528f16a0fSKyle Evans 
4628f16a0fSKyle Evans struct libbe_deep_clone {
4728f16a0fSKyle Evans 	libbe_handle_t *lbh;
48b29bf2f8SKyle Evans 	const char *bename;
49b29bf2f8SKyle Evans 	const char *snapname;
50b29bf2f8SKyle Evans 	const char *be_root;
5128f16a0fSKyle Evans };
5228f16a0fSKyle Evans 
5328f16a0fSKyle Evans struct libbe_dccb {
5428f16a0fSKyle Evans 	zfs_handle_t *zhp;
5528f16a0fSKyle Evans 	nvlist_t *props;
5628f16a0fSKyle Evans };
5728f16a0fSKyle Evans 
58*843e39ceSKyle Evans typedef struct prop_data {
59*843e39ceSKyle Evans 	nvlist_t *list;
60*843e39ceSKyle Evans 	libbe_handle_t *lbh;
61*843e39ceSKyle Evans } prop_data_t;
62*843e39ceSKyle Evans 
63*843e39ceSKyle Evans int prop_list_builder_cb(zfs_handle_t *, void *);
64*843e39ceSKyle Evans int prop_list_builder(prop_data_t *);
65*843e39ceSKyle Evans 
6628f16a0fSKyle Evans int set_error(libbe_handle_t *, be_error_t);
6728f16a0fSKyle Evans 
6828f16a0fSKyle Evans #endif  /* _LIBBE_IMPL_H */
69