xref: /freebsd/stand/libsa/zfs/libzfs.h (revision b3e7694832e81d7a904a10f525f8797b753bf0d3)
1b8902de1SWarner Losh /*-
2b8902de1SWarner Losh  * Copyright (c) 2012 Andriy Gapon <avg@FreeBSD.org>
3b8902de1SWarner Losh  * All rights reserved.
4b8902de1SWarner Losh  *
5b8902de1SWarner Losh  * Redistribution and use in source and binary forms, with or without
6b8902de1SWarner Losh  * modification, are permitted provided that the following conditions
7b8902de1SWarner Losh  * are met:
8b8902de1SWarner Losh  * 1. Redistributions of source code must retain the above copyright
9b8902de1SWarner Losh  *    notice, this list of conditions and the following disclaimer.
10b8902de1SWarner Losh  * 2. Redistributions in binary form must reproduce the above copyright
11b8902de1SWarner Losh  *    notice, this list of conditions and the following disclaimer in the
12b8902de1SWarner Losh  *    documentation and/or other materials provided with the distribution.
13b8902de1SWarner Losh  *
14b8902de1SWarner Losh  * THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' AND
15b8902de1SWarner Losh  * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
16b8902de1SWarner Losh  * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
17b8902de1SWarner Losh  * ARE DISCLAIMED.  IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE
18b8902de1SWarner Losh  * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
19b8902de1SWarner Losh  * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
20b8902de1SWarner Losh  * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
21b8902de1SWarner Losh  * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
22b8902de1SWarner Losh  * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
23b8902de1SWarner Losh  * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
24b8902de1SWarner Losh  * SUCH DAMAGE.
25b8902de1SWarner Losh  */
26b8902de1SWarner Losh 
27e307eb94SToomas Soome #ifndef _BOOT_LIBZFS_H_
28e307eb94SToomas Soome #define _BOOT_LIBZFS_H_
29e307eb94SToomas Soome 
303830659eSToomas Soome #include <zfsimpl.h>
313830659eSToomas Soome 
323830659eSToomas Soome #ifdef LOADER_GELI_SUPPORT
333830659eSToomas Soome #include <crypto/intake.h>
343830659eSToomas Soome #endif
353830659eSToomas Soome 
36e097436cSMark Johnston #include "nvlist.h"
37e097436cSMark Johnston 
38b8902de1SWarner Losh #define	ZFS_MAXNAMELEN	256
39b8902de1SWarner Losh 
40b8902de1SWarner Losh /*
41b8902de1SWarner Losh  * ZFS fully-qualified device descriptor.
42b8902de1SWarner Losh  */
43b8902de1SWarner Losh struct zfs_devdesc {
44b8902de1SWarner Losh 	struct devdesc	dd;		/* Must be first. */
45b8902de1SWarner Losh 	uint64_t	pool_guid;
46b8902de1SWarner Losh 	uint64_t	root_guid;
47b8902de1SWarner Losh };
48b8902de1SWarner Losh 
49d2d4e127SWarner Losh char	*zfs_fmtdev(struct devdesc *);
50*71bbe6fbSWarner Losh int	zfs_probe_dev(const char *devname, uint64_t *pool_guid, bool part_too);
51b8902de1SWarner Losh int	zfs_list(const char *name);
52e307eb94SToomas Soome int	zfs_get_bootonce(void *, const char *, char *, size_t);
53e307eb94SToomas Soome int	zfs_get_bootenv(void *, nvlist_t **);
54e307eb94SToomas Soome int	zfs_set_bootenv(void *, nvlist_t *);
55e307eb94SToomas Soome int	zfs_attach_nvstore(void *);
56b8902de1SWarner Losh uint64_t ldi_get_size(void *);
57277f38abSMariusz Zaborski void	init_zfs_boot_options(const char *currdev);
58e307eb94SToomas Soome 
59b8902de1SWarner Losh int	zfs_bootenv(const char *name);
60e307eb94SToomas Soome int	zfs_attach_nvstore(void *);
61b8902de1SWarner Losh int	zfs_belist_add(const char *name, uint64_t __unused);
62b8902de1SWarner Losh int	zfs_set_env(void);
63b8902de1SWarner Losh 
64e307eb94SToomas Soome nvlist_t *vdev_read_bootenv(vdev_t *);
65e307eb94SToomas Soome 
66b8902de1SWarner Losh extern struct devsw zfs_dev;
67b8902de1SWarner Losh extern struct fs_ops zfs_fsops;
68b8902de1SWarner Losh 
69b8902de1SWarner Losh #endif /*_BOOT_LIBZFS_H_*/
70