/*
* CDDL HEADER START
*
* The contents of this file are subject to the terms of the
* Common Development and Distribution License (the "License").
* You may not use this file except in compliance with the License.
*
* You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE
* See the License for the specific language governing permissions
* and limitations under the License.
*
* When distributing Covered Code, include this CDDL HEADER in each
* file and include the License file at usr/src/OPENSOLARIS.LICENSE.
* If applicable, add the following below this CDDL HEADER, with the
* fields enclosed by brackets "[]" replaced with your own identifying
* information: Portions Copyright [yyyy] [name of copyright owner]
*
* CDDL HEADER END
*/
/*
*/
/*
* Copyright 2013 Nexenta Systems, Inc. All rights reserved.
* Copyright 2016 Toomas Soome <tsoome@me.com>
* Copyright 2015 Gary Mills
*/
#ifndef _LIBBE_H
#define _LIBBE_H
#include <libnvpair.h>
#include <libzfs.h>
#ifdef __cplusplus
extern "C" {
#endif
/*
* libbe error codes
*
* NOTE: there is a copy of this enum in beadm/messages.py. To keep these
* in sync please make sure to add any new error messages at the end
* of this enumeration.
*/
enum {
BE_SUCCESS = 0,
} be_errno_t;
/*
* Data structures used to return the listing and information of BEs.
*/
typedef struct be_dataset_list {
char *be_dataset_name;
char *be_ds_mntpt;
typedef struct be_snapshot_list {
char *be_snapshot_name;
typedef struct be_node_list {
/* an active global BE */
char *be_node_name;
char *be_rpool;
char *be_root_ds;
char *be_mntpt;
/* Flags used with mounting a BE */
/* Flags used with unmounting a BE */
/* Flags used with destroying a BE */
/* Flags for installboot */
/* sort rules for be_sort() */
typedef enum {
BE_SORT_DATE = 0,
} be_sort_t;
/* for fastboot arguments */
/*
* BE functions
*/
int be_destroy(nvlist_t *);
int be_unmount(nvlist_t *);
int be_activate(nvlist_t *);
int be_create_snapshot(nvlist_t *);
int be_destroy_snapshot(nvlist_t *);
int be_rollback(nvlist_t *);
/*
* Functions for listing and getting information about existing BEs.
*/
int be_list(char *, be_node_list_t **);
void be_free_list(be_node_list_t *);
int be_max_avail(char *, uint64_t *);
char *be_err_to_str(int);
int be_sort(be_node_list_t **, int);
int be_get_boot_args(char **, int);
/*
* Installboot support
*/
int be_installboot(nvlist_t *);
/*
* Library functions
*/
void libbe_print_errors(boolean_t);
#ifdef __cplusplus
}
#endif
#endif /* _LIBBE_H */