Print this page
*** NO COMMENTS ***


   6  * You may not use this file except in compliance with the License.
   7  *
   8  * You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE
   9  * or http://www.opensolaris.org/os/licensing.
  10  * See the License for the specific language governing permissions
  11  * and limitations under the License.
  12  *
  13  * When distributing Covered Code, include this CDDL HEADER in each
  14  * file and include the License file at usr/src/OPENSOLARIS.LICENSE.
  15  * If applicable, add the following below this CDDL HEADER, with the
  16  * fields enclosed by brackets "[]" replaced with your own identifying
  17  * information: Portions Copyright [yyyy] [name of copyright owner]
  18  *
  19  * CDDL HEADER END
  20  */
  21 
  22 /*
  23  * Copyright (c) 2008, 2010, Oracle and/or its affiliates. All rights reserved.
  24  */
  25 




  26 #ifndef _LIBBE_H
  27 #define _LIBBE_H
  28 
  29 #include <libnvpair.h>
  30 #include <uuid/uuid.h>
  31 #include <libzfs.h>
  32 
  33 #ifdef __cplusplus
  34 extern "C" {
  35 #endif
  36 
  37 #define BE_ATTR_ORIG_BE_NAME    "orig_be_name"
  38 #define BE_ATTR_ORIG_BE_POOL    "orig_be_pool"
  39 #define BE_ATTR_SNAP_NAME       "snap_name"
  40 
  41 #define BE_ATTR_NEW_BE_NAME     "new_be_name"
  42 #define BE_ATTR_NEW_BE_POOL     "new_be_pool"
  43 #define BE_ATTR_NEW_BE_DESC     "new_be_desc"
  44 #define BE_ATTR_POLICY          "policy"
  45 #define BE_ATTR_ZFS_PROPERTIES  "zfs_properties"
  46 
  47 #define BE_ATTR_FS_NAMES        "fs_names"
  48 #define BE_ATTR_FS_NUM          "fs_num"
  49 #define BE_ATTR_SHARED_FS_NAMES "shared_fs_names"
  50 #define BE_ATTR_SHARED_FS_NUM   "shared_fs_num"
  51 
  52 #define BE_ATTR_MOUNTPOINT      "mountpoint"
  53 #define BE_ATTR_MOUNT_FLAGS     "mount_flags"
  54 #define BE_ATTR_UNMOUNT_FLAGS   "unmount_flags"
  55 #define BE_ATTR_DESTROY_FLAGS   "destroy_flags"
  56 #define BE_ATTR_ROOT_DS         "root_ds"
  57 #define BE_ATTR_UUID_STR        "uuid_str"
  58 
  59 #define BE_ATTR_ACTIVE          "active"
  60 #define BE_ATTR_ACTIVE_ON_BOOT  "active_boot"

  61 #define BE_ATTR_SPACE           "space_used"
  62 #define BE_ATTR_DATASET         "dataset"
  63 #define BE_ATTR_STATUS          "status"
  64 #define BE_ATTR_DATE            "date"
  65 #define BE_ATTR_MOUNTED         "mounted"
  66 
  67 /*
  68  * libbe error codes
  69  *
  70  * NOTE: there is a copy of this enum in beadm/messages.py. To keep these
  71  *       in sync please make sure to add any new error messages at the end
  72  *       of this enumeration.
  73  */
  74 enum {
  75         BE_SUCCESS = 0,
  76         BE_ERR_ACCESS = 4000,   /* permission denied */
  77         BE_ERR_ACTIVATE_CURR,   /* Activation of current BE failed */
  78         BE_ERR_AUTONAME,        /* auto naming failed */
  79         BE_ERR_BE_NOENT,        /* No such BE */
  80         BE_ERR_BUSY,            /* mount busy */


 149         boolean_t       be_ds_mounted;
 150         char            *be_dataset_name;
 151         time_t          be_ds_creation; /* Date/time stamp when created */
 152         char            *be_ds_mntpt;
 153         char            *be_ds_plcy_type;       /* cleanup policy type */
 154         struct be_dataset_list  *be_next_dataset;
 155 } be_dataset_list_t;
 156 
 157 typedef struct be_snapshot_list {
 158         uint64_t be_snapshot_space_used;        /* bytes of disk space used */
 159         char    *be_snapshot_name;
 160         time_t  be_snapshot_creation;   /* Date/time stamp when created */
 161         char    *be_snapshot_type;      /* cleanup policy type */
 162         struct  be_snapshot_list *be_next_snapshot;
 163 } be_snapshot_list_t;
 164 
 165 typedef struct be_node_list {
 166         boolean_t be_mounted;           /* is BE currently mounted */
 167         boolean_t be_active_on_boot;    /* is this BE active on boot */
 168         boolean_t be_active;            /* is this BE active currently */


 169         uint64_t be_space_used;
 170         char *be_node_name;
 171         char *be_rpool;
 172         char *be_root_ds;
 173         char *be_mntpt;
 174         char *be_policy_type;           /* cleanup policy type */
 175         char *be_uuid_str;              /* string representation of uuid */
 176         time_t be_node_creation;        /* Date/time stamp when created */
 177         struct be_dataset_list *be_node_datasets;
 178         uint_t be_node_num_datasets;
 179         struct be_snapshot_list *be_node_snapshots;
 180         uint_t be_node_num_snapshots;
 181         struct be_node_list *be_next_node;
 182 } be_node_list_t;
 183 
 184 /* Flags used with mounting a BE */
 185 #define BE_MOUNT_FLAG_NULL              0x00000000
 186 #define BE_MOUNT_FLAG_SHARED_FS         0x00000001
 187 #define BE_MOUNT_FLAG_SHARED_RW         0x00000002
 188 #define BE_MOUNT_FLAG_NO_ZONES          0x00000004




   6  * You may not use this file except in compliance with the License.
   7  *
   8  * You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE
   9  * or http://www.opensolaris.org/os/licensing.
  10  * See the License for the specific language governing permissions
  11  * and limitations under the License.
  12  *
  13  * When distributing Covered Code, include this CDDL HEADER in each
  14  * file and include the License file at usr/src/OPENSOLARIS.LICENSE.
  15  * If applicable, add the following below this CDDL HEADER, with the
  16  * fields enclosed by brackets "[]" replaced with your own identifying
  17  * information: Portions Copyright [yyyy] [name of copyright owner]
  18  *
  19  * CDDL HEADER END
  20  */
  21 
  22 /*
  23  * Copyright (c) 2008, 2010, Oracle and/or its affiliates. All rights reserved.
  24  */
  25 
  26 /*
  27  * Copyright 2013 Nexenta Systems, Inc. All rights reserved.
  28  */
  29 
  30 #ifndef _LIBBE_H
  31 #define _LIBBE_H
  32 
  33 #include <libnvpair.h>
  34 #include <uuid/uuid.h>
  35 #include <libzfs.h>
  36 
  37 #ifdef __cplusplus
  38 extern "C" {
  39 #endif
  40 
  41 #define BE_ATTR_ORIG_BE_NAME    "orig_be_name"
  42 #define BE_ATTR_ORIG_BE_POOL    "orig_be_pool"
  43 #define BE_ATTR_SNAP_NAME       "snap_name"
  44 
  45 #define BE_ATTR_NEW_BE_NAME     "new_be_name"
  46 #define BE_ATTR_NEW_BE_POOL     "new_be_pool"
  47 #define BE_ATTR_NEW_BE_DESC     "new_be_desc"
  48 #define BE_ATTR_POLICY          "policy"
  49 #define BE_ATTR_ZFS_PROPERTIES  "zfs_properties"
  50 
  51 #define BE_ATTR_FS_NAMES        "fs_names"
  52 #define BE_ATTR_FS_NUM          "fs_num"
  53 #define BE_ATTR_SHARED_FS_NAMES "shared_fs_names"
  54 #define BE_ATTR_SHARED_FS_NUM   "shared_fs_num"
  55 
  56 #define BE_ATTR_MOUNTPOINT      "mountpoint"
  57 #define BE_ATTR_MOUNT_FLAGS     "mount_flags"
  58 #define BE_ATTR_UNMOUNT_FLAGS   "unmount_flags"
  59 #define BE_ATTR_DESTROY_FLAGS   "destroy_flags"
  60 #define BE_ATTR_ROOT_DS         "root_ds"
  61 #define BE_ATTR_UUID_STR        "uuid_str"
  62 
  63 #define BE_ATTR_ACTIVE          "active"
  64 #define BE_ATTR_ACTIVE_ON_BOOT  "active_boot"
  65 #define BE_ATTR_GLOBAL_ACTIVE   "global_active"
  66 #define BE_ATTR_SPACE           "space_used"
  67 #define BE_ATTR_DATASET         "dataset"
  68 #define BE_ATTR_STATUS          "status"
  69 #define BE_ATTR_DATE            "date"
  70 #define BE_ATTR_MOUNTED         "mounted"
  71 
  72 /*
  73  * libbe error codes
  74  *
  75  * NOTE: there is a copy of this enum in beadm/messages.py. To keep these
  76  *       in sync please make sure to add any new error messages at the end
  77  *       of this enumeration.
  78  */
  79 enum {
  80         BE_SUCCESS = 0,
  81         BE_ERR_ACCESS = 4000,   /* permission denied */
  82         BE_ERR_ACTIVATE_CURR,   /* Activation of current BE failed */
  83         BE_ERR_AUTONAME,        /* auto naming failed */
  84         BE_ERR_BE_NOENT,        /* No such BE */
  85         BE_ERR_BUSY,            /* mount busy */


 154         boolean_t       be_ds_mounted;
 155         char            *be_dataset_name;
 156         time_t          be_ds_creation; /* Date/time stamp when created */
 157         char            *be_ds_mntpt;
 158         char            *be_ds_plcy_type;       /* cleanup policy type */
 159         struct be_dataset_list  *be_next_dataset;
 160 } be_dataset_list_t;
 161 
 162 typedef struct be_snapshot_list {
 163         uint64_t be_snapshot_space_used;        /* bytes of disk space used */
 164         char    *be_snapshot_name;
 165         time_t  be_snapshot_creation;   /* Date/time stamp when created */
 166         char    *be_snapshot_type;      /* cleanup policy type */
 167         struct  be_snapshot_list *be_next_snapshot;
 168 } be_snapshot_list_t;
 169 
 170 typedef struct be_node_list {
 171         boolean_t be_mounted;           /* is BE currently mounted */
 172         boolean_t be_active_on_boot;    /* is this BE active on boot */
 173         boolean_t be_active;            /* is this BE active currently */
 174         boolean_t be_global_active;     /* is zone's BE associated with */
 175                                         /* an active global BE */
 176         uint64_t be_space_used;
 177         char *be_node_name;
 178         char *be_rpool;
 179         char *be_root_ds;
 180         char *be_mntpt;
 181         char *be_policy_type;           /* cleanup policy type */
 182         char *be_uuid_str;              /* string representation of uuid */
 183         time_t be_node_creation;        /* Date/time stamp when created */
 184         struct be_dataset_list *be_node_datasets;
 185         uint_t be_node_num_datasets;
 186         struct be_snapshot_list *be_node_snapshots;
 187         uint_t be_node_num_snapshots;
 188         struct be_node_list *be_next_node;
 189 } be_node_list_t;
 190 
 191 /* Flags used with mounting a BE */
 192 #define BE_MOUNT_FLAG_NULL              0x00000000
 193 #define BE_MOUNT_FLAG_SHARED_FS         0x00000001
 194 #define BE_MOUNT_FLAG_SHARED_RW         0x00000002
 195 #define BE_MOUNT_FLAG_NO_ZONES          0x00000004