Changeset View
Changeset View
Standalone View
Standalone View
stand/libsa/zfs/libzfs.h
Show All 20 Lines | |||||
* HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT | * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT | ||||
* LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY | * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY | ||||
* OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF | * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF | ||||
* SUCH DAMAGE. | * SUCH DAMAGE. | ||||
* | * | ||||
* $FreeBSD$ | * $FreeBSD$ | ||||
*/ | */ | ||||
#ifndef _BOOT_LIBZFS_H_ | |||||
#define _BOOT_LIBZFS_H_ | |||||
#include <zfsimpl.h> | #include <zfsimpl.h> | ||||
#ifdef LOADER_GELI_SUPPORT | #ifdef LOADER_GELI_SUPPORT | ||||
#include <crypto/intake.h> | #include <crypto/intake.h> | ||||
#endif | #endif | ||||
#ifndef _BOOT_LIBZFS_H_ | |||||
#define _BOOT_LIBZFS_H_ | |||||
#define ZFS_MAXNAMELEN 256 | #define ZFS_MAXNAMELEN 256 | ||||
/* | /* | ||||
* ZFS fully-qualified device descriptor. | * ZFS fully-qualified device descriptor. | ||||
*/ | */ | ||||
struct zfs_devdesc { | struct zfs_devdesc { | ||||
struct devdesc dd; /* Must be first. */ | struct devdesc dd; /* Must be first. */ | ||||
uint64_t pool_guid; | uint64_t pool_guid; | ||||
uint64_t root_guid; | uint64_t root_guid; | ||||
}; | }; | ||||
/* nvp implementation version */ | /* nvp implementation version */ | ||||
#define NV_VERSION 0 | #define NV_VERSION 0 | ||||
/* nvlist persistent unique name flags, stored in nvl_nvflags */ | /* nvlist persistent unique name flags, stored in nvl_nvflags */ | ||||
#define NV_UNIQUE_NAME 0x1 | #define NV_UNIQUE_NAME 0x1 | ||||
#define NV_UNIQUE_NAME_TYPE 0x2 | #define NV_UNIQUE_NAME_TYPE 0x2 | ||||
#define NV_ALIGN4(x) (((x) + 3) & ~3) | #define NV_ALIGN4(x) (((x) + 3) & ~3) | ||||
#define NV_ALIGN(x) (((x) + 7) & ~7) | |||||
/* | /* | ||||
* nvlist header. | * nvlist header. | ||||
* nvlist has 4 bytes header followed by version and flags, then nvpairs | * nvlist has 4 bytes header followed by version and flags, then nvpairs | ||||
* and the list is terminated by double zero. | * and the list is terminated by double zero. | ||||
*/ | */ | ||||
typedef struct { | typedef struct { | ||||
char nvh_encoding; | char nvh_encoding; | ||||
Show All 39 Lines | |||||
typedef struct { | typedef struct { | ||||
unsigned nv_type; /* data_type_t */ | unsigned nv_type; /* data_type_t */ | ||||
unsigned nv_nelem; /* number of elements */ | unsigned nv_nelem; /* number of elements */ | ||||
uint8_t nv_data[]; /* data stream */ | uint8_t nv_data[]; /* data stream */ | ||||
} nv_pair_data_t; | } nv_pair_data_t; | ||||
nvlist_t *nvlist_create(int); | nvlist_t *nvlist_create(int); | ||||
void nvlist_destroy(nvlist_t *); | void nvlist_destroy(nvlist_t *); | ||||
nvlist_t *nvlist_import(const uint8_t *, char, char); | nvlist_t *nvlist_import(const char *); | ||||
int nvlist_export(nvlist_t *); | |||||
int nvlist_remove(nvlist_t *, const char *, data_type_t); | int nvlist_remove(nvlist_t *, const char *, data_type_t); | ||||
void nvlist_print(nvlist_t *, unsigned int); | void nvlist_print(nvlist_t *, unsigned int); | ||||
int nvlist_find(const nvlist_t *, const char *, data_type_t, | int nvlist_find(const nvlist_t *, const char *, data_type_t, | ||||
int *, void *, int *); | int *, void *, int *); | ||||
int nvlist_next(nvlist_t *); | int nvlist_next(nvlist_t *); | ||||
int nvlist_add_string(nvlist_t *, const char *, const char *); | |||||
int nvlist_add_uint64(nvlist_t *, const char *, uint64_t); | |||||
int zfs_parsedev(struct zfs_devdesc *dev, const char *devspec, | int zfs_parsedev(struct zfs_devdesc *dev, const char *devspec, | ||||
const char **path); | const char **path); | ||||
char *zfs_fmtdev(void *vdev); | char *zfs_fmtdev(void *vdev); | ||||
int zfs_nextboot(void *vdev, char *buf, size_t size); | int zfs_get_bootonce(void *, const char *, char *, size_t); | ||||
int zfs_get_bootenv(void *, nvlist_t **); | |||||
int zfs_set_bootenv(void *, nvlist_t *); | |||||
int zfs_probe_dev(const char *devname, uint64_t *pool_guid); | int zfs_probe_dev(const char *devname, uint64_t *pool_guid); | ||||
int zfs_list(const char *name); | int zfs_list(const char *name); | ||||
uint64_t ldi_get_size(void *); | uint64_t ldi_get_size(void *); | ||||
void init_zfs_bootenv(const char *currdev); | void init_zfs_bootenv(const char *currdev); | ||||
int zfs_bootenv(const char *name); | int zfs_bootenv(const char *name); | ||||
int zfs_belist_add(const char *name, uint64_t __unused); | int zfs_belist_add(const char *name, uint64_t __unused); | ||||
int zfs_set_env(void); | int zfs_set_env(void); | ||||
nvlist_t *vdev_read_bootenv(vdev_t *); | |||||
extern struct devsw zfs_dev; | extern struct devsw zfs_dev; | ||||
extern struct fs_ops zfs_fsops; | extern struct fs_ops zfs_fsops; | ||||
#endif /*_BOOT_LIBZFS_H_*/ | #endif /*_BOOT_LIBZFS_H_*/ |