xref: /freebsd/lib/libbe/be_impl.h (revision b29bf2f84ea838b1b7dad4e80858b637395930ae)
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 
3728f16a0fSKyle Evans struct libbe_handle {
3828f16a0fSKyle Evans 	libzfs_handle_t *lzh;
39c3a34c08SKyle Evans 	zpool_handle_t *active_phandle;
4028f16a0fSKyle Evans 	char root[BE_MAXPATHLEN];
41c3a34c08SKyle Evans 	char rootfs[BE_MAXPATHLEN];
42c3a34c08SKyle Evans 	char bootfs[BE_MAXPATHLEN];
4328f16a0fSKyle Evans 	be_error_t error;
4428f16a0fSKyle Evans 	bool print_on_err;
4528f16a0fSKyle Evans };
4628f16a0fSKyle Evans 
4728f16a0fSKyle Evans struct libbe_deep_clone {
4828f16a0fSKyle Evans 	libbe_handle_t *lbh;
49*b29bf2f8SKyle Evans 	const char *bename;
50*b29bf2f8SKyle Evans 	const char *snapname;
51*b29bf2f8SKyle Evans 	const char *be_root;
5228f16a0fSKyle Evans };
5328f16a0fSKyle Evans 
5428f16a0fSKyle Evans struct libbe_dccb {
5528f16a0fSKyle Evans 	zfs_handle_t *zhp;
5628f16a0fSKyle Evans 	nvlist_t *props;
5728f16a0fSKyle Evans };
5828f16a0fSKyle Evans 
5928f16a0fSKyle Evans int set_error(libbe_handle_t *, be_error_t);
6028f16a0fSKyle Evans 
6128f16a0fSKyle Evans #endif  /* _LIBBE_IMPL_H */
62