Print this page
OS-192 zone_create() warning on headnode
Split |
Close |
Expand all |
Collapse all |
--- old/usr/src/head/libzonecfg.h
+++ new/usr/src/head/libzonecfg.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) 2003, 2010, Oracle and/or its affiliates. All rights reserved.
24 24 */
25 25
26 26 #ifndef _LIBZONECFG_H
27 27 #define _LIBZONECFG_H
28 28
29 29 /*
30 30 * Zone configuration header file.
31 31 */
32 32
33 33 #ifdef __cplusplus
34 34 extern "C" {
35 35 #endif
36 36
37 37 /* sys/socket.h is required by net/if.h, which has a constant needed here */
38 38 #include <sys/param.h>
39 39 #include <sys/fstyp.h>
40 40 #include <sys/mount.h>
41 41 #include <priv.h>
42 42 #include <netinet/in.h>
43 43 #include <sys/socket.h>
44 44 #include <net/if.h>
45 45 #include <stdio.h>
46 46 #include <rctl.h>
47 47 #include <zone.h>
48 48 #include <libbrand.h>
49 49 #include <sys/uuid.h>
50 50 #include <libuutil.h>
51 51 #include <sys/mnttab.h>
52 52 #include <limits.h>
53 53 #include <utmpx.h>
54 54
55 55 #define ZONE_ID_UNDEFINED -1
56 56
57 57 #define Z_OK 0
58 58 #define Z_EMPTY_DOCUMENT 1 /* XML doc root element is null */
59 59 #define Z_WRONG_DOC_TYPE 2 /* top-level XML doc element != zone */
60 60 #define Z_BAD_PROPERTY 3 /* libxml-level property problem */
61 61 #define Z_TEMP_FILE 4 /* problem creating temporary file */
62 62 #define Z_SAVING_FILE 5 /* libxml error saving or validating */
63 63 #define Z_NO_ENTRY 6 /* no such entry */
64 64 #define Z_BOGUS_ZONE_NAME 7 /* illegal zone name */
65 65 #define Z_REQD_RESOURCE_MISSING 8 /* required resource missing */
66 66 #define Z_REQD_PROPERTY_MISSING 9 /* required property missing */
67 67 #define Z_BAD_HANDLE 10 /* bad document handle */
68 68 #define Z_NOMEM 11 /* out of memory (like ENOMEM) */
69 69 #define Z_INVAL 12 /* invalid argument (like EINVAL) */
70 70 #define Z_ACCES 13 /* permission denied (like EACCES) */
71 71 #define Z_TOO_BIG 14 /* string won't fit in char array */
72 72 #define Z_MISC_FS 15 /* miscellaneous file-system error */
73 73 #define Z_NO_ZONE 16 /* no such zone */
74 74 #define Z_NO_RESOURCE_TYPE 17 /* no/wrong resource type */
75 75 #define Z_NO_RESOURCE_ID 18 /* no/wrong resource id */
76 76 #define Z_NO_PROPERTY_TYPE 19 /* no/wrong property type */
77 77 #define Z_NO_PROPERTY_ID 20 /* no/wrong property id */
78 78 #define Z_BAD_ZONE_STATE 21 /* zone state invalid for given task */
79 79 #define Z_INVALID_DOCUMENT 22 /* libxml can't validate against DTD */
80 80 #define Z_NAME_IN_USE 23 /* zone name already in use (rename) */
81 81 #define Z_NO_SUCH_ID 24 /* delete_index: no old ID */
82 82 #define Z_UPDATING_INDEX 25 /* add/modify/delete_index problem */
83 83 #define Z_LOCKING_FILE 26 /* problem locking index file */
84 84 #define Z_UNLOCKING_FILE 27 /* problem unlocking index file */
85 85 #define Z_SYSTEM 28 /* consult errno instead */
86 86 #define Z_INSUFFICIENT_SPEC 29 /* resource insufficiently specified */
87 87 #define Z_RESOLVED_PATH 34 /* resolved path mismatch */
88 88 #define Z_IPV6_ADDR_PREFIX_LEN 35 /* IPv6 address prefix length needed */
89 89 #define Z_BOGUS_ADDRESS 36 /* not IPv[4|6] address or host name */
90 90 #define Z_PRIV_PROHIBITED 37 /* specified privilege is prohibited */
91 91 #define Z_PRIV_REQUIRED 38 /* required privilege is missing */
92 92 #define Z_PRIV_UNKNOWN 39 /* specified privilege is unknown */
93 93 #define Z_BRAND_ERROR 40 /* brand-specific error */
94 94 #define Z_INCOMPATIBLE 41 /* incompatible settings */
95 95 #define Z_ALIAS_DISALLOW 42 /* rctl alias disallowed */
96 96 #define Z_CLEAR_DISALLOW 43 /* clear property disallowed */
97 97 #define Z_POOL 44 /* generic libpool error */
98 98 #define Z_POOLS_NOT_ACTIVE 45 /* pool service not enabled */
99 99 #define Z_POOL_ENABLE 46 /* pools enable failed */
100 100 #define Z_NO_POOL 47 /* no such pool configured */
101 101 #define Z_POOL_CREATE 48 /* pool create failed */
102 102 #define Z_POOL_BIND 49 /* pool bind failed */
103 103 #define Z_INVALID_PROPERTY 50 /* invalid property value */
104 104
105 105 /*
106 106 * Warning: these are shared with the admin/install consolidation.
107 107 * Do not insert states between any of the currently defined states,
108 108 * and any new states must be evaluated for impact on range comparisons.
109 109 */
110 110 #define ZONE_STATE_CONFIGURED 0
111 111 #define ZONE_STATE_INCOMPLETE 1
112 112 #define ZONE_STATE_INSTALLED 2
113 113 #define ZONE_STATE_READY 3
114 114 #define ZONE_STATE_RUNNING 4
115 115 #define ZONE_STATE_SHUTTING_DOWN 5
116 116 #define ZONE_STATE_DOWN 6
117 117 #define ZONE_STATE_MOUNTED 7
118 118
119 119 #define ZONE_STATE_MAXSTRLEN 14
120 120
121 121 #define LIBZONECFG_PATH "libzonecfg.so.1"
122 122
123 123 #define ZONE_CONFIG_ROOT "/etc/zones"
124 124 #define ZONE_INDEX_FILE ZONE_CONFIG_ROOT "/index"
125 125
126 126 #define MAXUSERNAME (sizeof (((struct utmpx *)0)->ut_name))
127 127 #define MAXAUTHS 4096
128 128 #define ZONE_MGMT_PROF "Zone Management"
129 129
130 130 /* Owner, group, and mode (defined by packaging) for the config directory */
131 131 #define ZONE_CONFIG_UID 0 /* root */
132 132 #define ZONE_CONFIG_GID 3 /* sys */
133 133 #define ZONE_CONFIG_MODE 0755
134 134
135 135 /* Owner, group, and mode (defined by packaging) for the index file */
136 136 #define ZONE_INDEX_UID 0 /* root */
137 137 #define ZONE_INDEX_GID 3 /* sys */
138 138 #define ZONE_INDEX_MODE 0644
139 139
140 140 /* The maximum length of the VERSION string in the pkginfo(4) file. */
141 141 #define ZONE_PKG_VERSMAX 256
142 142
143 143 /*
144 144 * Shortened alias names for the zones rctls.
145 145 */
146 146 #define ALIAS_MAXLWPS "max-lwps"
147 147 #define ALIAS_MAXSHMMEM "max-shm-memory"
148 148 #define ALIAS_MAXSHMIDS "max-shm-ids"
149 149 #define ALIAS_MAXMSGIDS "max-msg-ids"
150 150 #define ALIAS_MAXSEMIDS "max-sem-ids"
151 151 #define ALIAS_MAXLOCKEDMEM "locked"
152 152 #define ALIAS_MAXSWAP "swap"
153 153 #define ALIAS_SHARES "cpu-shares"
154 154 #define ALIAS_CPUCAP "cpu-cap"
155 155 #define ALIAS_MAXPROCS "max-processes"
156 156
157 157 /* Default name for zone detached manifest */
158 158 #define ZONE_DETACHED "SUNWdetached.xml"
159 159
160 160 /*
161 161 * Bit flag definitions for passing into libzonecfg functions.
162 162 */
163 163 #define ZONE_DRY_RUN 0x01
164 164
165 165 /*
166 166 * The integer field expresses the current values on a get.
167 167 * On a put, it represents the new values if >= 0 or "don't change" if < 0.
168 168 */
169 169 struct zoneent {
170 170 char zone_name[ZONENAME_MAX]; /* name of the zone */
171 171 int zone_state; /* configured | incomplete | installed */
172 172 char zone_path[MAXPATHLEN]; /* path to zone storage */
173 173 uuid_t zone_uuid; /* unique ID for zone */
174 174 char zone_newname[ZONENAME_MAX]; /* for doing renames */
175 175 };
176 176
177 177 typedef struct zone_dochandle *zone_dochandle_t; /* opaque handle */
178 178
179 179 typedef uint_t zone_state_t;
180 180
181 181 typedef struct zone_fsopt {
182 182 struct zone_fsopt *zone_fsopt_next;
183 183 char zone_fsopt_opt[MAX_MNTOPT_STR];
184 184 } zone_fsopt_t;
185 185
186 186 struct zone_fstab {
187 187 char zone_fs_special[MAXPATHLEN]; /* special file */
188 188 char zone_fs_dir[MAXPATHLEN]; /* mount point */
189 189 char zone_fs_type[FSTYPSZ]; /* e.g. ufs */
190 190 zone_fsopt_t *zone_fs_options; /* mount options */
191 191 char zone_fs_raw[MAXPATHLEN]; /* device to fsck */
192 192 };
193 193
194 194 struct zone_nwiftab {
195 195 char zone_nwif_address[INET6_ADDRSTRLEN]; /* shared-ip only */
196 196 char zone_nwif_allowed_address[INET6_ADDRSTRLEN]; /* excl-ip only */
197 197 char zone_nwif_physical[LIFNAMSIZ];
198 198 char zone_nwif_defrouter[INET6_ADDRSTRLEN];
199 199 };
200 200
201 201 struct zone_devtab {
202 202 char zone_dev_match[MAXPATHLEN];
203 203 };
204 204
205 205 struct zone_rctlvaltab {
206 206 char zone_rctlval_priv[MAXNAMELEN];
207 207 char zone_rctlval_limit[MAXNAMELEN];
208 208 char zone_rctlval_action[MAXNAMELEN];
209 209 struct zone_rctlvaltab *zone_rctlval_next;
210 210 };
211 211
212 212 struct zone_rctltab {
213 213 char zone_rctl_name[MAXNAMELEN];
214 214 struct zone_rctlvaltab *zone_rctl_valptr;
215 215 };
216 216
217 217 struct zone_attrtab {
218 218 char zone_attr_name[MAXNAMELEN];
219 219 char zone_attr_type[MAXNAMELEN];
220 220 char zone_attr_value[2 * BUFSIZ];
221 221 };
222 222
223 223 struct zone_dstab {
224 224 char zone_dataset_name[MAXNAMELEN];
225 225 };
226 226
227 227 struct zone_psettab {
228 228 char zone_ncpu_min[MAXNAMELEN];
229 229 char zone_ncpu_max[MAXNAMELEN];
230 230 char zone_importance[MAXNAMELEN];
231 231 };
232 232
233 233 struct zone_mcaptab {
234 234 char zone_physmem_cap[MAXNAMELEN];
235 235 };
236 236
237 237 struct zone_pkgtab {
238 238 char zone_pkg_name[MAXNAMELEN];
239 239 char zone_pkg_version[ZONE_PKG_VERSMAX];
240 240 };
241 241
242 242 struct zone_devpermtab {
243 243 char zone_devperm_name[MAXPATHLEN];
244 244 uid_t zone_devperm_uid;
245 245 gid_t zone_devperm_gid;
246 246 mode_t zone_devperm_mode;
247 247 char *zone_devperm_acl;
248 248 };
249 249
250 250 struct zone_admintab {
251 251 char zone_admin_user[MAXUSERNAME];
252 252 char zone_admin_auths[MAXAUTHS];
253 253 };
254 254
255 255 #define ZONECFG_SECFLAGS_MAX 1024
256 256 struct zone_secflagstab {
257 257 char zone_secflags_lower[ZONECFG_SECFLAGS_MAX];
258 258 char zone_secflags_upper[ZONECFG_SECFLAGS_MAX];
259 259 char zone_secflags_default[ZONECFG_SECFLAGS_MAX];
260 260 };
261 261
262 262 typedef struct zone_userauths {
263 263 char user[MAXUSERNAME];
264 264 char zonename[ZONENAME_MAX];
265 265 struct zone_userauths *next;
266 266 } zone_userauths_t;
267 267
268 268 typedef struct {
269 269 uu_avl_node_t zpe_entry;
270 270 char *zpe_name;
271 271 char *zpe_vers;
272 272 } zone_pkg_entry_t;
273 273
274 274 typedef enum zone_iptype {
275 275 ZS_SHARED,
276 276 ZS_EXCLUSIVE
277 277 } zone_iptype_t;
278 278
279 279 /*
280 280 * Basic configuration management routines.
281 281 */
282 282 extern zone_dochandle_t zonecfg_init_handle(void);
283 283 extern int zonecfg_get_handle(const char *, zone_dochandle_t);
284 284 extern int zonecfg_get_snapshot_handle(const char *, zone_dochandle_t);
285 285 extern int zonecfg_get_template_handle(const char *, const char *,
286 286 zone_dochandle_t);
287 287 extern int zonecfg_get_xml_handle(const char *, zone_dochandle_t);
288 288 extern int zonecfg_check_handle(zone_dochandle_t);
289 289 extern void zonecfg_fini_handle(zone_dochandle_t);
290 290 extern int zonecfg_destroy(const char *, boolean_t);
291 291 extern int zonecfg_destroy_snapshot(const char *);
292 292 extern int zonecfg_save(zone_dochandle_t);
293 293 extern int zonecfg_create_snapshot(const char *);
294 294 extern char *zonecfg_strerror(int);
295 295 extern int zonecfg_access(const char *, int);
296 296 extern void zonecfg_set_root(const char *);
297 297 extern const char *zonecfg_get_root(void);
298 298 extern boolean_t zonecfg_in_alt_root(void);
299 299 extern int zonecfg_num_resources(zone_dochandle_t, char *);
300 300 extern int zonecfg_del_all_resources(zone_dochandle_t, char *);
301 301 extern boolean_t zonecfg_valid_ncpus(char *, char *);
302 302 extern boolean_t zonecfg_valid_importance(char *);
303 303 extern int zonecfg_str_to_bytes(char *, uint64_t *);
304 304 extern boolean_t zonecfg_valid_memlimit(char *, uint64_t *);
305 305 extern boolean_t zonecfg_valid_alias_limit(char *, char *, uint64_t *);
306 306
307 307 /*
308 308 * Zone name, path to zone directory, autoboot setting, pool, boot
309 309 * arguments, and scheduling-class.
310 310 */
311 311 extern int zonecfg_validate_zonename(const char *);
312 312 extern int zonecfg_get_name(zone_dochandle_t, char *, size_t);
313 313 extern int zonecfg_set_name(zone_dochandle_t, char *);
314 314 extern int zonecfg_get_zonepath(zone_dochandle_t, char *, size_t);
315 315 extern int zonecfg_set_zonepath(zone_dochandle_t, char *);
316 316 extern int zonecfg_get_autoboot(zone_dochandle_t, boolean_t *);
↓ open down ↓ |
316 lines elided |
↑ open up ↑ |
317 317 extern int zonecfg_set_autoboot(zone_dochandle_t, boolean_t);
318 318 extern int zonecfg_get_iptype(zone_dochandle_t, zone_iptype_t *);
319 319 extern int zonecfg_set_iptype(zone_dochandle_t, zone_iptype_t);
320 320 extern int zonecfg_get_pool(zone_dochandle_t, char *, size_t);
321 321 extern int zonecfg_set_pool(zone_dochandle_t, char *);
322 322 extern int zonecfg_get_bootargs(zone_dochandle_t, char *, size_t);
323 323 extern int zonecfg_set_bootargs(zone_dochandle_t, char *);
324 324 extern int zonecfg_get_sched_class(zone_dochandle_t, char *, size_t);
325 325 extern int zonecfg_set_sched(zone_dochandle_t, char *);
326 326 extern int zonecfg_get_dflt_sched_class(zone_dochandle_t, char *, int);
327 +extern zoneid_t zonecfg_get_did(zone_dochandle_t);
328 +extern void zonecfg_set_did(zone_dochandle_t);
327 329
328 330 /*
329 331 * Set/retrieve the brand for the zone
330 332 */
331 333 extern int zonecfg_get_brand(zone_dochandle_t, char *, size_t);
332 334 extern int zonecfg_set_brand(zone_dochandle_t, char *);
333 335
334 336 /*
335 337 * Filesystem configuration.
336 338 */
337 339 extern int zonecfg_add_filesystem(zone_dochandle_t, struct zone_fstab *);
338 340 extern int zonecfg_delete_filesystem(zone_dochandle_t,
339 341 struct zone_fstab *);
340 342 extern int zonecfg_modify_filesystem(zone_dochandle_t,
341 343 struct zone_fstab *, struct zone_fstab *);
342 344 extern int zonecfg_lookup_filesystem(zone_dochandle_t,
343 345 struct zone_fstab *);
344 346 extern int zonecfg_add_fs_option(struct zone_fstab *, char *);
345 347 extern int zonecfg_remove_fs_option(struct zone_fstab *, char *);
346 348 extern void zonecfg_free_fs_option_list(zone_fsopt_t *);
347 349 extern int zonecfg_find_mounts(char *, int(*)(const struct mnttab *,
348 350 void *), void *);
349 351
350 352 /*
351 353 * Network interface configuration.
352 354 */
353 355 extern int zonecfg_add_nwif(zone_dochandle_t, struct zone_nwiftab *);
354 356 extern int zonecfg_delete_nwif(zone_dochandle_t, struct zone_nwiftab *);
355 357 extern int zonecfg_modify_nwif(zone_dochandle_t, struct zone_nwiftab *,
356 358 struct zone_nwiftab *);
357 359 extern int zonecfg_lookup_nwif(zone_dochandle_t, struct zone_nwiftab *);
358 360
359 361 /*
360 362 * Hostid emulation configuration.
361 363 */
362 364 extern int zonecfg_get_hostid(zone_dochandle_t, char *, size_t);
363 365 extern int zonecfg_set_hostid(zone_dochandle_t, const char *);
364 366
365 367 /*
366 368 * Allowed FS mounts configuration.
367 369 */
368 370 extern int zonecfg_get_fs_allowed(zone_dochandle_t, char *, size_t);
369 371 extern int zonecfg_set_fs_allowed(zone_dochandle_t, const char *);
370 372
371 373 /*
372 374 * Device configuration and rule matching.
373 375 */
374 376 extern int zonecfg_add_dev(zone_dochandle_t, struct zone_devtab *);
375 377 extern int zonecfg_delete_dev(zone_dochandle_t, struct zone_devtab *);
376 378 extern int zonecfg_modify_dev(zone_dochandle_t, struct zone_devtab *,
377 379 struct zone_devtab *);
378 380 extern int zonecfg_lookup_dev(zone_dochandle_t, struct zone_devtab *);
379 381
380 382 /*
381 383 * Resource control configuration.
382 384 */
383 385 extern int zonecfg_add_rctl(zone_dochandle_t, struct zone_rctltab *);
384 386 extern int zonecfg_delete_rctl(zone_dochandle_t, struct zone_rctltab *);
385 387 extern int zonecfg_modify_rctl(zone_dochandle_t, struct zone_rctltab *,
386 388 struct zone_rctltab *);
387 389 extern int zonecfg_lookup_rctl(zone_dochandle_t, struct zone_rctltab *);
388 390 extern int zonecfg_add_rctl_value(struct zone_rctltab *,
389 391 struct zone_rctlvaltab *);
390 392 extern int zonecfg_remove_rctl_value(struct zone_rctltab *,
391 393 struct zone_rctlvaltab *);
392 394 extern void zonecfg_free_rctl_value_list(struct zone_rctlvaltab *);
393 395 extern boolean_t zonecfg_aliased_rctl_ok(zone_dochandle_t, char *);
394 396 extern int zonecfg_set_aliased_rctl(zone_dochandle_t, char *, uint64_t);
395 397 extern int zonecfg_get_aliased_rctl(zone_dochandle_t, char *, uint64_t *);
396 398 extern int zonecfg_rm_aliased_rctl(zone_dochandle_t, char *);
397 399 extern int zonecfg_apply_rctls(char *, zone_dochandle_t);
398 400
399 401 /*
400 402 * Generic attribute configuration and type/value extraction.
401 403 */
402 404 extern int zonecfg_add_attr(zone_dochandle_t, struct zone_attrtab *);
403 405 extern int zonecfg_delete_attr(zone_dochandle_t, struct zone_attrtab *);
404 406 extern int zonecfg_modify_attr(zone_dochandle_t, struct zone_attrtab *,
405 407 struct zone_attrtab *);
406 408 extern int zonecfg_lookup_attr(zone_dochandle_t, struct zone_attrtab *);
407 409 extern int zonecfg_get_attr_boolean(const struct zone_attrtab *,
408 410 boolean_t *);
409 411 extern int zonecfg_get_attr_int(const struct zone_attrtab *, int64_t *);
410 412 extern int zonecfg_get_attr_string(const struct zone_attrtab *, char *,
411 413 size_t);
412 414 extern int zonecfg_get_attr_uint(const struct zone_attrtab *, uint64_t *);
413 415
414 416 /*
415 417 * ZFS configuration.
416 418 */
417 419 extern int zonecfg_add_ds(zone_dochandle_t, struct zone_dstab *);
418 420 extern int zonecfg_delete_ds(zone_dochandle_t, struct zone_dstab *);
419 421 extern int zonecfg_modify_ds(zone_dochandle_t, struct zone_dstab *,
420 422 struct zone_dstab *);
421 423 extern int zonecfg_lookup_ds(zone_dochandle_t, struct zone_dstab *);
422 424
423 425 /*
424 426 * cpu-set configuration.
425 427 */
426 428 extern int zonecfg_add_pset(zone_dochandle_t, struct zone_psettab *);
427 429 extern int zonecfg_delete_pset(zone_dochandle_t);
428 430 extern int zonecfg_modify_pset(zone_dochandle_t, struct zone_psettab *);
429 431 extern int zonecfg_lookup_pset(zone_dochandle_t, struct zone_psettab *);
430 432
431 433 /*
432 434 * mem-cap configuration.
433 435 */
434 436 extern int zonecfg_delete_mcap(zone_dochandle_t);
435 437 extern int zonecfg_modify_mcap(zone_dochandle_t, struct zone_mcaptab *);
436 438 extern int zonecfg_lookup_mcap(zone_dochandle_t, struct zone_mcaptab *);
437 439
438 440 /* security-flags configuration */
439 441 extern int zonecfg_add_secflags(zone_dochandle_t,
440 442 struct zone_secflagstab *);
441 443 extern int zonecfg_delete_secflags(zone_dochandle_t,
442 444 struct zone_secflagstab *);
443 445 extern int zonecfg_modify_secflags(zone_dochandle_t,
444 446 struct zone_secflagstab *, struct zone_secflagstab *);
445 447 extern int zonecfg_lookup_secflags(zone_dochandle_t,
446 448 struct zone_secflagstab *);
447 449
448 450 /*
449 451 * Temporary pool support functions.
450 452 */
451 453 extern int zonecfg_destroy_tmp_pool(char *, char *, int);
452 454 extern int zonecfg_bind_tmp_pool(zone_dochandle_t, zoneid_t, char *, int);
453 455 extern int zonecfg_bind_pool(zone_dochandle_t, zoneid_t, char *, int);
454 456 extern boolean_t zonecfg_warn_poold(zone_dochandle_t);
455 457 extern int zonecfg_get_poolname(zone_dochandle_t, char *, char *, size_t);
456 458
457 459 /*
458 460 * Miscellaneous utility functions.
459 461 */
460 462 extern int zonecfg_enable_rcapd(char *, int);
461 463
462 464 /*
463 465 * attach/detach support.
464 466 */
465 467 extern int zonecfg_get_attach_handle(const char *, const char *,
466 468 const char *, boolean_t, zone_dochandle_t);
467 469 extern int zonecfg_attach_manifest(int, zone_dochandle_t,
468 470 zone_dochandle_t);
469 471 extern int zonecfg_detach_save(zone_dochandle_t, uint_t);
470 472 extern boolean_t zonecfg_detached(const char *);
471 473 extern void zonecfg_rm_detached(zone_dochandle_t, boolean_t forced);
472 474 extern int zonecfg_dev_manifest(zone_dochandle_t);
473 475 extern int zonecfg_devperms_apply(zone_dochandle_t, const char *,
474 476 uid_t, gid_t, mode_t, const char *);
475 477 extern void zonecfg_set_swinv(zone_dochandle_t);
476 478 extern int zonecfg_add_pkg(zone_dochandle_t, char *, char *);
477 479
478 480 /*
479 481 * External zone verification support.
480 482 */
481 483 extern int zonecfg_verify_save(zone_dochandle_t, char *);
482 484
483 485 /*
484 486 * '*ent' iterator routines.
485 487 */
486 488 extern int zonecfg_setfsent(zone_dochandle_t);
487 489 extern int zonecfg_getfsent(zone_dochandle_t, struct zone_fstab *);
488 490 extern int zonecfg_endfsent(zone_dochandle_t);
489 491 extern int zonecfg_setnwifent(zone_dochandle_t);
490 492 extern int zonecfg_getnwifent(zone_dochandle_t, struct zone_nwiftab *);
491 493 extern int zonecfg_endnwifent(zone_dochandle_t);
492 494 extern int zonecfg_setdevent(zone_dochandle_t);
493 495 extern int zonecfg_getdevent(zone_dochandle_t, struct zone_devtab *);
494 496 extern int zonecfg_enddevent(zone_dochandle_t);
495 497 extern int zonecfg_setattrent(zone_dochandle_t);
496 498 extern int zonecfg_getattrent(zone_dochandle_t, struct zone_attrtab *);
497 499 extern int zonecfg_endattrent(zone_dochandle_t);
498 500 extern int zonecfg_setrctlent(zone_dochandle_t);
499 501 extern int zonecfg_getrctlent(zone_dochandle_t, struct zone_rctltab *);
500 502 extern int zonecfg_endrctlent(zone_dochandle_t);
501 503 extern int zonecfg_setdsent(zone_dochandle_t);
502 504 extern int zonecfg_getdsent(zone_dochandle_t, struct zone_dstab *);
503 505 extern int zonecfg_enddsent(zone_dochandle_t);
504 506 extern int zonecfg_getpsetent(zone_dochandle_t, struct zone_psettab *);
505 507 extern int zonecfg_getmcapent(zone_dochandle_t, struct zone_mcaptab *);
506 508 extern int zonecfg_getpkgdata(zone_dochandle_t, uu_avl_pool_t *,
507 509 uu_avl_t *);
508 510 extern int zonecfg_setdevperment(zone_dochandle_t);
509 511 extern int zonecfg_getdevperment(zone_dochandle_t,
510 512 struct zone_devpermtab *);
511 513 extern int zonecfg_enddevperment(zone_dochandle_t);
512 514 extern int zonecfg_setadminent(zone_dochandle_t);
513 515 extern int zonecfg_getadminent(zone_dochandle_t, struct zone_admintab *);
514 516 extern int zonecfg_endadminent(zone_dochandle_t);
515 517 extern int zonecfg_getsecflagsent(zone_dochandle_t,
516 518 struct zone_secflagstab *);
517 519
518 520 /*
519 521 * Privilege-related functions.
520 522 */
↓ open down ↓ |
184 lines elided |
↑ open up ↑ |
521 523 extern int zonecfg_default_privset(priv_set_t *, const char *);
522 524 extern int zonecfg_get_privset(zone_dochandle_t, priv_set_t *,
523 525 char **);
524 526 extern int zonecfg_get_limitpriv(zone_dochandle_t, char **);
525 527 extern int zonecfg_set_limitpriv(zone_dochandle_t, char *);
526 528
527 529 /*
528 530 * Higher-level routines.
529 531 */
530 532 extern int zone_get_brand(char *, char *, size_t);
533 +extern zoneid_t zone_get_did(char *);
531 534 extern int zone_get_rootpath(char *, char *, size_t);
532 535 extern int zone_get_devroot(char *, char *, size_t);
533 536 extern int zone_get_zonepath(char *, char *, size_t);
534 537 extern int zone_get_state(char *, zone_state_t *);
535 538 extern int zone_set_state(char *, zone_state_t);
536 539 extern char *zone_state_str(zone_state_t);
537 540 extern int zonecfg_get_name_by_uuid(const uuid_t, char *, size_t);
538 541 extern int zonecfg_get_uuid(const char *, uuid_t);
539 542 extern int zonecfg_default_brand(char *, size_t);
540 543
541 544 /*
542 545 * Iterator for configured zones.
543 546 */
544 547 extern FILE *setzoneent(void);
545 548 extern char *getzoneent(FILE *);
546 549 extern struct zoneent *getzoneent_private(FILE *);
547 550 extern void endzoneent(FILE *);
548 551
549 552 /*
550 553 * File-system-related convenience functions.
551 554 */
552 555 extern boolean_t zonecfg_valid_fs_type(const char *);
553 556
554 557 /*
555 558 * Network-related convenience functions.
556 559 */
557 560 extern boolean_t zonecfg_same_net_address(char *, char *);
558 561 extern int zonecfg_valid_net_address(char *, struct lifreq *);
559 562 extern boolean_t zonecfg_ifname_exists(sa_family_t, char *);
560 563
561 564 /*
562 565 * Rctl-related common functions.
563 566 */
564 567 extern boolean_t zonecfg_is_rctl(const char *);
565 568 extern boolean_t zonecfg_valid_rctlname(const char *);
566 569 extern boolean_t zonecfg_valid_rctlblk(const rctlblk_t *);
567 570 extern boolean_t zonecfg_valid_rctl(const char *, const rctlblk_t *);
568 571 extern int zonecfg_construct_rctlblk(const struct zone_rctlvaltab *,
569 572 rctlblk_t *);
570 573
571 574 /*
572 575 * Live Upgrade support functions. Shared between ON and install gate.
573 576 */
574 577 extern FILE *zonecfg_open_scratch(const char *, boolean_t);
575 578 extern int zonecfg_lock_scratch(FILE *);
576 579 extern void zonecfg_close_scratch(FILE *);
577 580 extern int zonecfg_get_scratch(FILE *, char *, size_t, char *, size_t, char *,
578 581 size_t);
579 582 extern int zonecfg_find_scratch(FILE *, const char *, const char *, char *,
580 583 size_t);
581 584 extern int zonecfg_reverse_scratch(FILE *, const char *, char *, size_t,
582 585 char *, size_t);
583 586 extern int zonecfg_add_scratch(FILE *, const char *, const char *,
584 587 const char *);
585 588 extern int zonecfg_delete_scratch(FILE *, const char *);
586 589 extern boolean_t zonecfg_is_scratch(const char *);
587 590
588 591 /*
589 592 * zoneadmd support functions. Shared between zoneadm and brand hook code.
590 593 */
591 594 extern void zonecfg_init_lock_file(const char *, char **);
592 595 extern void zonecfg_release_lock_file(const char *, int);
593 596 extern int zonecfg_grab_lock_file(const char *, int *);
594 597 extern boolean_t zonecfg_lock_file_held(int *);
595 598 extern int zonecfg_ping_zoneadmd(const char *);
596 599 extern int zonecfg_call_zoneadmd(const char *, zone_cmd_arg_t *, char *,
597 600 boolean_t);
598 601 extern int zonecfg_insert_userauths(zone_dochandle_t, char *, char *);
599 602 extern int zonecfg_remove_userauths(zone_dochandle_t, char *, char *,
600 603 boolean_t);
601 604 extern int zonecfg_add_admin(zone_dochandle_t, struct zone_admintab *,
602 605 char *);
603 606 extern int zonecfg_delete_admin(zone_dochandle_t,
604 607 struct zone_admintab *, char *);
605 608 extern int zonecfg_modify_admin(zone_dochandle_t, struct zone_admintab *,
606 609 struct zone_admintab *, char *);
607 610 extern int zonecfg_delete_admins(zone_dochandle_t, char *);
608 611 extern int zonecfg_lookup_admin(zone_dochandle_t, struct zone_admintab *);
609 612 extern int zonecfg_authorize_users(zone_dochandle_t, char *);
610 613 extern int zonecfg_update_userauths(zone_dochandle_t, char *);
611 614 extern int zonecfg_deauthorize_user(zone_dochandle_t, char *, char *);
612 615 extern int zonecfg_deauthorize_users(zone_dochandle_t, char *);
613 616 extern boolean_t zonecfg_valid_auths(const char *, const char *);
614 617
615 618 #ifdef __cplusplus
616 619 }
617 620 #endif
618 621
619 622 #endif /* _LIBZONECFG_H */
↓ open down ↓ |
79 lines elided |
↑ open up ↑ |
XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX