xref: /titanic_53/usr/src/boot/sys/boot/zfs/libzfs.h (revision 9ab3b3824ad35081ee6dd8f8cda2037a0ecaaa84)
14a5d661aSToomas Soome /*-
24a5d661aSToomas Soome  * Copyright (c) 2012 Andriy Gapon <avg@FreeBSD.org>
34a5d661aSToomas Soome  * All rights reserved.
44a5d661aSToomas Soome  *
54a5d661aSToomas Soome  * Redistribution and use in source and binary forms, with or without
64a5d661aSToomas Soome  * modification, are permitted provided that the following conditions
74a5d661aSToomas Soome  * are met:
84a5d661aSToomas Soome  * 1. Redistributions of source code must retain the above copyright
94a5d661aSToomas Soome  *    notice, this list of conditions and the following disclaimer.
104a5d661aSToomas Soome  * 2. Redistributions in binary form must reproduce the above copyright
114a5d661aSToomas Soome  *    notice, this list of conditions and the following disclaimer in the
124a5d661aSToomas Soome  *    documentation and/or other materials provided with the distribution.
134a5d661aSToomas Soome  *
144a5d661aSToomas Soome  * THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' AND
154a5d661aSToomas Soome  * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
164a5d661aSToomas Soome  * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
174a5d661aSToomas Soome  * ARE DISCLAIMED.  IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE
184a5d661aSToomas Soome  * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
194a5d661aSToomas Soome  * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
204a5d661aSToomas Soome  * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
214a5d661aSToomas Soome  * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
224a5d661aSToomas Soome  * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
234a5d661aSToomas Soome  * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
244a5d661aSToomas Soome  * SUCH DAMAGE.
254a5d661aSToomas Soome  *
264a5d661aSToomas Soome  * $FreeBSD$
274a5d661aSToomas Soome  */
284a5d661aSToomas Soome 
294a5d661aSToomas Soome #ifndef _BOOT_LIBZFS_H_
304a5d661aSToomas Soome #define _BOOT_LIBZFS_H_
314a5d661aSToomas Soome 
324a5d661aSToomas Soome #define	ZFS_MAXNAMELEN	256
334a5d661aSToomas Soome 
344a5d661aSToomas Soome /*
354a5d661aSToomas Soome  * ZFS fully-qualified device descriptor.
364a5d661aSToomas Soome  * Note, this must match the 'struct devdesc' declaration in bootstrap.h.
374a5d661aSToomas Soome  * Arch-specific device descriptors should be binary compatible with this
384a5d661aSToomas Soome  * structure if they are to support ZFS.
394a5d661aSToomas Soome  */
404a5d661aSToomas Soome struct zfs_devdesc
414a5d661aSToomas Soome {
424a5d661aSToomas Soome     struct devsw	*d_dev;
434a5d661aSToomas Soome     int			d_type;
444a5d661aSToomas Soome     int			d_unit;
454a5d661aSToomas Soome     void		*d_opendata;
464a5d661aSToomas Soome     uint64_t		pool_guid;
474a5d661aSToomas Soome     uint64_t		root_guid;
484a5d661aSToomas Soome };
494a5d661aSToomas Soome 
504a5d661aSToomas Soome struct zfs_boot_args
514a5d661aSToomas Soome {
524a5d661aSToomas Soome     uint32_t		size;
534a5d661aSToomas Soome     uint32_t		reserved;
544a5d661aSToomas Soome     uint64_t		pool;
554a5d661aSToomas Soome     uint64_t		root;
564a5d661aSToomas Soome     uint64_t		primary_pool;
574a5d661aSToomas Soome     uint64_t		primary_vdev;
584a5d661aSToomas Soome };
594a5d661aSToomas Soome 
604a5d661aSToomas Soome int	zfs_parsedev(struct zfs_devdesc *dev, const char *devspec,
614a5d661aSToomas Soome 		     const char **path);
624a5d661aSToomas Soome char	*zfs_bootfs(void *vdev);
634a5d661aSToomas Soome char	*zfs_fmtdev(void *vdev);
644a5d661aSToomas Soome int	zfs_probe_dev(const char *devname, uint64_t *pool_guid);
654a5d661aSToomas Soome int	zfs_list(const char *name);
66*9ab3b382SToomas Soome uint64_t ldi_get_size(void *);
674a5d661aSToomas Soome #ifdef __FreeBSD__
684a5d661aSToomas Soome void	init_zfs_bootenv(char *currdev);
694a5d661aSToomas Soome int	zfs_bootenv(const char *name);
704a5d661aSToomas Soome int	zfs_belist_add(const char *name, uint64_t __unused);
714a5d661aSToomas Soome int	zfs_set_env(void);
724a5d661aSToomas Soome #endif
734a5d661aSToomas Soome 
744a5d661aSToomas Soome extern struct devsw zfs_dev;
754a5d661aSToomas Soome extern struct fs_ops zfs_fsops;
764a5d661aSToomas Soome 
774a5d661aSToomas Soome #endif /*_BOOT_LIBZFS_H_*/
78