diff options
| author | Gary Pennington <gary.pennington@oracle.com> | 2010-06-30 03:42:01 -0700 |
|---|---|---|
| committer | Gary Pennington <gary.pennington@oracle.com> | 2010-06-30 03:42:01 -0700 |
| commit | 6e1ae2a33c618c4c2b14aec7d2f21743ddea5837 (patch) | |
| tree | 405e3f48b48d134efd840895d0608ff449d5fed6 /usr/src/lib/libinstzones | |
| parent | dfbb3a42fe4d6d7c50b9f750f514f8c7b66e4ed9 (diff) | |
| download | illumos-joyent-6e1ae2a33c618c4c2b14aec7d2f21743ddea5837.tar.gz | |
6939693 zones no longer needs the inherit-pkg-dir property
Diffstat (limited to 'usr/src/lib/libinstzones')
| -rw-r--r-- | usr/src/lib/libinstzones/common/instzones_lib.h | 5 | ||||
| -rw-r--r-- | usr/src/lib/libinstzones/common/mapfile-vers | 5 | ||||
| -rw-r--r-- | usr/src/lib/libinstzones/common/zones.c | 68 | ||||
| -rw-r--r-- | usr/src/lib/libinstzones/common/zones_paths.c | 329 | ||||
| -rw-r--r-- | usr/src/lib/libinstzones/common/zones_strings.h | 14 | ||||
| -rw-r--r-- | usr/src/lib/libinstzones/common/zones_utils.c | 82 | ||||
| -rw-r--r-- | usr/src/lib/libinstzones/hdrs/instzones_api.h | 11 |
7 files changed, 6 insertions, 508 deletions
diff --git a/usr/src/lib/libinstzones/common/instzones_lib.h b/usr/src/lib/libinstzones/common/instzones_lib.h index 969a025a7c..a7acdbcf47 100644 --- a/usr/src/lib/libinstzones/common/instzones_lib.h +++ b/usr/src/lib/libinstzones/common/instzones_lib.h @@ -19,8 +19,7 @@ * CDDL HEADER END */ /* - * Copyright 2009 Sun Microsystems, Inc. All rights reserved. - * Use is subject to license terms. + * Copyright (c) 2009, 2010, Oracle and/or its affiliates. All rights reserved. */ @@ -179,7 +178,6 @@ struct _zoneBrandList { typedef unsigned long _zone_status_t; struct _zoneListElement_t { - char **_zlInheritedDirs; char *_zlName; char *_zlPath; char *_zlScratchName; @@ -307,7 +305,6 @@ void _z_echo(char *fmt, ...); /*PRINTFLIKE1*/ void _z_echoDebug(char *a_fmt, ...); int _z_is_directory(char *path); -char **_z_get_inherited_dirs(char *a_zoneName); boolean_t _z_running_in_global_zone(void); boolean_t _z_zones_are_implemented(void); void _z_sig_trap(int a_signo); diff --git a/usr/src/lib/libinstzones/common/mapfile-vers b/usr/src/lib/libinstzones/common/mapfile-vers index c57f4c78eb..164dc673af 100644 --- a/usr/src/lib/libinstzones/common/mapfile-vers +++ b/usr/src/lib/libinstzones/common/mapfile-vers @@ -42,7 +42,6 @@ $mapfile_version 2 SYMBOL_VERSION SUNWprivate { global: UmountAllZones; - z_add_inherited_file_system; z_brands_are_implemented; z_canoninplace; z_createMountTable; @@ -51,9 +50,7 @@ SYMBOL_VERSION SUNWprivate { z_ExecCmdArray; z_ExecCmdList; z_free_brand_list; - z_free_inherited_file_systems; z_free_zone_list; - z_get_inherited_file_systems; z_get_nonglobal_zone_list; z_get_nonglobal_zone_list_by_brand; z_get_zonename; @@ -69,7 +66,6 @@ SYMBOL_VERSION SUNWprivate { z_non_global_zones_exist; z_on_zone_spec; z_path_canonize; - z_path_is_inherited; z_resolve_lofs; z_running_in_global_zone; z_set_output_functions; @@ -81,7 +77,6 @@ SYMBOL_VERSION SUNWprivate { z_verify_zone_spec; z_zlist_change_zone_state; z_zlist_get_current_state; - z_zlist_get_inherited_pkg_dirs; z_zlist_get_original_state; z_zlist_get_scratch; z_zlist_get_zonename; diff --git a/usr/src/lib/libinstzones/common/zones.c b/usr/src/lib/libinstzones/common/zones.c index 2e30c24281..dc3a2036b2 100644 --- a/usr/src/lib/libinstzones/common/zones.c +++ b/usr/src/lib/libinstzones/common/zones.c @@ -20,8 +20,7 @@ */ /* - * Copyright 2009 Sun Microsystems, Inc. All rights reserved. - * Use is subject to license terms. + * Copyright (c) 2009, 2010, Oracle and/or its affiliates. All rights reserved. */ @@ -62,8 +61,6 @@ * z_zlist_change_zone_state - Change the current state of the specified zone * z_zlist_get_current_state - Determine the current kernel state of the * specified zone - * z_zlist_get_inherited_pkg_dirs - Determine directories inherited by - * specified zone * z_zlist_get_original_state - Return the original kernal state of the * specified zone * z_zlist_get_scratch - Determine name of scratch zone @@ -328,18 +325,6 @@ z_free_zone_list(zoneList_t a_zlst) free(zelm->_zlPath); } - /* free list of inherited package directories */ - - if (zelm->_zlInheritedDirs != (char **)NULL) { - int n; - - for (n = 0; - (zelm->_zlInheritedDirs)[n] != (char *)NULL; - n++) { - (void) free((zelm->_zlInheritedDirs)[n]); - } - (void) free(zelm->_zlInheritedDirs); - } } /* free handle to the list */ @@ -565,9 +550,6 @@ z_get_nonglobal_zone_list_by_brand(zoneBrandList_t *brands) zlst[numzones]._zlOrigKernelStatus = st; zlst[numzones]._zlCurrKernelStatus = st; - zlst[numzones]._zlInheritedDirs = - _z_get_inherited_dirs(ze->zone_name); - numzones++; free(ze); } @@ -1786,54 +1768,6 @@ z_zlist_get_current_state(zoneList_t a_zlst, int a_zoneIndex) } /* - * Name: z_zlist_get_inherited_pkg_dirs - * Description: Determine directories inherited by specified zone - * Arguments: a_zlst - handle to zoneList_t object describing all zones - * a_zoneIndex - index into a_zlst of the zone to return the - * inherited directories list - * Returns: char ** - * == NULL - zone does not inherit any directories - * - zone index is invalid - * != NULL - array of inherited directories - * NOTE: Any directory list returned is located in static storage that - * must NEVER be free()ed by the caller. - */ - -extern char ** -z_zlist_get_inherited_pkg_dirs(zoneList_t a_zlst, int a_zoneIndex) -{ - int i; - - /* if zones are not implemented, return empty list */ - - if (z_zones_are_implemented() == B_FALSE) { - return (NULL); - } - - /* ignore empty list */ - - if (a_zlst == (zoneList_t)NULL) { - return (NULL); - } - - /* find the specified zone in the list */ - - for (i = 0; (i != a_zoneIndex) && - (a_zlst[i]._zlName != (char *)NULL); i++) - ; - - /* return error if the specified zone does not exist */ - - if (a_zlst[i]._zlName == (char *)NULL) { - return (NULL); - } - - /* return selected zone's inherited directories */ - - return (a_zlst[i]._zlInheritedDirs); -} - -/* * Name: z_zlist_get_original_state * Description: Return the original kernal state of the specified zone * Arguments: a_zlst - handle to zoneList_t object describing all zones diff --git a/usr/src/lib/libinstzones/common/zones_paths.c b/usr/src/lib/libinstzones/common/zones_paths.c index 23f667fcc4..baa730f808 100644 --- a/usr/src/lib/libinstzones/common/zones_paths.c +++ b/usr/src/lib/libinstzones/common/zones_paths.c @@ -20,8 +20,7 @@ */ /* - * Copyright 2009 Sun Microsystems, Inc. All rights reserved. - * Use is subject to license terms. + * Copyright (c) 2009, 2010, Oracle and/or its affiliates. All rights reserved. */ @@ -57,323 +56,12 @@ (!x[2] || (x[2] == '/'))) /* - * forward declarations - */ - -static char **inheritedFileSystems = (char **)NULL; -static size_t *inheritedFileSystemsLen = (size_t *)NULL; -static int numInheritedFileSystems = 0; - -/* * ***************************************************************************** * global external (public) functions * ***************************************************************************** */ /* - * Name: z_get_inherited_file_systems - * Description: Return list of file systems inherited from the global zone; - * These file systems are entered into the list when the function - * pkgAddInheritedFileSystem() is called. - * Arguments: void - * Returns: char ** - * - pointer to array of character pointers, each pointer - * being a pointer to a string representing a file - * system that is inherited from the global zone - * the last entry will be (char *)NULL - * - (char **)NULL - no file systems inherited - * - */ - -char ** -z_get_inherited_file_systems(void) -{ - return (inheritedFileSystems); -} - -/* - * Name: z_add_inherited_file_system - * Description: Add specified package to internal list of inherited file systems - * Arguments: a_inheritedFileSystem - absolute path to file systen "inherited" - * - * This function is called to register a directory (or - * file system) as being inherited from the global zone - * into the non-global zone being operated on. The - * inherited directory must be specified relative to the - * root file system ("/"). For example, if "/usr" is - * inherited, then the path specified would be "/usr". - * - * Any path subsequently checked for being present in a - * directory inherited read-only from the global zone: - * - * -- will NOT have $PKG_INSTALL_ROOT prepended to it - * -- if $PKG_INSTALL_ROOT is set and $BASEDIR is not set. - * -- WILL have $BASEDIR prepended to it (if set). - * -- $BASEDIR always has $PKG_INSTALL_ROOT included in it. - * -- For example, if $PKG_INSTALL_ROOT is set to /a, and - * -- the base install directory is set to "/opt", then the - * -- $BASEDIR variable will be set to "/a/opt". - * - * Any path that is checked for being present in an inherited - * directory will be specified relative to the root file system - * of the non-global zone in which the path is located. - * - * When a path to update is checked for being present in - * an inherited directory, $PKG_INSTALL_ROOT is stripped - * off the path before it is checked. - * - * If the non-global zone is not running, the scratch zone - * is used to access the non-global zone. In this case, - * $PKG_INSTALL_ROOT will be set to "/a" and both the - * non-global zone's root file system and all inherited - * directories will be mounted on "/a". When a path is checked - * for being inherited, it will have $PKG_INSTALL_ROOT stripped - * from the beginning, so any inherited directories must be - * specified relative to "/" and not $PKG_INSTALL_ROOT. - * - * If the non-global zone is running, the non-global zone - * is used directly. In this case, $PKG_INSTALL_ROOT will - * be set to "/" and both the non-global zone's root file - * system and all inherited directories will be mounted on - * "/". $PKG_INSTALL_ROOT is set to "/" so the path is unchanged - * before being checked against the list of inherited directories. - * - * Returns: boolean_t - * B_TRUE - file system successfully added to list - * B_FALSE - failed to add file system to list - */ - -boolean_t -z_add_inherited_file_system(char *a_inheritedFileSystem) -{ -#define IPSLOP 2 /* for trailing '/' and '\0' */ -#define IPMAX ((sizeof (rp))-IPSLOP) - - char rp[PATH_MAX+1+IPSLOP] = {'\0'}; - int n; - - /* file system cannot be empty */ - - if (a_inheritedFileSystem == NULL || *a_inheritedFileSystem == '\0') { - _z_program_error(ERR_INHERITED_PATH_NULL); - return (B_FALSE); - } - - /* file system must be absolute */ - - if (*a_inheritedFileSystem != '/') { - _z_program_error(ERR_INHERITED_PATH_NOT_ABSOLUTE, - a_inheritedFileSystem); - return (B_FALSE); - } - - /* make a local copy of the path and canonize it */ - - n = strlcpy(rp, a_inheritedFileSystem, IPMAX); - if (n > IPMAX) { - _z_program_error(ERR_INHERITED_PATH_TOO_LONG, - strlen(a_inheritedFileSystem), IPMAX, - a_inheritedFileSystem); - return (B_FALSE); - } - - assert(n > 0); /* path must have at least 1 byte in it */ - - z_path_canonize(rp); /* remove duplicate "/"s, ./, etc */ - - /* add trailing "/" if it's not already there */ - n = strlen(rp); - if (rp[n-1] != '/') { - rp[n++] = '/'; - } - - /* null terminate the string */ - - rp[n] = '\0'; - - /* add file system to internal list */ - - if (inheritedFileSystems == (char **)NULL) { - inheritedFileSystems = (char **)_z_calloc( - 2 * (sizeof (char **))); - inheritedFileSystemsLen = - (size_t *)_z_calloc(2 * (sizeof (size_t *))); - } else { - inheritedFileSystems = (char **)_z_realloc(inheritedFileSystems, - sizeof (char **)*(numInheritedFileSystems+2)); - inheritedFileSystemsLen = (size_t *)_z_realloc( - inheritedFileSystemsLen, - sizeof (size_t *)*(numInheritedFileSystems+2)); - } - - /* add this entry to the end of the list */ - - inheritedFileSystemsLen[numInheritedFileSystems] = strlen(rp); - inheritedFileSystems[numInheritedFileSystems] = _z_strdup(rp); - - numInheritedFileSystems++; - - /* make sure end of the list is properly terminated */ - - inheritedFileSystemsLen[numInheritedFileSystems] = 0; - inheritedFileSystems[numInheritedFileSystems] = (char *)NULL; - - /* exit debugging info */ - - _z_echoDebug(DBG_PATHS_ADD_FS, numInheritedFileSystems, - inheritedFileSystems[numInheritedFileSystems-1]); - - return (B_TRUE); -} - -/* - * Name: z_path_is_inherited - * Description: Determine if the specified path is in a file system that is - * in the internal list of inherited file systems - * Arguments: a_path - pointer to string representing path to verify - * a_ftype - file "type" if known otherwise '\0' - * Type can be "f" (file), or "d" (directory) - * a_rootDir - pointer to string representing root directory where - * a_path is relative to - typically this would either be - * "/" or the path specified as an alternative root to -R - * Returns: boolean_t - * B_TRUE - the path is in inherited file system space - * B_FALSE - the path is NOT in inherited file system space - */ - -boolean_t -z_path_is_inherited(char *a_path, char a_ftype, char *a_rootDir) -{ - int n; - char *cp, *path2use; - char real_path[PATH_MAX]; - char path_copy[PATH_MAX]; - boolean_t found = B_FALSE; - - /* entry assertions */ - - assert(a_path != (char *)NULL); - assert(*a_path != '\0'); - - /* if no inherited file systems, there can be no match */ - - if (numInheritedFileSystems == 0) { - _z_echoDebug(DBG_PATHS_NOT_INHERITED, a_path); - return (B_FALSE); - } - - /* normalize root directory */ - - if ((a_rootDir == (char *)NULL) || (*a_rootDir == '\0')) { - a_rootDir = "/"; - } - - /* - * The loop below represents our best effort to identify real path of - * a file, which doesn't need to exist. realpath() returns error for - * nonexistent path, therefore we need to cut off trailing components - * of path until we get path which exists and can be resolved by - * realpath(). Lookup of "/dir/symlink/nonexistent-file" would fail - * to resolve symlink without this. - */ - (void) strlcpy(path_copy, a_path, PATH_MAX); - for (cp = dirname(path_copy); strlen(cp) > 1; cp = dirname(cp)) { - if (realpath(cp, real_path) != NULL) { - found = B_TRUE; - break; - } else if (errno != ENOENT) - break; - } - if (found) { - /* - * In the loop above we always strip trailing path component, - * so the type of real_path is always 'd'. - */ - a_ftype = 'd'; - path2use = real_path; - } else { - path2use = a_path; - } - - /* - * if path resides on an inherited filesystem then - * it must be read-only. - */ - - if (z_isPathWritable(path2use) != 0) { - return (B_FALSE); - } - - /* - * remove the root path from the target path before comparing: - * Example 1: - * -- path is "/export/zone1/root/usr/test" - * -- root path is "/export/zone1/root" - * --- final path should be "/usr/test" - * Example 2: - * -- path is "/usr/test" - * -- root path is "/" - * --- final path should be "/usr/test" - */ - - /* advance past given root directory if path begins with it */ - - n = strlen(a_rootDir); - if (strncmp(a_rootDir, path2use, n) == 0) { - char *p; - - /* advance past the root path */ - - p = path2use + n; - - /* go back to the first occurance of the path separator */ - - while ((*p != '/') && (p > path2use)) { - p--; - } - - /* use this location in the path to compare */ - - path2use = p; - } - - /* - * see if this path is in any inherited file system path - * note that all paths in the inherited list are directories - * so they end in "/" to prevent a partial match, such as - * comparing "/usr/libx" with "/usr/lib" - by making the comparison - * "/usr/libx" with "/usr/lib/" the partial false positive will not - * occur. This complicates matters when the object to compare is a - * directory - in this case, comparing "/usr" with "/usr/" will fail, - * so if the object is a directory, compare one less byte from the - * inherited file system so that the trailing "/" is ignored. - */ - - for (n = 0; n < numInheritedFileSystems; n++) { - int fslen; - - /* get target fs len; adjust -1 if directory */ - - fslen = inheritedFileSystemsLen[n]; - if ((a_ftype == 'd') && (fslen > 1)) { - fslen--; - } - - if (strncmp(path2use, inheritedFileSystems[n], fslen) == 0) { - _z_echoDebug(DBG_PATHS_IS_INHERITED, a_path, - inheritedFileSystems[n]); - return (B_TRUE); - } - } - - /* path is not in inherited file system space */ - - _z_echoDebug(DBG_PATHS_IS_NOT_INHERITED, a_path, a_rootDir); - - return (B_FALSE); -} - -/* * Name: z_make_zone_root * Description: Given its zonepath, generate a string representing the * mountpoint of where the root path for a nonglobal zone is @@ -480,18 +168,3 @@ z_canoninplace(char *src) dst--; *dst = '\0'; } - -void -z_free_inherited_file_systems(void) -{ - int i; - - for (i = 0; i < numInheritedFileSystems; i++) { - free(inheritedFileSystems[i]); - } - free(inheritedFileSystems); - inheritedFileSystems = NULL; - free(inheritedFileSystemsLen); - inheritedFileSystemsLen = NULL; - numInheritedFileSystems = 0; -} diff --git a/usr/src/lib/libinstzones/common/zones_strings.h b/usr/src/lib/libinstzones/common/zones_strings.h index 8c22e1c370..61d928d75b 100644 --- a/usr/src/lib/libinstzones/common/zones_strings.h +++ b/usr/src/lib/libinstzones/common/zones_strings.h @@ -19,8 +19,7 @@ * CDDL HEADER END */ /* - * Copyright 2007 Sun Microsystems, Inc. All rights reserved. - * Use is subject to license terms. + * Copyright (c) 2009, 2010, Oracle and/or its affiliates. All rights reserved. */ @@ -71,10 +70,6 @@ extern "C" { #define DBG_ARG ILIBSTR("argument <%d> = <%s>") #define DBG_LIBRARY_NOT_FOUND ILIBSTR("unable to dlopen library <%s>: %s") #define DBG_MNTPT_NAMES ILIBSTR("mount point for global zone path <%s> in zone <%s> is global zone mount point <%s> non-global zone mount point <%s>") -#define DBG_PATHS_ADD_FS ILIBSTR("add inherited file system entry <%d> path <%s>") -#define DBG_PATHS_IS_INHERITED ILIBSTR("path <%s> is inherited from <%s>") -#define DBG_PATHS_IS_NOT_INHERITED ILIBSTR("path <%s> in root <%s> not inherited") -#define DBG_PATHS_NOT_INHERITED ILIBSTR("path <%s> not inherited: no inherited file systems") #define DBG_TO_ZONEHALT ILIBSTR("halting zone <%s>") #define DBG_TO_ZONEREADY ILIBSTR("readying zone <%s>") #define DBG_TO_ZONERUNNING ILIBSTR("running zone <%s>") @@ -143,9 +138,6 @@ extern "C" { #define ERR_GZPATH_NOT_ABSOLUTE ILIBSTR("unable to mount global zone path <%s>: path must be absolute") #define ERR_GZPATH_NOT_DIR ILIBSTR("unable to mount global zone path <%s>: %s") #define ERR_GZUMOUNT_FAILED ILIBSTR("unable to unmount <%s>: %s") -#define ERR_INHERITED_PATH_NOT_ABSOLUTE ILIBSTR("inherited file system must be absolute path: <%s>") -#define ERR_INHERITED_PATH_NOT_DIR ILIBSTR("inherited file system <%s> must be absolute path to directory: %s") -#define ERR_INHERITED_PATH_NULL ILIBSTR("empty path specified for inherited file system: must be absolute path") #define ERR_LZMNTPT_NOTDIR ILIBSTR("unable to unmount global zone mount point <%s>: %s") #define ERR_LZMNTPT_NOT_ABSOLUTE ILIBSTR("unable to unmount <%s>: path must be absolute") #define ERR_LZROOT_NOTDIR ILIBSTR("unable to use <%s> as zone root path: %s") @@ -154,9 +146,6 @@ extern "C" { #define ERR_MEMORY ILIBSTR("memory allocation failure, errno=%d") #define ERR_MNTPT_MKDIR ILIBSTR("unable to create temporary mount point <%s> in zone <%s>: %s") #define ERR_NO_ZONE_ROOTPATH ILIBSTR("unable to get root path of zone <%s>: %s") -#define ERR_PKGDIR_GETHANDLE ILIBSTR("unable to get inherited directories: zonecfg_get_handle: %s") -#define ERR_PKGDIR_NOHANDLE ILIBSTR("unable to get inherited directories: zonecfg_init_handle: %s") -#define ERR_PKGDIR_SETIPDENT ILIBSTR("unable to get inherited directories: zonecfg_setipdent: %s") #define ERR_ROOTPATH_EMPTY ILIBSTR("unable to get root path of zone <%s>: empty path returned") #define ERR_ZEXEC_ASSEMBLE ILIBSTR("unable to establish connection with zone <%s>: could not assemble new environment") #define ERR_ZEXEC_BADSTATE ILIBSTR("unable to establish connection with zone <%s>: zone is in state '%s'") @@ -196,7 +185,6 @@ extern "C" { #define ERR_ZONE_LIST_EMPTY ILIBSTR("empty zone list specified") #define ERR_ZONE_NAME_ILLEGAL ILIBSTR("illegal zone name %.*s") #define ERR_ZONE_NONEXISTENT ILIBSTR("zone %s does not exist") -#define ERR_INHERITED_PATH_TOO_LONG ILIBSTR("inherited path too long current length <%d> maximum length <%d> bytes: <%s>") #define ERR_OPEN_READ ILIBSTR("unable to open <%s> for reading: (%d) %s") #define ERR_ZONEUNMOUNT_CMD_SIGNAL ILIBSTR("unable to unmount zone: problem running <%s> on zone <%s>: terminated by signal") #define ERR_ZONEUNMOUNT_EXEC ILIBSTR("unable to unmount zone: could not execute zone administration command <%s>: %s") diff --git a/usr/src/lib/libinstzones/common/zones_utils.c b/usr/src/lib/libinstzones/common/zones_utils.c index cd0edec9c4..3b51d145d1 100644 --- a/usr/src/lib/libinstzones/common/zones_utils.c +++ b/usr/src/lib/libinstzones/common/zones_utils.c @@ -19,8 +19,7 @@ * CDDL HEADER END */ /* - * Copyright 2009 Sun Microsystems, Inc. All rights reserved. - * Use is subject to license terms. + * Copyright (c) 2009, 2010, Oracle and/or its affiliates. All rights reserved. */ @@ -36,8 +35,6 @@ * list "a_fds" * _z_echo - Output an interactive message if interaction is enabled * _z_echoDebug - Output a debugging message if debugging is enabled - * _z_get_inherited_dirs - return array of directories inherited by - * specified zone * _z_is_directory - determine if specified path exists and is a directory * _z_program_error - Output an error message to the appropriate destinations * _z_pluginCatchSigint - SIGINT/SIGHUP interrupt handler @@ -277,83 +274,6 @@ _z_echoDebug(char *a_format, ...) } /* - * Name: _z_get_inherited_dirs - * Description: return array of directories inherited by specified zone - * Arguments: a_zoneName - [RO, *RO] - (char *) - * Pointer to string representing the name of the zone - * to return the list of inherited directories for - * Returns: char ** - * != NULL - list of inherited directories, terminated - * by a NULL pointer - * == NULL - error - unable to retrieve list - */ - -char ** -_z_get_inherited_dirs(char *a_zoneName) -{ - char **dirs = NULL; - int err; - int numIpdents = 0; - struct zone_fstab lookup; - zone_dochandle_t handle = NULL; - - /* entry assertions */ - - assert(a_zoneName != NULL); - assert(*a_zoneName != '\0'); - - /* initialize the zone configuration interface handle */ - - handle = zonecfg_init_handle(); - if (handle == NULL) { - _z_program_error(ERR_PKGDIR_NOHANDLE, - zonecfg_strerror(Z_NOMEM)); - return (NULL); - } - - /* get handle to configuration information for the specified zone */ - - err = zonecfg_get_handle(a_zoneName, handle); - if (err != Z_OK) { - /* If there was no zone before, that's OK */ - if (err != Z_NO_ZONE) { - _z_program_error(ERR_PKGDIR_GETHANDLE, - zonecfg_strerror(err)); - zonecfg_fini_handle(handle); - return (NULL); - } - } - assert(handle != NULL); - - /* get handle to non-global zone ipd enumerator */ - - err = zonecfg_setipdent(handle); - if (err != Z_OK) { - _z_program_error(ERR_PKGDIR_SETIPDENT, zonecfg_strerror(err)); - zonecfg_fini_handle(handle); - return (NULL); - } - - /* enumerate the non-global zone ipd's */ - - while (zonecfg_getipdent(handle, &lookup) == Z_OK) { - dirs = _z_realloc(dirs, sizeof (char **)*(numIpdents+1)); - dirs[numIpdents++] = strdup(lookup.zone_fs_dir); - } - - if (dirs != NULL) { - dirs = _z_realloc(dirs, sizeof (char **)*(numIpdents+1)); - dirs[numIpdents] = NULL; - } - - /* toss non-global zone ipd enumerator handle */ - - (void) zonecfg_endipdent(handle); - - return (dirs); -} - -/* * Name: _z_is_directory * Description: determine if specified path exists and is a directory * Arguments: path - pointer to string representing the path to verify diff --git a/usr/src/lib/libinstzones/hdrs/instzones_api.h b/usr/src/lib/libinstzones/hdrs/instzones_api.h index 5fea8c0ce6..7ff3a649e4 100644 --- a/usr/src/lib/libinstzones/hdrs/instzones_api.h +++ b/usr/src/lib/libinstzones/hdrs/instzones_api.h @@ -20,8 +20,7 @@ */ /* - * Copyright 2008 Sun Microsystems, Inc. All rights reserved. - * Use is subject to license terms. + * Copyright (c) 2009, 2010, Oracle and/or its affiliates. All rights reserved. */ #ifndef _INSTZONES_API_H @@ -102,8 +101,6 @@ extern boolean_t z_zlist_change_zone_state(zoneList_t a_zoneList, extern char *z_get_zonename(void); extern zone_state_t z_zlist_get_current_state(zoneList_t a_zoneList, int a_zoneIndex); -extern char **z_zlist_get_inherited_pkg_dirs(zoneList_t a_zoneList, - int a_zoneIndex); extern zone_state_t z_zlist_get_original_state(zoneList_t a_zoneList, int a_zoneIndex); extern int z_zoneExecCmdArray(int *r_status, char **r_results, @@ -157,15 +154,9 @@ extern int z_ExecCmdList(int *r_status, char **r_results, char *a_inputFile, char *a_cmd, ...); /* zones_paths.c */ -extern boolean_t z_add_inherited_file_system( - char *a_inheritedFileSystem); -extern boolean_t z_path_is_inherited(char *a_path, char a_ftype, - char *a_rootDir); -extern char ** z_get_inherited_file_systems(void); extern char *z_make_zone_root(char *); extern void z_path_canonize(char *file); extern void z_canoninplace(char *file); -extern void z_free_inherited_file_systems(void); /* zones_lofs.c */ extern void z_destroyMountTable(void); |
