Print this page
*** NO COMMENTS ***
Split |
Close |
Expand all |
Collapse all |
--- old/usr/src/lib/libbe/common/libbe.h
+++ new/usr/src/lib/libbe/common/libbe.h
1 1 /*
2 2 * CDDL HEADER START
3 3 *
4 4 * The contents of this file are subject to the terms of the
5 5 * Common Development and Distribution License (the "License").
6 6 * You may not use this file except in compliance with the License.
7 7 *
8 8 * You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE
9 9 * or http://www.opensolaris.org/os/licensing.
10 10 * See the License for the specific language governing permissions
11 11 * and limitations under the License.
12 12 *
13 13 * When distributing Covered Code, include this CDDL HEADER in each
14 14 * file and include the License file at usr/src/OPENSOLARIS.LICENSE.
15 15 * If applicable, add the following below this CDDL HEADER, with the
↓ open down ↓ |
15 lines elided |
↑ open up ↑ |
16 16 * fields enclosed by brackets "[]" replaced with your own identifying
17 17 * information: Portions Copyright [yyyy] [name of copyright owner]
18 18 *
19 19 * CDDL HEADER END
20 20 */
21 21
22 22 /*
23 23 * Copyright (c) 2008, 2010, Oracle and/or its affiliates. All rights reserved.
24 24 */
25 25
26 +/*
27 + * Copyright 2013 Nexenta Systems, Inc. All rights reserved.
28 + */
29 +
26 30 #ifndef _LIBBE_H
27 31 #define _LIBBE_H
28 32
29 33 #include <libnvpair.h>
30 34 #include <uuid/uuid.h>
31 35 #include <libzfs.h>
32 36
33 37 #ifdef __cplusplus
34 38 extern "C" {
35 39 #endif
36 40
37 41 #define BE_ATTR_ORIG_BE_NAME "orig_be_name"
38 42 #define BE_ATTR_ORIG_BE_POOL "orig_be_pool"
39 43 #define BE_ATTR_SNAP_NAME "snap_name"
40 44
41 45 #define BE_ATTR_NEW_BE_NAME "new_be_name"
42 46 #define BE_ATTR_NEW_BE_POOL "new_be_pool"
43 47 #define BE_ATTR_NEW_BE_DESC "new_be_desc"
44 48 #define BE_ATTR_POLICY "policy"
45 49 #define BE_ATTR_ZFS_PROPERTIES "zfs_properties"
46 50
47 51 #define BE_ATTR_FS_NAMES "fs_names"
48 52 #define BE_ATTR_FS_NUM "fs_num"
49 53 #define BE_ATTR_SHARED_FS_NAMES "shared_fs_names"
50 54 #define BE_ATTR_SHARED_FS_NUM "shared_fs_num"
↓ open down ↓ |
15 lines elided |
↑ open up ↑ |
51 55
52 56 #define BE_ATTR_MOUNTPOINT "mountpoint"
53 57 #define BE_ATTR_MOUNT_FLAGS "mount_flags"
54 58 #define BE_ATTR_UNMOUNT_FLAGS "unmount_flags"
55 59 #define BE_ATTR_DESTROY_FLAGS "destroy_flags"
56 60 #define BE_ATTR_ROOT_DS "root_ds"
57 61 #define BE_ATTR_UUID_STR "uuid_str"
58 62
59 63 #define BE_ATTR_ACTIVE "active"
60 64 #define BE_ATTR_ACTIVE_ON_BOOT "active_boot"
65 +#define BE_ATTR_GLOBAL_ACTIVE "global_active"
61 66 #define BE_ATTR_SPACE "space_used"
62 67 #define BE_ATTR_DATASET "dataset"
63 68 #define BE_ATTR_STATUS "status"
64 69 #define BE_ATTR_DATE "date"
65 70 #define BE_ATTR_MOUNTED "mounted"
66 71
67 72 /*
68 73 * libbe error codes
69 74 *
70 75 * NOTE: there is a copy of this enum in beadm/messages.py. To keep these
71 76 * in sync please make sure to add any new error messages at the end
72 77 * of this enumeration.
73 78 */
74 79 enum {
75 80 BE_SUCCESS = 0,
76 81 BE_ERR_ACCESS = 4000, /* permission denied */
77 82 BE_ERR_ACTIVATE_CURR, /* Activation of current BE failed */
78 83 BE_ERR_AUTONAME, /* auto naming failed */
79 84 BE_ERR_BE_NOENT, /* No such BE */
80 85 BE_ERR_BUSY, /* mount busy */
81 86 BE_ERR_CANCELED, /* operation canceled */
82 87 BE_ERR_CLONE, /* BE clone failed */
83 88 BE_ERR_COPY, /* BE copy failed */
84 89 BE_ERR_CREATDS, /* dataset creation failed */
85 90 BE_ERR_CURR_BE_NOT_FOUND, /* Can't find current BE */
86 91 BE_ERR_DESTROY, /* failed to destroy BE or snapshot */
87 92 BE_ERR_DEMOTE, /* BE demotion failed */
88 93 BE_ERR_DSTYPE, /* invalid dataset type */
89 94 BE_ERR_BE_EXISTS, /* BE exists */
90 95 BE_ERR_INIT, /* be_zfs_init failed */
91 96 BE_ERR_INTR, /* interupted system call */
92 97 BE_ERR_INVAL, /* invalid argument */
93 98 BE_ERR_INVALPROP, /* invalid property for dataset */
94 99 BE_ERR_INVALMOUNTPOINT, /* Unexpected mountpoint */
95 100 BE_ERR_MOUNT, /* mount failed */
96 101 BE_ERR_MOUNTED, /* already mounted */
97 102 BE_ERR_NAMETOOLONG, /* name > BUFSIZ */
98 103 BE_ERR_NOENT, /* Doesn't exist */
99 104 BE_ERR_POOL_NOENT, /* No such pool */
100 105 BE_ERR_NODEV, /* No such device */
101 106 BE_ERR_NOTMOUNTED, /* File system not mounted */
102 107 BE_ERR_NOMEM, /* not enough memory */
103 108 BE_ERR_NONINHERIT, /* property is not inheritable for BE dataset */
104 109 BE_ERR_NXIO, /* No such device or address */
105 110 BE_ERR_NOSPC, /* No space on device */
106 111 BE_ERR_NOTSUP, /* Operation not supported */
107 112 BE_ERR_OPEN, /* open failed */
108 113 BE_ERR_PERM, /* Not owner */
109 114 BE_ERR_UNAVAIL, /* The BE is currently unavailable */
110 115 BE_ERR_PROMOTE, /* BE promotion failed */
111 116 BE_ERR_ROFS, /* read only file system */
112 117 BE_ERR_READONLYDS, /* read only dataset */
113 118 BE_ERR_READONLYPROP, /* read only property */
114 119 BE_ERR_SS_EXISTS, /* snapshot exists */
115 120 BE_ERR_SS_NOENT, /* No such snapshot */
116 121 BE_ERR_UMOUNT, /* unmount failed */
117 122 BE_ERR_UMOUNT_CURR_BE, /* Can't unmount current BE */
118 123 BE_ERR_UMOUNT_SHARED, /* unmount of shared File System failed */
119 124 BE_ERR_UNKNOWN, /* Unknown error */
120 125 BE_ERR_ZFS, /* ZFS returned an error */
121 126 BE_ERR_DESTROY_CURR_BE, /* Cannot destroy current BE */
122 127 BE_ERR_GEN_UUID, /* Failed to generate uuid */
123 128 BE_ERR_PARSE_UUID, /* Failed to parse uuid */
124 129 BE_ERR_NO_UUID, /* BE has no uuid */
125 130 BE_ERR_ZONE_NO_PARENTBE, /* Zone root dataset has no parent uuid */
126 131 BE_ERR_ZONE_MULTIPLE_ACTIVE, /* Zone has multiple active roots */
127 132 BE_ERR_ZONE_NO_ACTIVE_ROOT, /* Zone has no active root for this BE */
128 133 BE_ERR_ZONE_ROOT_NOT_LEGACY, /* Zone root dataset mntpt is not legacy */
129 134 BE_ERR_NO_MOUNTED_ZONE, /* Zone not mounted in alternate BE */
130 135 BE_ERR_MOUNT_ZONEROOT, /* Failed to mount a zone root */
131 136 BE_ERR_UMOUNT_ZONEROOT, /* Failed to unmount a zone root */
132 137 BE_ERR_ZONES_UNMOUNT, /* Unable to unmount a zone. */
133 138 BE_ERR_FAULT, /* Bad Address */
134 139 BE_ERR_RENAME_ACTIVE, /* Renaming the active BE is not supported */
135 140 BE_ERR_NO_MENU, /* Missing boot menu file */
136 141 BE_ERR_DEV_BUSY, /* Device is Busy */
137 142 BE_ERR_BAD_MENU_PATH, /* Invalid path for menu.lst file */
138 143 BE_ERR_ZONE_SS_EXISTS, /* zone snapshot already exists */
139 144 BE_ERR_ADD_SPLASH_ICT, /* Add_splash_image ICT failed */
140 145 BE_ERR_BOOTFILE_INST, /* Error installing boot files */
141 146 BE_ERR_EXTCMD /* External command error */
142 147 } be_errno_t;
143 148
144 149 /*
145 150 * Data structures used to return the listing and information of BEs.
146 151 */
147 152 typedef struct be_dataset_list {
148 153 uint64_t be_ds_space_used;
149 154 boolean_t be_ds_mounted;
150 155 char *be_dataset_name;
151 156 time_t be_ds_creation; /* Date/time stamp when created */
152 157 char *be_ds_mntpt;
153 158 char *be_ds_plcy_type; /* cleanup policy type */
154 159 struct be_dataset_list *be_next_dataset;
155 160 } be_dataset_list_t;
156 161
157 162 typedef struct be_snapshot_list {
158 163 uint64_t be_snapshot_space_used; /* bytes of disk space used */
↓ open down ↓ |
88 lines elided |
↑ open up ↑ |
159 164 char *be_snapshot_name;
160 165 time_t be_snapshot_creation; /* Date/time stamp when created */
161 166 char *be_snapshot_type; /* cleanup policy type */
162 167 struct be_snapshot_list *be_next_snapshot;
163 168 } be_snapshot_list_t;
164 169
165 170 typedef struct be_node_list {
166 171 boolean_t be_mounted; /* is BE currently mounted */
167 172 boolean_t be_active_on_boot; /* is this BE active on boot */
168 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 */
169 176 uint64_t be_space_used;
170 177 char *be_node_name;
171 178 char *be_rpool;
172 179 char *be_root_ds;
173 180 char *be_mntpt;
174 181 char *be_policy_type; /* cleanup policy type */
175 182 char *be_uuid_str; /* string representation of uuid */
176 183 time_t be_node_creation; /* Date/time stamp when created */
177 184 struct be_dataset_list *be_node_datasets;
178 185 uint_t be_node_num_datasets;
179 186 struct be_snapshot_list *be_node_snapshots;
180 187 uint_t be_node_num_snapshots;
181 188 struct be_node_list *be_next_node;
182 189 } be_node_list_t;
183 190
184 191 /* Flags used with mounting a BE */
185 192 #define BE_MOUNT_FLAG_NULL 0x00000000
186 193 #define BE_MOUNT_FLAG_SHARED_FS 0x00000001
187 194 #define BE_MOUNT_FLAG_SHARED_RW 0x00000002
188 195 #define BE_MOUNT_FLAG_NO_ZONES 0x00000004
189 196
190 197 /* Flags used with unmounting a BE */
191 198 #define BE_UNMOUNT_FLAG_NULL 0x00000000
192 199 #define BE_UNMOUNT_FLAG_FORCE 0x00000001
193 200
194 201 /* Flags used with destroying a BE */
195 202 #define BE_DESTROY_FLAG_NULL 0x00000000
196 203 #define BE_DESTROY_FLAG_SNAPSHOTS 0x00000001
197 204 #define BE_DESTROY_FLAG_FORCE_UNMOUNT 0x00000002
198 205
199 206 /*
200 207 * BE functions
201 208 */
202 209 int be_init(nvlist_t *);
203 210 int be_destroy(nvlist_t *);
204 211 int be_copy(nvlist_t *);
205 212
206 213 int be_mount(nvlist_t *);
207 214 int be_unmount(nvlist_t *);
208 215
209 216 int be_rename(nvlist_t *);
210 217
211 218 int be_activate(nvlist_t *);
212 219
213 220 int be_create_snapshot(nvlist_t *);
214 221 int be_destroy_snapshot(nvlist_t *);
215 222 int be_rollback(nvlist_t *);
216 223
217 224 /*
218 225 * Functions for listing and getting information about existing BEs.
219 226 */
220 227 int be_list(char *, be_node_list_t **);
221 228 void be_free_list(be_node_list_t *);
222 229 int be_max_avail(char *, uint64_t *);
223 230 char *be_err_to_str(int);
224 231
225 232 /*
226 233 * Library functions
227 234 */
228 235 void libbe_print_errors(boolean_t);
229 236
230 237 #ifdef __cplusplus
231 238 }
232 239 #endif
233 240
234 241 #endif /* _LIBBE_H */
↓ open down ↓ |
56 lines elided |
↑ open up ↑ |
XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX