libbe.h revision f5e5a2c4965aa1013184568ca3140cdcba93e44b
25c28e83beb90e7c80452a7c818c5e6f73a07dc8Piotr Jasiukajtis/*
25c28e83beb90e7c80452a7c818c5e6f73a07dc8Piotr Jasiukajtis * CDDL HEADER START
25c28e83beb90e7c80452a7c818c5e6f73a07dc8Piotr Jasiukajtis *
25c28e83beb90e7c80452a7c818c5e6f73a07dc8Piotr Jasiukajtis * The contents of this file are subject to the terms of the
25c28e83beb90e7c80452a7c818c5e6f73a07dc8Piotr Jasiukajtis * Common Development and Distribution License (the "License").
25c28e83beb90e7c80452a7c818c5e6f73a07dc8Piotr Jasiukajtis * You may not use this file except in compliance with the License.
25c28e83beb90e7c80452a7c818c5e6f73a07dc8Piotr Jasiukajtis *
25c28e83beb90e7c80452a7c818c5e6f73a07dc8Piotr Jasiukajtis * You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE
25c28e83beb90e7c80452a7c818c5e6f73a07dc8Piotr Jasiukajtis * or http://www.opensolaris.org/os/licensing.
25c28e83beb90e7c80452a7c818c5e6f73a07dc8Piotr Jasiukajtis * See the License for the specific language governing permissions
25c28e83beb90e7c80452a7c818c5e6f73a07dc8Piotr Jasiukajtis * and limitations under the License.
25c28e83beb90e7c80452a7c818c5e6f73a07dc8Piotr Jasiukajtis *
25c28e83beb90e7c80452a7c818c5e6f73a07dc8Piotr Jasiukajtis * When distributing Covered Code, include this CDDL HEADER in each
25c28e83beb90e7c80452a7c818c5e6f73a07dc8Piotr Jasiukajtis * file and include the License file at usr/src/OPENSOLARIS.LICENSE.
25c28e83beb90e7c80452a7c818c5e6f73a07dc8Piotr Jasiukajtis * If applicable, add the following below this CDDL HEADER, with the
25c28e83beb90e7c80452a7c818c5e6f73a07dc8Piotr Jasiukajtis * fields enclosed by brackets "[]" replaced with your own identifying
25c28e83beb90e7c80452a7c818c5e6f73a07dc8Piotr Jasiukajtis * information: Portions Copyright [yyyy] [name of copyright owner]
25c28e83beb90e7c80452a7c818c5e6f73a07dc8Piotr Jasiukajtis *
25c28e83beb90e7c80452a7c818c5e6f73a07dc8Piotr Jasiukajtis * CDDL HEADER END
25c28e83beb90e7c80452a7c818c5e6f73a07dc8Piotr Jasiukajtis */
25c28e83beb90e7c80452a7c818c5e6f73a07dc8Piotr Jasiukajtis
25c28e83beb90e7c80452a7c818c5e6f73a07dc8Piotr Jasiukajtis/*
25c28e83beb90e7c80452a7c818c5e6f73a07dc8Piotr Jasiukajtis * Copyright (c) 2008, 2010, Oracle and/or its affiliates. All rights reserved.
25c28e83beb90e7c80452a7c818c5e6f73a07dc8Piotr Jasiukajtis */
25c28e83beb90e7c80452a7c818c5e6f73a07dc8Piotr Jasiukajtis
25c28e83beb90e7c80452a7c818c5e6f73a07dc8Piotr Jasiukajtis/*
25c28e83beb90e7c80452a7c818c5e6f73a07dc8Piotr Jasiukajtis * Copyright 2013 Nexenta Systems, Inc. All rights reserved.
25c28e83beb90e7c80452a7c818c5e6f73a07dc8Piotr Jasiukajtis * Copyright 2016 Toomas Soome <tsoome@me.com>
25c28e83beb90e7c80452a7c818c5e6f73a07dc8Piotr Jasiukajtis * Copyright 2015 Gary Mills
25c28e83beb90e7c80452a7c818c5e6f73a07dc8Piotr Jasiukajtis */
25c28e83beb90e7c80452a7c818c5e6f73a07dc8Piotr Jasiukajtis
25c28e83beb90e7c80452a7c818c5e6f73a07dc8Piotr Jasiukajtis#ifndef _LIBBE_H
25c28e83beb90e7c80452a7c818c5e6f73a07dc8Piotr Jasiukajtis#define _LIBBE_H
25c28e83beb90e7c80452a7c818c5e6f73a07dc8Piotr Jasiukajtis
25c28e83beb90e7c80452a7c818c5e6f73a07dc8Piotr Jasiukajtis#include <libnvpair.h>
25c28e83beb90e7c80452a7c818c5e6f73a07dc8Piotr Jasiukajtis#include <uuid/uuid.h>
25c28e83beb90e7c80452a7c818c5e6f73a07dc8Piotr Jasiukajtis#include <libzfs.h>
25c28e83beb90e7c80452a7c818c5e6f73a07dc8Piotr Jasiukajtis
25c28e83beb90e7c80452a7c818c5e6f73a07dc8Piotr Jasiukajtis#ifdef __cplusplus
25c28e83beb90e7c80452a7c818c5e6f73a07dc8Piotr Jasiukajtisextern "C" {
25c28e83beb90e7c80452a7c818c5e6f73a07dc8Piotr Jasiukajtis#endif
25c28e83beb90e7c80452a7c818c5e6f73a07dc8Piotr Jasiukajtis
25c28e83beb90e7c80452a7c818c5e6f73a07dc8Piotr Jasiukajtis#define BE_ATTR_ORIG_BE_NAME "orig_be_name"
25c28e83beb90e7c80452a7c818c5e6f73a07dc8Piotr Jasiukajtis#define BE_ATTR_ORIG_BE_POOL "orig_be_pool"
25c28e83beb90e7c80452a7c818c5e6f73a07dc8Piotr Jasiukajtis#define BE_ATTR_ORIG_BE_ROOT "orig_be_root"
25c28e83beb90e7c80452a7c818c5e6f73a07dc8Piotr Jasiukajtis#define BE_ATTR_SNAP_NAME "snap_name"
25c28e83beb90e7c80452a7c818c5e6f73a07dc8Piotr Jasiukajtis
25c28e83beb90e7c80452a7c818c5e6f73a07dc8Piotr Jasiukajtis#define BE_ATTR_NEW_BE_NAME "new_be_name"
25c28e83beb90e7c80452a7c818c5e6f73a07dc8Piotr Jasiukajtis#define BE_ATTR_NEW_BE_POOL "new_be_pool"
25c28e83beb90e7c80452a7c818c5e6f73a07dc8Piotr Jasiukajtis#define BE_ATTR_NEW_BE_DESC "new_be_desc"
25c28e83beb90e7c80452a7c818c5e6f73a07dc8Piotr Jasiukajtis#define BE_ATTR_POLICY "policy"
25c28e83beb90e7c80452a7c818c5e6f73a07dc8Piotr Jasiukajtis#define BE_ATTR_ZFS_PROPERTIES "zfs_properties"
25c28e83beb90e7c80452a7c818c5e6f73a07dc8Piotr Jasiukajtis
25c28e83beb90e7c80452a7c818c5e6f73a07dc8Piotr Jasiukajtis#define BE_ATTR_FS_NAMES "fs_names"
25c28e83beb90e7c80452a7c818c5e6f73a07dc8Piotr Jasiukajtis#define BE_ATTR_FS_NUM "fs_num"
25c28e83beb90e7c80452a7c818c5e6f73a07dc8Piotr Jasiukajtis#define BE_ATTR_SHARED_FS_NAMES "shared_fs_names"
25c28e83beb90e7c80452a7c818c5e6f73a07dc8Piotr Jasiukajtis#define BE_ATTR_SHARED_FS_NUM "shared_fs_num"
25c28e83beb90e7c80452a7c818c5e6f73a07dc8Piotr Jasiukajtis
25c28e83beb90e7c80452a7c818c5e6f73a07dc8Piotr Jasiukajtis#define BE_ATTR_MOUNTPOINT "mountpoint"
25c28e83beb90e7c80452a7c818c5e6f73a07dc8Piotr Jasiukajtis#define BE_ATTR_MOUNT_FLAGS "mount_flags"
25c28e83beb90e7c80452a7c818c5e6f73a07dc8Piotr Jasiukajtis#define BE_ATTR_UNMOUNT_FLAGS "unmount_flags"
25c28e83beb90e7c80452a7c818c5e6f73a07dc8Piotr Jasiukajtis#define BE_ATTR_DESTROY_FLAGS "destroy_flags"
25c28e83beb90e7c80452a7c818c5e6f73a07dc8Piotr Jasiukajtis#define BE_ATTR_INSTALL_FLAGS "install_flags"
25c28e83beb90e7c80452a7c818c5e6f73a07dc8Piotr Jasiukajtis#define BE_ATTR_ROOT_DS "root_ds"
25c28e83beb90e7c80452a7c818c5e6f73a07dc8Piotr Jasiukajtis#define BE_ATTR_UUID_STR "uuid_str"
25c28e83beb90e7c80452a7c818c5e6f73a07dc8Piotr Jasiukajtis
25c28e83beb90e7c80452a7c818c5e6f73a07dc8Piotr Jasiukajtis#define BE_ATTR_ACTIVE "active"
25c28e83beb90e7c80452a7c818c5e6f73a07dc8Piotr Jasiukajtis#define BE_ATTR_ACTIVE_ON_BOOT "active_boot"
25c28e83beb90e7c80452a7c818c5e6f73a07dc8Piotr Jasiukajtis#define BE_ATTR_GLOBAL_ACTIVE "global_active"
25c28e83beb90e7c80452a7c818c5e6f73a07dc8Piotr Jasiukajtis#define BE_ATTR_SPACE "space_used"
25c28e83beb90e7c80452a7c818c5e6f73a07dc8Piotr Jasiukajtis#define BE_ATTR_DATASET "dataset"
25c28e83beb90e7c80452a7c818c5e6f73a07dc8Piotr Jasiukajtis#define BE_ATTR_STATUS "status"
25c28e83beb90e7c80452a7c818c5e6f73a07dc8Piotr Jasiukajtis#define BE_ATTR_DATE "date"
25c28e83beb90e7c80452a7c818c5e6f73a07dc8Piotr Jasiukajtis#define BE_ATTR_MOUNTED "mounted"
25c28e83beb90e7c80452a7c818c5e6f73a07dc8Piotr Jasiukajtis
25c28e83beb90e7c80452a7c818c5e6f73a07dc8Piotr Jasiukajtis/*
25c28e83beb90e7c80452a7c818c5e6f73a07dc8Piotr Jasiukajtis * libbe error codes
25c28e83beb90e7c80452a7c818c5e6f73a07dc8Piotr Jasiukajtis *
25c28e83beb90e7c80452a7c818c5e6f73a07dc8Piotr Jasiukajtis * NOTE: there is a copy of this enum in beadm/messages.py. To keep these
25c28e83beb90e7c80452a7c818c5e6f73a07dc8Piotr Jasiukajtis * in sync please make sure to add any new error messages at the end
25c28e83beb90e7c80452a7c818c5e6f73a07dc8Piotr Jasiukajtis * of this enumeration.
25c28e83beb90e7c80452a7c818c5e6f73a07dc8Piotr Jasiukajtis */
25c28e83beb90e7c80452a7c818c5e6f73a07dc8Piotr Jasiukajtisenum {
25c28e83beb90e7c80452a7c818c5e6f73a07dc8Piotr Jasiukajtis BE_SUCCESS = 0,
25c28e83beb90e7c80452a7c818c5e6f73a07dc8Piotr Jasiukajtis BE_ERR_ACCESS = 4000, /* permission denied */
25c28e83beb90e7c80452a7c818c5e6f73a07dc8Piotr Jasiukajtis BE_ERR_ACTIVATE_CURR, /* Activation of current BE failed */
25c28e83beb90e7c80452a7c818c5e6f73a07dc8Piotr Jasiukajtis BE_ERR_AUTONAME, /* auto naming failed */
25c28e83beb90e7c80452a7c818c5e6f73a07dc8Piotr Jasiukajtis BE_ERR_BE_NOENT, /* No such BE */
25c28e83beb90e7c80452a7c818c5e6f73a07dc8Piotr Jasiukajtis BE_ERR_BUSY, /* mount busy */
25c28e83beb90e7c80452a7c818c5e6f73a07dc8Piotr Jasiukajtis BE_ERR_CANCELED, /* operation canceled */
25c28e83beb90e7c80452a7c818c5e6f73a07dc8Piotr Jasiukajtis BE_ERR_CLONE, /* BE clone failed */
25c28e83beb90e7c80452a7c818c5e6f73a07dc8Piotr Jasiukajtis BE_ERR_COPY, /* BE copy failed */
25c28e83beb90e7c80452a7c818c5e6f73a07dc8Piotr Jasiukajtis BE_ERR_CREATDS, /* dataset creation failed */
25c28e83beb90e7c80452a7c818c5e6f73a07dc8Piotr Jasiukajtis BE_ERR_CURR_BE_NOT_FOUND, /* Can't find current BE */
25c28e83beb90e7c80452a7c818c5e6f73a07dc8Piotr Jasiukajtis BE_ERR_DESTROY, /* failed to destroy BE or snapshot */
25c28e83beb90e7c80452a7c818c5e6f73a07dc8Piotr Jasiukajtis BE_ERR_DEMOTE, /* BE demotion failed */
25c28e83beb90e7c80452a7c818c5e6f73a07dc8Piotr Jasiukajtis BE_ERR_DSTYPE, /* invalid dataset type */
25c28e83beb90e7c80452a7c818c5e6f73a07dc8Piotr Jasiukajtis BE_ERR_BE_EXISTS, /* BE exists */
25c28e83beb90e7c80452a7c818c5e6f73a07dc8Piotr Jasiukajtis BE_ERR_INIT, /* be_zfs_init failed */
25c28e83beb90e7c80452a7c818c5e6f73a07dc8Piotr Jasiukajtis BE_ERR_INTR, /* interupted system call */
25c28e83beb90e7c80452a7c818c5e6f73a07dc8Piotr Jasiukajtis BE_ERR_INVAL, /* invalid argument */
25c28e83beb90e7c80452a7c818c5e6f73a07dc8Piotr Jasiukajtis BE_ERR_INVALPROP, /* invalid property for dataset */
25c28e83beb90e7c80452a7c818c5e6f73a07dc8Piotr Jasiukajtis BE_ERR_INVALMOUNTPOINT, /* Unexpected mountpoint */
25c28e83beb90e7c80452a7c818c5e6f73a07dc8Piotr Jasiukajtis BE_ERR_MOUNT, /* mount failed */
25c28e83beb90e7c80452a7c818c5e6f73a07dc8Piotr Jasiukajtis BE_ERR_MOUNTED, /* already mounted */
25c28e83beb90e7c80452a7c818c5e6f73a07dc8Piotr Jasiukajtis BE_ERR_NAMETOOLONG, /* name > BUFSIZ */
25c28e83beb90e7c80452a7c818c5e6f73a07dc8Piotr Jasiukajtis BE_ERR_NOENT, /* Doesn't exist */
25c28e83beb90e7c80452a7c818c5e6f73a07dc8Piotr Jasiukajtis BE_ERR_POOL_NOENT, /* No such pool */
25c28e83beb90e7c80452a7c818c5e6f73a07dc8Piotr Jasiukajtis BE_ERR_NODEV, /* No such device */
25c28e83beb90e7c80452a7c818c5e6f73a07dc8Piotr Jasiukajtis BE_ERR_NOTMOUNTED, /* File system not mounted */
25c28e83beb90e7c80452a7c818c5e6f73a07dc8Piotr Jasiukajtis BE_ERR_NOMEM, /* not enough memory */
25c28e83beb90e7c80452a7c818c5e6f73a07dc8Piotr Jasiukajtis BE_ERR_NONINHERIT, /* property is not inheritable for BE dataset */
25c28e83beb90e7c80452a7c818c5e6f73a07dc8Piotr Jasiukajtis BE_ERR_NXIO, /* No such device or address */
25c28e83beb90e7c80452a7c818c5e6f73a07dc8Piotr Jasiukajtis BE_ERR_NOSPC, /* No space on device */
25c28e83beb90e7c80452a7c818c5e6f73a07dc8Piotr Jasiukajtis BE_ERR_NOTSUP, /* Operation not supported */
25c28e83beb90e7c80452a7c818c5e6f73a07dc8Piotr Jasiukajtis BE_ERR_OPEN, /* open failed */
25c28e83beb90e7c80452a7c818c5e6f73a07dc8Piotr Jasiukajtis BE_ERR_PERM, /* Not owner */
25c28e83beb90e7c80452a7c818c5e6f73a07dc8Piotr Jasiukajtis BE_ERR_UNAVAIL, /* The BE is currently unavailable */
25c28e83beb90e7c80452a7c818c5e6f73a07dc8Piotr Jasiukajtis BE_ERR_PROMOTE, /* BE promotion failed */
25c28e83beb90e7c80452a7c818c5e6f73a07dc8Piotr Jasiukajtis BE_ERR_ROFS, /* read only file system */
25c28e83beb90e7c80452a7c818c5e6f73a07dc8Piotr Jasiukajtis BE_ERR_READONLYDS, /* read only dataset */
25c28e83beb90e7c80452a7c818c5e6f73a07dc8Piotr Jasiukajtis BE_ERR_READONLYPROP, /* read only property */
25c28e83beb90e7c80452a7c818c5e6f73a07dc8Piotr Jasiukajtis BE_ERR_SS_EXISTS, /* snapshot exists */
25c28e83beb90e7c80452a7c818c5e6f73a07dc8Piotr Jasiukajtis BE_ERR_SS_NOENT, /* No such snapshot */
25c28e83beb90e7c80452a7c818c5e6f73a07dc8Piotr Jasiukajtis BE_ERR_UMOUNT, /* unmount failed */
25c28e83beb90e7c80452a7c818c5e6f73a07dc8Piotr Jasiukajtis BE_ERR_UMOUNT_CURR_BE, /* Can't unmount current BE */
25c28e83beb90e7c80452a7c818c5e6f73a07dc8Piotr Jasiukajtis BE_ERR_UMOUNT_SHARED, /* unmount of shared File System failed */
25c28e83beb90e7c80452a7c818c5e6f73a07dc8Piotr Jasiukajtis BE_ERR_UNKNOWN, /* Unknown error */
25c28e83beb90e7c80452a7c818c5e6f73a07dc8Piotr Jasiukajtis BE_ERR_ZFS, /* ZFS returned an error */
25c28e83beb90e7c80452a7c818c5e6f73a07dc8Piotr Jasiukajtis BE_ERR_DESTROY_CURR_BE, /* Cannot destroy current BE */
25c28e83beb90e7c80452a7c818c5e6f73a07dc8Piotr Jasiukajtis BE_ERR_GEN_UUID, /* Failed to generate uuid */
25c28e83beb90e7c80452a7c818c5e6f73a07dc8Piotr Jasiukajtis BE_ERR_PARSE_UUID, /* Failed to parse uuid */
25c28e83beb90e7c80452a7c818c5e6f73a07dc8Piotr Jasiukajtis BE_ERR_NO_UUID, /* BE has no uuid */
25c28e83beb90e7c80452a7c818c5e6f73a07dc8Piotr Jasiukajtis BE_ERR_ZONE_NO_PARENTBE, /* Zone root dataset has no parent uuid */
25c28e83beb90e7c80452a7c818c5e6f73a07dc8Piotr Jasiukajtis BE_ERR_ZONE_MULTIPLE_ACTIVE, /* Zone has multiple active roots */
25c28e83beb90e7c80452a7c818c5e6f73a07dc8Piotr Jasiukajtis BE_ERR_ZONE_NO_ACTIVE_ROOT, /* Zone has no active root for this BE */
25c28e83beb90e7c80452a7c818c5e6f73a07dc8Piotr Jasiukajtis BE_ERR_ZONE_ROOT_NOT_LEGACY, /* Zone root dataset mntpt is not legacy */
25c28e83beb90e7c80452a7c818c5e6f73a07dc8Piotr Jasiukajtis BE_ERR_NO_MOUNTED_ZONE, /* Zone not mounted in alternate BE */
25c28e83beb90e7c80452a7c818c5e6f73a07dc8Piotr Jasiukajtis BE_ERR_MOUNT_ZONEROOT, /* Failed to mount a zone root */
25c28e83beb90e7c80452a7c818c5e6f73a07dc8Piotr Jasiukajtis BE_ERR_UMOUNT_ZONEROOT, /* Failed to unmount a zone root */
25c28e83beb90e7c80452a7c818c5e6f73a07dc8Piotr Jasiukajtis BE_ERR_ZONES_UNMOUNT, /* Unable to unmount a zone. */
25c28e83beb90e7c80452a7c818c5e6f73a07dc8Piotr Jasiukajtis BE_ERR_FAULT, /* Bad Address */
25c28e83beb90e7c80452a7c818c5e6f73a07dc8Piotr Jasiukajtis BE_ERR_RENAME_ACTIVE, /* Renaming the active BE is not supported */
25c28e83beb90e7c80452a7c818c5e6f73a07dc8Piotr Jasiukajtis BE_ERR_NO_MENU, /* Missing boot menu file */
25c28e83beb90e7c80452a7c818c5e6f73a07dc8Piotr Jasiukajtis BE_ERR_DEV_BUSY, /* Device is Busy */
25c28e83beb90e7c80452a7c818c5e6f73a07dc8Piotr Jasiukajtis BE_ERR_BAD_MENU_PATH, /* Invalid path for menu.lst file */
25c28e83beb90e7c80452a7c818c5e6f73a07dc8Piotr Jasiukajtis BE_ERR_ZONE_SS_EXISTS, /* zone snapshot already exists */
25c28e83beb90e7c80452a7c818c5e6f73a07dc8Piotr Jasiukajtis BE_ERR_ADD_SPLASH_ICT, /* Add_splash_image ICT failed */
25c28e83beb90e7c80452a7c818c5e6f73a07dc8Piotr Jasiukajtis BE_ERR_BOOTFILE_INST, /* Error installing boot files */
25c28e83beb90e7c80452a7c818c5e6f73a07dc8Piotr Jasiukajtis BE_ERR_EXTCMD /* External command error */
25c28e83beb90e7c80452a7c818c5e6f73a07dc8Piotr Jasiukajtis} be_errno_t;
25c28e83beb90e7c80452a7c818c5e6f73a07dc8Piotr Jasiukajtis
25c28e83beb90e7c80452a7c818c5e6f73a07dc8Piotr Jasiukajtis/*
25c28e83beb90e7c80452a7c818c5e6f73a07dc8Piotr Jasiukajtis * Data structures used to return the listing and information of BEs.
25c28e83beb90e7c80452a7c818c5e6f73a07dc8Piotr Jasiukajtis */
25c28e83beb90e7c80452a7c818c5e6f73a07dc8Piotr Jasiukajtistypedef struct be_dataset_list {
25c28e83beb90e7c80452a7c818c5e6f73a07dc8Piotr Jasiukajtis uint64_t be_ds_space_used;
25c28e83beb90e7c80452a7c818c5e6f73a07dc8Piotr Jasiukajtis boolean_t be_ds_mounted;
25c28e83beb90e7c80452a7c818c5e6f73a07dc8Piotr Jasiukajtis char *be_dataset_name;
25c28e83beb90e7c80452a7c818c5e6f73a07dc8Piotr Jasiukajtis time_t be_ds_creation; /* Date/time stamp when created */
25c28e83beb90e7c80452a7c818c5e6f73a07dc8Piotr Jasiukajtis char *be_ds_mntpt;
25c28e83beb90e7c80452a7c818c5e6f73a07dc8Piotr Jasiukajtis char *be_ds_plcy_type; /* cleanup policy type */
25c28e83beb90e7c80452a7c818c5e6f73a07dc8Piotr Jasiukajtis struct be_dataset_list *be_next_dataset;
25c28e83beb90e7c80452a7c818c5e6f73a07dc8Piotr Jasiukajtis} be_dataset_list_t;
25c28e83beb90e7c80452a7c818c5e6f73a07dc8Piotr Jasiukajtis
25c28e83beb90e7c80452a7c818c5e6f73a07dc8Piotr Jasiukajtistypedef struct be_snapshot_list {
25c28e83beb90e7c80452a7c818c5e6f73a07dc8Piotr Jasiukajtis uint64_t be_snapshot_space_used; /* bytes of disk space used */
25c28e83beb90e7c80452a7c818c5e6f73a07dc8Piotr Jasiukajtis char *be_snapshot_name;
25c28e83beb90e7c80452a7c818c5e6f73a07dc8Piotr Jasiukajtis time_t be_snapshot_creation; /* Date/time stamp when created */
25c28e83beb90e7c80452a7c818c5e6f73a07dc8Piotr Jasiukajtis char *be_snapshot_type; /* cleanup policy type */
25c28e83beb90e7c80452a7c818c5e6f73a07dc8Piotr Jasiukajtis struct be_snapshot_list *be_next_snapshot;
25c28e83beb90e7c80452a7c818c5e6f73a07dc8Piotr Jasiukajtis} be_snapshot_list_t;
25c28e83beb90e7c80452a7c818c5e6f73a07dc8Piotr Jasiukajtis
25c28e83beb90e7c80452a7c818c5e6f73a07dc8Piotr Jasiukajtistypedef struct be_node_list {
25c28e83beb90e7c80452a7c818c5e6f73a07dc8Piotr Jasiukajtis boolean_t be_mounted; /* is BE currently mounted */
25c28e83beb90e7c80452a7c818c5e6f73a07dc8Piotr Jasiukajtis boolean_t be_active_on_boot; /* is this BE active on boot */
25c28e83beb90e7c80452a7c818c5e6f73a07dc8Piotr Jasiukajtis boolean_t be_active; /* is this BE active currently */
25c28e83beb90e7c80452a7c818c5e6f73a07dc8Piotr Jasiukajtis boolean_t be_global_active; /* is zone's BE associated with */
25c28e83beb90e7c80452a7c818c5e6f73a07dc8Piotr Jasiukajtis /* an active global BE */
25c28e83beb90e7c80452a7c818c5e6f73a07dc8Piotr Jasiukajtis uint64_t be_space_used;
25c28e83beb90e7c80452a7c818c5e6f73a07dc8Piotr Jasiukajtis char *be_node_name;
25c28e83beb90e7c80452a7c818c5e6f73a07dc8Piotr Jasiukajtis char *be_rpool;
25c28e83beb90e7c80452a7c818c5e6f73a07dc8Piotr Jasiukajtis char *be_root_ds;
25c28e83beb90e7c80452a7c818c5e6f73a07dc8Piotr Jasiukajtis char *be_mntpt;
25c28e83beb90e7c80452a7c818c5e6f73a07dc8Piotr Jasiukajtis char *be_policy_type; /* cleanup policy type */
25c28e83beb90e7c80452a7c818c5e6f73a07dc8Piotr Jasiukajtis char *be_uuid_str; /* string representation of uuid */
25c28e83beb90e7c80452a7c818c5e6f73a07dc8Piotr Jasiukajtis time_t be_node_creation; /* Date/time stamp when created */
25c28e83beb90e7c80452a7c818c5e6f73a07dc8Piotr Jasiukajtis struct be_dataset_list *be_node_datasets;
25c28e83beb90e7c80452a7c818c5e6f73a07dc8Piotr Jasiukajtis uint_t be_node_num_datasets;
25c28e83beb90e7c80452a7c818c5e6f73a07dc8Piotr Jasiukajtis struct be_snapshot_list *be_node_snapshots;
25c28e83beb90e7c80452a7c818c5e6f73a07dc8Piotr Jasiukajtis uint_t be_node_num_snapshots;
25c28e83beb90e7c80452a7c818c5e6f73a07dc8Piotr Jasiukajtis struct be_node_list *be_next_node;
25c28e83beb90e7c80452a7c818c5e6f73a07dc8Piotr Jasiukajtis} be_node_list_t;
25c28e83beb90e7c80452a7c818c5e6f73a07dc8Piotr Jasiukajtis
25c28e83beb90e7c80452a7c818c5e6f73a07dc8Piotr Jasiukajtis/* Flags used with mounting a BE */
25c28e83beb90e7c80452a7c818c5e6f73a07dc8Piotr Jasiukajtis#define BE_MOUNT_FLAG_NULL 0x00000000
25c28e83beb90e7c80452a7c818c5e6f73a07dc8Piotr Jasiukajtis#define BE_MOUNT_FLAG_SHARED_FS 0x00000001
25c28e83beb90e7c80452a7c818c5e6f73a07dc8Piotr Jasiukajtis#define BE_MOUNT_FLAG_SHARED_RW 0x00000002
25c28e83beb90e7c80452a7c818c5e6f73a07dc8Piotr Jasiukajtis#define BE_MOUNT_FLAG_NO_ZONES 0x00000004
25c28e83beb90e7c80452a7c818c5e6f73a07dc8Piotr Jasiukajtis
25c28e83beb90e7c80452a7c818c5e6f73a07dc8Piotr Jasiukajtis/* Flags used with unmounting a BE */
25c28e83beb90e7c80452a7c818c5e6f73a07dc8Piotr Jasiukajtis#define BE_UNMOUNT_FLAG_NULL 0x00000000
25c28e83beb90e7c80452a7c818c5e6f73a07dc8Piotr Jasiukajtis#define BE_UNMOUNT_FLAG_FORCE 0x00000001
25c28e83beb90e7c80452a7c818c5e6f73a07dc8Piotr Jasiukajtis
25c28e83beb90e7c80452a7c818c5e6f73a07dc8Piotr Jasiukajtis/* Flags used with destroying a BE */
25c28e83beb90e7c80452a7c818c5e6f73a07dc8Piotr Jasiukajtis#define BE_DESTROY_FLAG_NULL 0x00000000
25c28e83beb90e7c80452a7c818c5e6f73a07dc8Piotr Jasiukajtis#define BE_DESTROY_FLAG_SNAPSHOTS 0x00000001
25c28e83beb90e7c80452a7c818c5e6f73a07dc8Piotr Jasiukajtis#define BE_DESTROY_FLAG_FORCE_UNMOUNT 0x00000002
25c28e83beb90e7c80452a7c818c5e6f73a07dc8Piotr Jasiukajtis
25c28e83beb90e7c80452a7c818c5e6f73a07dc8Piotr Jasiukajtis/* Flags for installboot */
25c28e83beb90e7c80452a7c818c5e6f73a07dc8Piotr Jasiukajtis#define BE_INSTALLBOOT_FLAG_NULL 0x00000000
25c28e83beb90e7c80452a7c818c5e6f73a07dc8Piotr Jasiukajtis#define BE_INSTALLBOOT_FLAG_MBR 0x00000001
25c28e83beb90e7c80452a7c818c5e6f73a07dc8Piotr Jasiukajtis#define BE_INSTALLBOOT_FLAG_FORCE 0x00000002
25c28e83beb90e7c80452a7c818c5e6f73a07dc8Piotr Jasiukajtis#define BE_INSTALLBOOT_FLAG_VERBOSE 0x00000004
25c28e83beb90e7c80452a7c818c5e6f73a07dc8Piotr Jasiukajtis
25c28e83beb90e7c80452a7c818c5e6f73a07dc8Piotr Jasiukajtis/* sort rules for be_sort() */
25c28e83beb90e7c80452a7c818c5e6f73a07dc8Piotr Jasiukajtistypedef enum {
25c28e83beb90e7c80452a7c818c5e6f73a07dc8Piotr Jasiukajtis BE_SORT_UNSPECIFIED = -1,
25c28e83beb90e7c80452a7c818c5e6f73a07dc8Piotr Jasiukajtis BE_SORT_DATE = 0,
25c28e83beb90e7c80452a7c818c5e6f73a07dc8Piotr Jasiukajtis BE_SORT_DATE_REV,
25c28e83beb90e7c80452a7c818c5e6f73a07dc8Piotr Jasiukajtis BE_SORT_NAME,
25c28e83beb90e7c80452a7c818c5e6f73a07dc8Piotr Jasiukajtis BE_SORT_NAME_REV,
25c28e83beb90e7c80452a7c818c5e6f73a07dc8Piotr Jasiukajtis BE_SORT_SPACE,
25c28e83beb90e7c80452a7c818c5e6f73a07dc8Piotr Jasiukajtis BE_SORT_SPACE_REV
25c28e83beb90e7c80452a7c818c5e6f73a07dc8Piotr Jasiukajtis} be_sort_t;
25c28e83beb90e7c80452a7c818c5e6f73a07dc8Piotr Jasiukajtis
25c28e83beb90e7c80452a7c818c5e6f73a07dc8Piotr Jasiukajtis/* for fastboot arguments */
25c28e83beb90e7c80452a7c818c5e6f73a07dc8Piotr Jasiukajtis#define BE_ENTRY_DEFAULT (-1)
25c28e83beb90e7c80452a7c818c5e6f73a07dc8Piotr Jasiukajtis/*
25c28e83beb90e7c80452a7c818c5e6f73a07dc8Piotr Jasiukajtis * BE functions
25c28e83beb90e7c80452a7c818c5e6f73a07dc8Piotr Jasiukajtis */
25c28e83beb90e7c80452a7c818c5e6f73a07dc8Piotr Jasiukajtisint be_init(nvlist_t *);
25c28e83beb90e7c80452a7c818c5e6f73a07dc8Piotr Jasiukajtisint be_destroy(nvlist_t *);
25c28e83beb90e7c80452a7c818c5e6f73a07dc8Piotr Jasiukajtisint be_copy(nvlist_t *);
25c28e83beb90e7c80452a7c818c5e6f73a07dc8Piotr Jasiukajtis
25c28e83beb90e7c80452a7c818c5e6f73a07dc8Piotr Jasiukajtisint be_mount(nvlist_t *);
25c28e83beb90e7c80452a7c818c5e6f73a07dc8Piotr Jasiukajtisint be_unmount(nvlist_t *);
25c28e83beb90e7c80452a7c818c5e6f73a07dc8Piotr Jasiukajtis
25c28e83beb90e7c80452a7c818c5e6f73a07dc8Piotr Jasiukajtisint be_rename(nvlist_t *);
25c28e83beb90e7c80452a7c818c5e6f73a07dc8Piotr Jasiukajtis
25c28e83beb90e7c80452a7c818c5e6f73a07dc8Piotr Jasiukajtisint be_activate(nvlist_t *);
25c28e83beb90e7c80452a7c818c5e6f73a07dc8Piotr Jasiukajtis
25c28e83beb90e7c80452a7c818c5e6f73a07dc8Piotr Jasiukajtisint be_create_snapshot(nvlist_t *);
25c28e83beb90e7c80452a7c818c5e6f73a07dc8Piotr Jasiukajtisint be_destroy_snapshot(nvlist_t *);
25c28e83beb90e7c80452a7c818c5e6f73a07dc8Piotr Jasiukajtisint be_rollback(nvlist_t *);
25c28e83beb90e7c80452a7c818c5e6f73a07dc8Piotr Jasiukajtis
25c28e83beb90e7c80452a7c818c5e6f73a07dc8Piotr Jasiukajtis/*
25c28e83beb90e7c80452a7c818c5e6f73a07dc8Piotr Jasiukajtis * Functions for listing and getting information about existing BEs.
25c28e83beb90e7c80452a7c818c5e6f73a07dc8Piotr Jasiukajtis */
25c28e83beb90e7c80452a7c818c5e6f73a07dc8Piotr Jasiukajtisint be_list(char *, be_node_list_t **);
25c28e83beb90e7c80452a7c818c5e6f73a07dc8Piotr Jasiukajtisvoid be_free_list(be_node_list_t *);
25c28e83beb90e7c80452a7c818c5e6f73a07dc8Piotr Jasiukajtisint be_max_avail(char *, uint64_t *);
25c28e83beb90e7c80452a7c818c5e6f73a07dc8Piotr Jasiukajtischar *be_err_to_str(int);
25c28e83beb90e7c80452a7c818c5e6f73a07dc8Piotr Jasiukajtisint be_sort(be_node_list_t **, int);
25c28e83beb90e7c80452a7c818c5e6f73a07dc8Piotr Jasiukajtisint be_get_boot_args(char **, int);
25c28e83beb90e7c80452a7c818c5e6f73a07dc8Piotr Jasiukajtis/*
25c28e83beb90e7c80452a7c818c5e6f73a07dc8Piotr Jasiukajtis * Installboot support
25c28e83beb90e7c80452a7c818c5e6f73a07dc8Piotr Jasiukajtis */
25c28e83beb90e7c80452a7c818c5e6f73a07dc8Piotr Jasiukajtisint be_installboot(nvlist_t *);
25c28e83beb90e7c80452a7c818c5e6f73a07dc8Piotr Jasiukajtis
25c28e83beb90e7c80452a7c818c5e6f73a07dc8Piotr Jasiukajtis/*
25c28e83beb90e7c80452a7c818c5e6f73a07dc8Piotr Jasiukajtis * Library functions
25c28e83beb90e7c80452a7c818c5e6f73a07dc8Piotr Jasiukajtis */
25c28e83beb90e7c80452a7c818c5e6f73a07dc8Piotr Jasiukajtisvoid libbe_print_errors(boolean_t);
25c28e83beb90e7c80452a7c818c5e6f73a07dc8Piotr Jasiukajtis
25c28e83beb90e7c80452a7c818c5e6f73a07dc8Piotr Jasiukajtis#ifdef __cplusplus
25c28e83beb90e7c80452a7c818c5e6f73a07dc8Piotr Jasiukajtis}
25c28e83beb90e7c80452a7c818c5e6f73a07dc8Piotr Jasiukajtis#endif
25c28e83beb90e7c80452a7c818c5e6f73a07dc8Piotr Jasiukajtis
25c28e83beb90e7c80452a7c818c5e6f73a07dc8Piotr Jasiukajtis#endif /* _LIBBE_H */
25c28e83beb90e7c80452a7c818c5e6f73a07dc8Piotr Jasiukajtis