1235329Savg/*-
2235329Savg * Copyright (c) 2012 Andriy Gapon <avg@FreeBSD.org>
3235329Savg * All rights reserved.
4235329Savg *
5235329Savg * Redistribution and use in source and binary forms, with or without
6235329Savg * modification, are permitted provided that the following conditions
7235329Savg * are met:
8235329Savg * 1. Redistributions of source code must retain the above copyright
9235329Savg *    notice, this list of conditions and the following disclaimer.
10235329Savg * 2. Redistributions in binary form must reproduce the above copyright
11235329Savg *    notice, this list of conditions and the following disclaimer in the
12235329Savg *    documentation and/or other materials provided with the distribution.
13235329Savg *
14235329Savg * THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' AND
15235329Savg * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
16235329Savg * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
17235329Savg * ARE DISCLAIMED.  IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE
18235329Savg * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
19235329Savg * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
20235329Savg * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
21235329Savg * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
22235329Savg * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
23235329Savg * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
24235329Savg * SUCH DAMAGE.
25235329Savg *
26235329Savg * $FreeBSD$
27235329Savg */
28235329Savg
29235329Savg#ifndef _BOOT_LIBZFS_H_
30235329Savg#define _BOOT_LIBZFS_H_
31235329Savg
32235329Savg#define	ZFS_MAXNAMELEN	256
33235329Savg
34235329Savg/*
35235329Savg * ZFS fully-qualified device descriptor.
36235329Savg * Note, this must match the 'struct devdesc' declaration in bootstrap.h.
37235329Savg * Arch-specific device descriptors should be binary compatible with this
38235329Savg * structure if they are to support ZFS.
39235329Savg */
40235329Savgstruct zfs_devdesc
41235329Savg{
42235329Savg    struct devsw	*d_dev;
43235329Savg    int			d_type;
44235329Savg    int			d_unit;
45235329Savg    void		*d_opendata;
46235329Savg    uint64_t		pool_guid;
47235329Savg    uint64_t		root_guid;
48235329Savg};
49235329Savg
50235329Savgstruct zfs_boot_args
51235329Savg{
52235329Savg    uint32_t		size;
53235329Savg    uint32_t		reserved;
54235329Savg    uint64_t		pool;
55235329Savg    uint64_t		root;
56241293Savg    uint64_t		primary_pool;
57241293Savg    uint64_t		primary_vdev;
58235329Savg};
59235329Savg
60235329Savgint	zfs_parsedev(struct zfs_devdesc *dev, const char *devspec,
61235329Savg		     const char **path);
62235329Savgchar	*zfs_fmtdev(void *vdev);
63235329Savgint	zfs_probe_dev(const char *devname, uint64_t *pool_guid);
64241283Savgint	zfs_list(const char *name);
65295475Sallanjudevoid	init_zfs_bootenv(char *currdev);
66293802Sallanjudeint	zfs_bootenv(const char *name);
67293802Sallanjudeint	zfs_belist_add(const char *name);
68293802Sallanjudeint	zfs_set_env(void);
69235329Savg
70235329Savgextern struct devsw zfs_dev;
71235329Savgextern struct fs_ops zfs_fsops;
72235329Savg
73235329Savg#endif /*_BOOT_LIBZFS_H_*/
74