Print this page
patch zone-auto-create-be
Split |
Close |
Expand all |
Collapse all |
--- old/usr/src/lib/libbe/common/libbe_priv.h
+++ new/usr/src/lib/libbe/common/libbe_priv.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
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 26 /*
27 27 * Copyright 2013 Nexenta Systems, Inc. All rights reserved.
28 28 * Copyright 2015 Toomas Soome <tsoome@me.com>
29 29 */
30 30
31 31 #ifndef _LIBBE_PRIV_H
32 32 #define _LIBBE_PRIV_H
33 33
34 34 #include <libnvpair.h>
35 35 #include <libzfs.h>
36 36 #include <instzones_api.h>
37 37
38 38 #ifdef __cplusplus
39 39 extern "C" {
40 40 #endif
41 41
42 42 #define ARCH_LENGTH MAXNAMELEN
43 43 #define BE_AUTO_NAME_MAX_TRY 3
44 44 #define BE_AUTO_NAME_DELIM '-'
45 45 #define BE_DEFAULTS "/etc/default/be"
46 46 #define BE_DFLT_BENAME_STARTS "BENAME_STARTS_WITH="
47 47 #define BE_CONTAINER_DS_NAME "ROOT"
48 48 #define BE_DEFAULT_CONSOLE "text"
49 49 #define BE_POLICY_PROPERTY "org.opensolaris.libbe:policy"
50 50 #define BE_UUID_PROPERTY "org.opensolaris.libbe:uuid"
51 51 #define BE_PLCY_STATIC "static"
52 52 #define BE_PLCY_VOLATILE "volatile"
53 53 #define BE_GRUB_MENU "/boot/grub/menu.lst"
54 54 #define BE_SPARC_MENU "/boot/menu.lst"
55 55 #define BE_GRUB_COMMENT "#============ End of LIBBE entry ============="
56 56 #define BE_GRUB_SPLASH "splashimage /boot/solaris.xpm"
57 57 #define BE_GRUB_FOREGROUND "foreground 343434"
58 58 #define BE_GRUB_BACKGROUND "background F7FBFF"
59 59 #define BE_GRUB_DEFAULT "default 0"
60 60 #define BE_WHITE_SPACE " \t\r\n"
61 61 #define BE_CAP_FILE "/boot/grub/capability"
62 62 #define BE_INSTALL_GRUB "/sbin/installgrub"
63 63 #define BE_GRUB_STAGE_1 "/boot/grub/stage1"
64 64 #define BE_GRUB_STAGE_2 "/boot/grub/stage2"
65 65 #define BE_INSTALL_BOOT "/usr/sbin/installboot"
↓ open down ↓ |
65 lines elided |
↑ open up ↑ |
66 66 #define BE_SPARC_BOOTBLK "/lib/fs/zfs/bootblk"
67 67
68 68 #define ZFS_CLOSE(_zhp) \
69 69 if (_zhp) { \
70 70 zfs_close(_zhp); \
71 71 _zhp = NULL; \
72 72 }
73 73
74 74 #define BE_ZONE_PARENTBE_PROPERTY "org.opensolaris.libbe:parentbe"
75 75 #define BE_ZONE_ACTIVE_PROPERTY "org.opensolaris.libbe:active"
76 -#define BE_ZONE_SUPPORTED_BRANDS "ipkg labeled"
77 -#define BE_ZONE_SUPPORTED_BRANDS_DELIM " "
78 76
79 77 /* Maximum length for the BE name. */
80 78 #define BE_NAME_MAX_LEN 64
81 79
82 80 #define MAX(a, b) ((a) > (b) ? (a) : (b))
83 81 #define MIN(a, b) ((a) < (b) ? (a) : (b))
84 82
85 83 typedef struct be_transaction_data {
86 84 char *obe_name; /* Original BE name */
87 85 char *obe_root_ds; /* Original BE root dataset */
88 86 char *obe_zpool; /* Original BE pool */
89 87 char *obe_snap_name; /* Original BE snapshot name */
90 88 char *obe_altroot; /* Original BE altroot */
91 89 char *nbe_name; /* New BE name */
92 90 char *nbe_root_ds; /* New BE root dataset */
93 91 char *nbe_zpool; /* New BE pool */
94 92 char *nbe_desc; /* New BE description */
95 93 nvlist_t *nbe_zfs_props; /* New BE dataset properties */
96 94 char *policy; /* BE policy type */
97 95 } be_transaction_data_t;
98 96
99 97 typedef struct be_mount_data {
100 98 char *altroot; /* Location of where to mount BE */
101 99 boolean_t shared_fs; /* Mount shared file sytsems */
102 100 boolean_t shared_rw; /* Mount shared file systems rw */
103 101 } be_mount_data_t;
104 102
105 103 typedef struct be_unmount_data {
106 104 char *altroot; /* Location of where BE is mounted */
107 105 boolean_t force; /* Forcibly unmount */
108 106 } be_unmount_data_t;
109 107
110 108 typedef struct be_destroy_data {
111 109 boolean_t destroy_snaps; /* Destroy snapshots of BE */
112 110 boolean_t force_unmount; /* Forcibly unmount BE if mounted */
113 111 uuid_t gz_be_uuid; /* UUID of the global zone BE */
114 112 } be_destroy_data_t;
115 113
116 114 typedef struct be_demote_data {
117 115 zfs_handle_t *clone_zhp; /* clone dataset to promote */
118 116 time_t origin_creation; /* snapshot creation time of clone */
119 117 const char *snapshot; /* snapshot of dataset being demoted */
120 118 boolean_t find_in_BE; /* flag noting to find clone in BE */
121 119 } be_demote_data_t;
122 120
123 121 typedef struct be_fs_list_data {
124 122 char *altroot;
125 123 char **fs_list;
126 124 int fs_num;
127 125 } be_fs_list_data_t;
128 126
129 127 typedef struct be_plcy_list {
130 128 char *be_plcy_name;
131 129 int be_num_max;
132 130 int be_num_min;
133 131 time_t be_age_max;
134 132 int be_usage_pcnt;
135 133 struct be_plcy_list *be_next_plcy;
136 134 }be_plcy_list_t;
137 135
138 136 struct be_defaults {
139 137 boolean_t be_deflt_rpool_container;
140 138 char be_deflt_bename_starts_with[ZFS_MAXNAMELEN];
141 139 };
142 140
143 141 /* Library globals */
144 142 extern libzfs_handle_t *g_zfs;
145 143 extern boolean_t do_print;
146 144
147 145 /* be_create.c */
148 146 int be_set_uuid(char *);
149 147 int be_get_uuid(const char *, uuid_t *);
150 148
151 149 /* be_list.c */
152 150 int _be_list(char *, be_node_list_t **);
153 151 int be_get_zone_be_list(char *, char *, be_node_list_t **);
154 152
155 153 /* be_mount.c */
156 154 int _be_mount(char *, char **, int);
157 155 int _be_unmount(char *, int);
158 156 int be_mount_pool(zfs_handle_t *, char **, char **, boolean_t *);
159 157 int be_unmount_pool(zfs_handle_t *, char *, char *);
160 158 int be_mount_zone_root(zfs_handle_t *, be_mount_data_t *);
161 159 int be_unmount_zone_root(zfs_handle_t *, be_unmount_data_t *);
162 160 int be_get_legacy_fs(char *, char *, char *, char *, be_fs_list_data_t *);
163 161 void be_free_fs_list(be_fs_list_data_t *);
164 162 char *be_get_ds_from_dir(char *);
165 163 int be_make_tmp_mountpoint(char **);
166 164
167 165 /* be_snapshot.c */
168 166 int _be_create_snapshot(char *, char **, char *);
169 167 int _be_destroy_snapshot(char *, char *);
170 168
171 169 /* be_utils.c */
172 170 boolean_t be_zfs_init(void);
173 171 void be_zfs_fini(void);
174 172 void be_make_root_ds(const char *, const char *, char *, int);
175 173 void be_make_container_ds(const char *, char *, int);
176 174 char *be_make_name_from_ds(const char *, char *);
177 175 int be_append_menu(char *, char *, char *, char *, char *);
178 176 int be_remove_menu(char *, char *, char *);
179 177 int be_update_menu(char *, char *, char *, char *);
180 178 int be_default_grub_bootfs(const char *, char **);
181 179 boolean_t be_has_menu_entry(char *, char *, int *);
182 180 int be_run_cmd(char *, char *, int, char *, int);
183 181 int be_change_grub_default(char *, char *);
184 182 int be_update_vfstab(char *, char *, char *, be_fs_list_data_t *, char *);
185 183 int be_update_zone_vfstab(zfs_handle_t *, char *, char *, char *,
186 184 be_fs_list_data_t *);
187 185 int be_maxsize_avail(zfs_handle_t *, uint64_t *);
188 186 char *be_auto_snap_name(void);
189 187 char *be_auto_be_name(char *);
190 188 char *be_auto_zone_be_name(char *, char *);
191 189 char *be_default_policy(void);
192 190 boolean_t valid_be_policy(char *);
193 191 boolean_t be_valid_auto_snap_name(char *);
194 192 boolean_t be_valid_be_name(const char *);
195 193 void be_print_err(char *, ...);
196 194 int be_find_current_be(be_transaction_data_t *);
197 195 int zfs_err_to_be_err(libzfs_handle_t *);
198 196 int errno_to_be_err(int);
199 197
↓ open down ↓ |
112 lines elided |
↑ open up ↑ |
200 198 /* be_activate.c */
201 199 int _be_activate(char *);
202 200 int be_activate_current_be(void);
203 201 boolean_t be_is_active_on_boot(char *);
204 202
205 203 /* be_zones.c */
206 204 void be_make_zoneroot(char *, char *, int);
207 205 int be_find_active_zone_root(zfs_handle_t *, char *, char *, int);
208 206 int be_find_mounted_zone_root(char *, char *, char *, int);
209 207 boolean_t be_zone_supported(char *);
210 -zoneBrandList_t *be_get_supported_brandlist(void);
211 208 int be_zone_get_parent_uuid(const char *, uuid_t *);
212 209 int be_zone_set_parent_uuid(char *, uuid_t);
213 210 boolean_t be_zone_compare_uuids(char *);
214 211
215 212 /* check architecture functions */
216 213 char *be_get_default_isa(void);
217 214 char *be_get_platform(void);
218 215 boolean_t be_is_isa(char *);
219 216 boolean_t be_has_grub(void);
220 217
221 218 /* callback functions */
222 219 int be_exists_callback(zpool_handle_t *, void *);
223 220 int be_find_zpool_callback(zpool_handle_t *, void *);
224 221 int be_zpool_find_current_be_callback(zpool_handle_t *, void *);
225 222 int be_zfs_find_current_be_callback(zfs_handle_t *, void *);
226 223 int be_check_be_roots_callback(zpool_handle_t *, void *);
227 224
228 225 /* defaults */
229 226 void be_get_defaults(struct be_defaults *defaults);
230 227
231 228 #ifdef __cplusplus
232 229 }
233 230 #endif
234 231
235 232 #endif /* _LIBBE_PRIV_H */
↓ open down ↓ |
15 lines elided |
↑ open up ↑ |
XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX