xref: /freebsd/lib/libbe/be_impl.h (revision 54d2737e7fe48226c908dcccfbda2ca1c08e07fc)
1 /*
2  * Copyright (c) 2017 Kyle J. Kneitinger <kyle@kneit.in>
3  *
4  * SPDX-License-Identifier: BSD-2-Clause
5  */
6 
7 #ifndef _LIBBE_IMPL_H
8 #define _LIBBE_IMPL_H
9 
10 #include <libzfs.h>
11 
12 #include "be.h"
13 
14 struct libbe_handle {
15 	char root[BE_MAXPATHLEN];
16 	char rootfs[BE_MAXPATHLEN];
17 	char bootfs[BE_MAXPATHLEN];
18 	char *bootonce;
19 	size_t altroot_len;
20 	zpool_handle_t *active_phandle;
21 	libzfs_handle_t *lzh;
22 	be_error_t error;
23 	bool print_on_err;
24 };
25 
26 struct libbe_deep_clone {
27 	libbe_handle_t *lbh;
28 	const char *bename;
29 	const char *snapname;
30 	int depth;
31 	int depth_limit;
32 };
33 
34 struct libbe_dccb {
35 	libbe_handle_t *lbh;
36 	zfs_handle_t *zhp;
37 	nvlist_t *props;
38 };
39 
40 typedef struct prop_data {
41 	nvlist_t *list;
42 	libbe_handle_t *lbh;
43 	bool single_object;	/* list will contain props directly */
44 	char *bootonce;
45 } prop_data_t;
46 
47 int prop_list_builder_cb(zfs_handle_t *, void *);
48 int be_proplist_update(prop_data_t *);
49 
50 char *be_mountpoint_augmented(libbe_handle_t *lbh, char *mountpoint);
51 
52 /* Clobbers any previous errors */
53 int set_error(libbe_handle_t *, be_error_t);
54 
55 #endif  /* _LIBBE_IMPL_H */
56