xref: /freebsd/stand/libsa/zfs/libzfs.h (revision d2d4e1271b33b233f57fd18a61a1b5c1b0aeb355)
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  * $FreeBSD$
27b8902de1SWarner Losh  */
28b8902de1SWarner Losh 
29e307eb94SToomas Soome #ifndef _BOOT_LIBZFS_H_
30e307eb94SToomas Soome #define _BOOT_LIBZFS_H_
31e307eb94SToomas Soome 
323830659eSToomas Soome #include <zfsimpl.h>
333830659eSToomas Soome 
343830659eSToomas Soome #ifdef LOADER_GELI_SUPPORT
353830659eSToomas Soome #include <crypto/intake.h>
363830659eSToomas Soome #endif
373830659eSToomas Soome 
38e097436cSMark Johnston #include "nvlist.h"
39e097436cSMark Johnston 
40b8902de1SWarner Losh #define	ZFS_MAXNAMELEN	256
41b8902de1SWarner Losh 
42b8902de1SWarner Losh /*
43b8902de1SWarner Losh  * ZFS fully-qualified device descriptor.
44b8902de1SWarner Losh  */
45b8902de1SWarner Losh struct zfs_devdesc {
46b8902de1SWarner Losh 	struct devdesc	dd;		/* Must be first. */
47b8902de1SWarner Losh 	uint64_t	pool_guid;
48b8902de1SWarner Losh 	uint64_t	root_guid;
49b8902de1SWarner Losh };
50b8902de1SWarner Losh 
51b8902de1SWarner Losh int	zfs_parsedev(struct zfs_devdesc *dev, const char *devspec,
52b8902de1SWarner Losh 		     const char **path);
53*d2d4e127SWarner Losh char	*zfs_fmtdev(struct devdesc *);
54b8902de1SWarner Losh int	zfs_probe_dev(const char *devname, uint64_t *pool_guid);
55b8902de1SWarner Losh int	zfs_list(const char *name);
56e307eb94SToomas Soome int	zfs_get_bootonce(void *, const char *, char *, size_t);
57e307eb94SToomas Soome int	zfs_get_bootenv(void *, nvlist_t **);
58e307eb94SToomas Soome int	zfs_set_bootenv(void *, nvlist_t *);
59e307eb94SToomas Soome int	zfs_attach_nvstore(void *);
60b8902de1SWarner Losh uint64_t ldi_get_size(void *);
61277f38abSMariusz Zaborski void	init_zfs_boot_options(const char *currdev);
62e307eb94SToomas Soome 
63b8902de1SWarner Losh int	zfs_bootenv(const char *name);
64e307eb94SToomas Soome int	zfs_attach_nvstore(void *);
65b8902de1SWarner Losh int	zfs_belist_add(const char *name, uint64_t __unused);
66b8902de1SWarner Losh int	zfs_set_env(void);
67b8902de1SWarner Losh 
68e307eb94SToomas Soome nvlist_t *vdev_read_bootenv(vdev_t *);
69e307eb94SToomas Soome 
70b8902de1SWarner Losh extern struct devsw zfs_dev;
71b8902de1SWarner Losh extern struct fs_ops zfs_fsops;
72b8902de1SWarner Losh 
73b8902de1SWarner Losh #endif /*_BOOT_LIBZFS_H_*/
74