122fb2eebSMoriah Waterland /* 222fb2eebSMoriah Waterland * CDDL HEADER START 322fb2eebSMoriah Waterland * 422fb2eebSMoriah Waterland * The contents of this file are subject to the terms of the 522fb2eebSMoriah Waterland * Common Development and Distribution License (the "License"). 622fb2eebSMoriah Waterland * You may not use this file except in compliance with the License. 722fb2eebSMoriah Waterland * 822fb2eebSMoriah Waterland * You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE 922fb2eebSMoriah Waterland * or http://www.opensolaris.org/os/licensing. 1022fb2eebSMoriah Waterland * See the License for the specific language governing permissions 1122fb2eebSMoriah Waterland * and limitations under the License. 1222fb2eebSMoriah Waterland * 1322fb2eebSMoriah Waterland * When distributing Covered Code, include this CDDL HEADER in each 1422fb2eebSMoriah Waterland * file and include the License file at usr/src/OPENSOLARIS.LICENSE. 1522fb2eebSMoriah Waterland * If applicable, add the following below this CDDL HEADER, with the 1622fb2eebSMoriah Waterland * fields enclosed by brackets "[]" replaced with your own identifying 1722fb2eebSMoriah Waterland * information: Portions Copyright [yyyy] [name of copyright owner] 1822fb2eebSMoriah Waterland * 1922fb2eebSMoriah Waterland * CDDL HEADER END 2022fb2eebSMoriah Waterland */ 2122fb2eebSMoriah Waterland 2222fb2eebSMoriah Waterland /* 23*6e1ae2a3SGary Pennington * Copyright (c) 2009, 2010, Oracle and/or its affiliates. All rights reserved. 2422fb2eebSMoriah Waterland */ 2522fb2eebSMoriah Waterland 2622fb2eebSMoriah Waterland #ifndef _INSTZONES_API_H 2722fb2eebSMoriah Waterland #define _INSTZONES_API_H 2822fb2eebSMoriah Waterland 2922fb2eebSMoriah Waterland 3022fb2eebSMoriah Waterland /* 3122fb2eebSMoriah Waterland * Module: instzones_api.h 3222fb2eebSMoriah Waterland * Group: libinstzones 3322fb2eebSMoriah Waterland * Description: This module contains the libinstzones API data structures, 3422fb2eebSMoriah Waterland * constants, and function prototypes. 3522fb2eebSMoriah Waterland */ 3622fb2eebSMoriah Waterland 3722fb2eebSMoriah Waterland /* 3822fb2eebSMoriah Waterland * required includes 3922fb2eebSMoriah Waterland */ 4022fb2eebSMoriah Waterland 4122fb2eebSMoriah Waterland /* System includes */ 4222fb2eebSMoriah Waterland 4322fb2eebSMoriah Waterland #include <stdarg.h> 4422fb2eebSMoriah Waterland #include <stdio.h> 4522fb2eebSMoriah Waterland #include <string.h> 4622fb2eebSMoriah Waterland #include <termios.h> 4722fb2eebSMoriah Waterland #include <sys/mman.h> 4822fb2eebSMoriah Waterland #include <sys/param.h> 4922fb2eebSMoriah Waterland #include <sys/types.h> 5022fb2eebSMoriah Waterland #include <sys/ioctl.h> 5122fb2eebSMoriah Waterland #include <libzonecfg.h> 5222fb2eebSMoriah Waterland 5322fb2eebSMoriah Waterland /* 5422fb2eebSMoriah Waterland * C++ prefix 5522fb2eebSMoriah Waterland */ 5622fb2eebSMoriah Waterland 5722fb2eebSMoriah Waterland #ifdef __cplusplus 5822fb2eebSMoriah Waterland extern "C" { 5922fb2eebSMoriah Waterland #endif 6022fb2eebSMoriah Waterland 6122fb2eebSMoriah Waterland 6222fb2eebSMoriah Waterland /* function prototypes */ 6322fb2eebSMoriah Waterland 6422fb2eebSMoriah Waterland /* PRINTFLIKE1 */ 6522fb2eebSMoriah Waterland typedef void (*_z_printf_fcn_t)(char *a_format, ...); 6622fb2eebSMoriah Waterland 6722fb2eebSMoriah Waterland /* zone list structure */ 6822fb2eebSMoriah Waterland 6922fb2eebSMoriah Waterland typedef struct _zoneListElement_t *zoneList_t; 7022fb2eebSMoriah Waterland 7122fb2eebSMoriah Waterland /* zone brand list structure */ 7222fb2eebSMoriah Waterland 7322fb2eebSMoriah Waterland typedef struct _zoneBrandList zoneBrandList_t; 7422fb2eebSMoriah Waterland 7522fb2eebSMoriah Waterland /* flag for zone locking functions */ 7622fb2eebSMoriah Waterland 7722fb2eebSMoriah Waterland typedef unsigned long ZLOCKS_T; 7822fb2eebSMoriah Waterland 7922fb2eebSMoriah Waterland /* flags for zone locking */ 8022fb2eebSMoriah Waterland 8122fb2eebSMoriah Waterland #define ZLOCKS_ZONE_ADMIN ((ZLOCKS_T)0x00000001) /* zone admin */ 8222fb2eebSMoriah Waterland #define ZLOCKS_PKG_ADMIN ((ZLOCKS_T)0x00000002) /* package admin */ 8322fb2eebSMoriah Waterland #define ZLOCKS_ALL ((ZLOCKS_T)0xFFFFFFFF) /* all locks */ 8422fb2eebSMoriah Waterland #define ZLOCKS_NONE ((ZLOCKS_T)0x00000000) /* no locks */ 8522fb2eebSMoriah Waterland 8622fb2eebSMoriah Waterland /* 8722fb2eebSMoriah Waterland * external function definitions 8822fb2eebSMoriah Waterland */ 8922fb2eebSMoriah Waterland 9022fb2eebSMoriah Waterland /* zones.c */ 9122fb2eebSMoriah Waterland 9222fb2eebSMoriah Waterland extern boolean_t z_zones_are_implemented(void); 9322fb2eebSMoriah Waterland extern void z_set_zone_root(const char *zroot); 9422fb2eebSMoriah Waterland extern boolean_t z_zlist_is_zone_runnable(zoneList_t a_zoneList, 9522fb2eebSMoriah Waterland int a_zoneIndex); 9622fb2eebSMoriah Waterland extern boolean_t z_zlist_restore_zone_state(zoneList_t a_zoneList, 9722fb2eebSMoriah Waterland int a_zoneIndex); 9822fb2eebSMoriah Waterland extern boolean_t z_zlist_change_zone_state(zoneList_t a_zoneList, 9922fb2eebSMoriah Waterland int a_zoneIndex, zone_state_t a_newState); 10022fb2eebSMoriah Waterland extern char *z_get_zonename(void); 10122fb2eebSMoriah Waterland extern zone_state_t z_zlist_get_current_state(zoneList_t a_zoneList, 10222fb2eebSMoriah Waterland int a_zoneIndex); 10322fb2eebSMoriah Waterland extern zone_state_t z_zlist_get_original_state(zoneList_t a_zoneList, 10422fb2eebSMoriah Waterland int a_zoneIndex); 10522fb2eebSMoriah Waterland extern int z_zoneExecCmdArray(int *r_status, char **r_results, 10622fb2eebSMoriah Waterland char *a_inputFile, char *a_path, char *a_argv[], 10722fb2eebSMoriah Waterland const char *a_zoneName, int *a_fds); 10822fb2eebSMoriah Waterland extern int z_zone_exec(const char *zonename, const char *path, 10922fb2eebSMoriah Waterland char *argv[], char *a_stdoutPath, 11022fb2eebSMoriah Waterland char *a_stderrPath, int *a_fds); 11122fb2eebSMoriah Waterland extern boolean_t z_create_zone_admin_file(char *a_zoneAdminFilename, 11222fb2eebSMoriah Waterland char *a_userAdminFilename); 11322fb2eebSMoriah Waterland extern void z_free_zone_list(zoneList_t a_zoneList); 11422fb2eebSMoriah Waterland extern zoneList_t z_get_nonglobal_zone_list(void); 11522fb2eebSMoriah Waterland extern zoneList_t z_get_nonglobal_zone_list_by_brand(zoneBrandList_t *); 11622fb2eebSMoriah Waterland extern void z_free_brand_list(zoneBrandList_t *a_brandList); 11722fb2eebSMoriah Waterland extern zoneBrandList_t *z_make_brand_list(const char *brandList, 11822fb2eebSMoriah Waterland const char *delim); 11922fb2eebSMoriah Waterland extern boolean_t z_lock_zones(zoneList_t a_zlst, ZLOCKS_T a_lflags); 12022fb2eebSMoriah Waterland extern boolean_t z_non_global_zones_exist(void); 12122fb2eebSMoriah Waterland extern boolean_t z_running_in_global_zone(void); 12222fb2eebSMoriah Waterland extern void z_set_output_functions(_z_printf_fcn_t a_echo_fcn, 12322fb2eebSMoriah Waterland _z_printf_fcn_t a_echo_debug_fcn, 12422fb2eebSMoriah Waterland _z_printf_fcn_t a_progerr_fcn); 12522fb2eebSMoriah Waterland extern int z_set_zone_spec(const char *zlist); 12622fb2eebSMoriah Waterland extern int z_verify_zone_spec(void); 12722fb2eebSMoriah Waterland extern boolean_t z_on_zone_spec(const char *zonename); 12822fb2eebSMoriah Waterland extern boolean_t z_global_only(void); 12922fb2eebSMoriah Waterland extern boolean_t z_unlock_zones(zoneList_t a_zlst, ZLOCKS_T a_lflags); 13022fb2eebSMoriah Waterland extern boolean_t z_lock_this_zone(ZLOCKS_T a_lflags); 13122fb2eebSMoriah Waterland extern boolean_t z_unlock_this_zone(ZLOCKS_T a_lflags); 13222fb2eebSMoriah Waterland extern char *z_zlist_get_zonename(zoneList_t a_zoneList, 13322fb2eebSMoriah Waterland int a_zoneId); 13422fb2eebSMoriah Waterland extern char *z_zlist_get_zonepath(zoneList_t a_zoneList, 13522fb2eebSMoriah Waterland int a_zoneId); 13622fb2eebSMoriah Waterland extern char *z_zlist_get_scratch(zoneList_t a_zoneList, 13722fb2eebSMoriah Waterland int a_zoneId); 13822fb2eebSMoriah Waterland extern boolean_t z_umount_lz_mount(char *a_lzMountPoint); 13922fb2eebSMoriah Waterland extern boolean_t z_mount_in_lz(char **r_lzMountPoint, 14022fb2eebSMoriah Waterland char **r_lzRootPath, 14122fb2eebSMoriah Waterland char *a_zoneName, char *a_gzPath, 14222fb2eebSMoriah Waterland char *a_mountPointPrefix); 14322fb2eebSMoriah Waterland extern boolean_t z_is_zone_branded(char *zoneName); 14422fb2eebSMoriah Waterland extern boolean_t z_is_zone_brand_in_list(char *zoneName, 14522fb2eebSMoriah Waterland zoneBrandList_t *brands); 14622fb2eebSMoriah Waterland extern boolean_t z_zones_are_implemented(void); 14722fb2eebSMoriah Waterland 14822fb2eebSMoriah Waterland /* zones_exec.c */ 14922fb2eebSMoriah Waterland extern int z_ExecCmdArray(int *r_status, char **r_results, 15022fb2eebSMoriah Waterland char *a_inputFile, char *a_cmd, char **a_args); 15122fb2eebSMoriah Waterland /*VARARGS*/ 15222fb2eebSMoriah Waterland extern int z_ExecCmdList(int *r_status, char **r_results, 15322fb2eebSMoriah Waterland char *a_inputFile, char *a_cmd, ...); 15422fb2eebSMoriah Waterland 15522fb2eebSMoriah Waterland /* zones_paths.c */ 15622fb2eebSMoriah Waterland extern char *z_make_zone_root(char *); 15722fb2eebSMoriah Waterland extern void z_path_canonize(char *file); 15822fb2eebSMoriah Waterland extern void z_canoninplace(char *file); 15922fb2eebSMoriah Waterland 16022fb2eebSMoriah Waterland /* zones_lofs.c */ 16122fb2eebSMoriah Waterland extern void z_destroyMountTable(void); 16222fb2eebSMoriah Waterland extern int z_createMountTable(void); 16322fb2eebSMoriah Waterland extern int z_isPathWritable(const char *); 16422fb2eebSMoriah Waterland extern void z_resolve_lofs(char *path, size_t); 16522fb2eebSMoriah Waterland 16622fb2eebSMoriah Waterland /* zones_states.c */ 16722fb2eebSMoriah Waterland extern int UmountAllZones(char *mntpnt); 16822fb2eebSMoriah Waterland 16922fb2eebSMoriah Waterland /* 17022fb2eebSMoriah Waterland * C++ postfix 17122fb2eebSMoriah Waterland */ 17222fb2eebSMoriah Waterland 17322fb2eebSMoriah Waterland #ifdef __cplusplus 17422fb2eebSMoriah Waterland } 17522fb2eebSMoriah Waterland #endif 17622fb2eebSMoriah Waterland 17722fb2eebSMoriah Waterland #endif /* _INSTZONES_API_H */ 178