# HG changeset patch # User Gary Pennington # Date 1277894521 25200 # Node ID 76969fc28795fc1e70abf03a622d89a68e49cd5d # Parent bcfc9c7baa2ec5d22980861fb7addb1215cf9ac7 6939693 zones no longer needs the inherit-pkg-dir property diff -r bcfc9c7baa2e -r 76969fc28795 usr/src/cmd/svr4pkg/hdrs/libinst.h --- a/usr/src/cmd/svr4pkg/hdrs/libinst.h Wed Jun 30 17:40:22 2010 +0800 +++ b/usr/src/cmd/svr4pkg/hdrs/libinst.h Wed Jun 30 03:42:01 2010 -0700 @@ -20,8 +20,7 @@ */ /* - * Copyright 2009 Sun Microsystems, Inc. All rights reserved. - * Use is subject to license terms. + * Copyright (c) 1993, 2010, Oracle and/or its affiliates. All rights reserved. */ #ifndef __HDRS_LIBINST_H__ @@ -414,9 +413,6 @@ char *r_pkgInst, int r_pkgInstLen, char *a_rootPath, char *a_pkgInst); extern boolean_t pkgPackageIsThisZone(char *a_pkgInst); -extern boolean_t pkgMatchInherited(char *a_src, char *a_dst, - char *a_rootDir, char a_mode, time_t a_modtime, - char a_ftype, unsigned long a_cksum); extern char *pkgGetGzOnlyPath(void); extern boolean_t pkgTestInstalled(char *a_packageName, char *a_rootPath); @@ -509,7 +505,6 @@ #define TAG_COND_CURRENT_ZONE "currentZone" #define TAG_COND_ZONE_NAME "zoneName" #define TAG_COND_ZONE_TYPE "zoneType" -#define TAG_COND_INHERITED_FS "inheritedFileSystem" #define TAG_COND_FS_NAME "fileSystemName" #define TAG_VALUE_GLOBAL_ZONE "global" #define TAG_VALUE_NONGLOBAL_ZONE "nonglobal" diff -r bcfc9c7baa2e -r 76969fc28795 usr/src/cmd/svr4pkg/hdrs/messages.h --- a/usr/src/cmd/svr4pkg/hdrs/messages.h Wed Jun 30 17:40:22 2010 +0800 +++ b/usr/src/cmd/svr4pkg/hdrs/messages.h Wed Jun 30 03:42:01 2010 -0700 @@ -20,8 +20,7 @@ */ /* - * Copyright 2007 Sun Microsystems, Inc. All rights reserved. - * Use is subject to license terms. + * Copyright (c) 2004, 2010, Oracle and/or its affiliates. All rights reserved. */ #ifndef _MESSAGES_H @@ -127,12 +126,10 @@ #define DBG_INSTALL_SKIP_THISZONE gettext("skipping installation of package <%s>: marked this zone only") #define DBG_INSTINONEZONE_ARGS gettext("zone <%s> ids <%s> admin <%s> tempdir <%s> altbindir <%s>") #define DBG_INSTINONEZONE_ENTRY gettext("install_in_one_zone:") -#define DBG_INSTVOL_CAS_INFO gettext("is partial <%d> updated <%s> skipped <%s> local <%s>\n") +#define DBG_INSTVOL_CAS_INFO gettext("is partial <%d> updated <%s>\n") #define DBG_INSTVOL_NOT_RUNNING_CAS gettext("not running zone <%s> object <%s> class <%s> action script <%s>") #define DBG_INSTVOL_OBJ_LOCAL gettext("objects local <%s>") -#define DBG_INSTVOL_OBJ_SKIPPED gettext("objects skipped <%s>") #define DBG_INSTVOL_OBJ_UPDATED gettext("objects updated <%s>") -#define DBG_INSTVOL_PARTIAL_INST gettext("partial install check: pkgMatchInherited(srcp <%s>, dstp <%s>, get_inst_root() <%s>, ept->ainfo.mode <0%04lo>, ept->cinfo.modtime <%lx>, ept->ftype <%c>, ept->cinfo.cksum <%lx>) = %d") #define DBG_INSTVOL_RUNNING_CAS gettext("running zone <%s> object <%s> class <%s> action script <%s>") #define DBG_IN_GZ_NO_LZ gettext("running in global zone with NO non-global zones") #define DBG_IN_GZ_WITH_LZ gettext("running in global zone with non-global zones") @@ -187,14 +184,14 @@ #define DBG_PKGINSTALL_EXEPOC_GZ gettext("executing preinstall package <%s> script <%s>") #define DBG_PKGINSTALL_EXEPOC_LZ gettext("executing preinstall package <%s> script <%s> zone <%s>") #define DBG_PKGINSTALL_HAS_LOCKFILE gettext("before removing package <%s> found existing lockfile <%s> zone <%s>") -#define DBG_PKGINSTALL_INSDONE gettext("install completed: hollow support <%d> is hollow <%d> fresh install <%d> updated <%s> skipped <%s> script <%s> access <%d>") +#define DBG_PKGINSTALL_INSDONE gettext("install completed: hollow support <%d> is hollow <%d> fresh install <%d> updated <%s> script <%s> access <%d>") #define DBG_PKGINSTALL_POCALT_NONE gettext("no pkgbin preinstall package <%s> script <%s> zone <%s>") #define DBG_PKGINSTALL_POC_DBUPD gettext("skipping preinstall package <%s> script <%s> zone <%s> (db update only)") #define DBG_PKGINSTALL_POC_NONE gettext("has no media preinstall package <%s> script <%s> zone <%s>") #define DBG_PKGINSTALL_POIS_DBUPD gettext("skipping postinstall package <%s> script <%s> zone <%s> (db update only)") #define DBG_PKGINSTALL_POIS_NONE gettext("no postinstall in package <%s> script <%s> zone <%s>") #define DBG_PKGINSTALL_POIS_NOPATH gettext("no postinstall in package <%s> zone <%s>") -#define DBG_PKGINSTALL_POIS_SKIPPING gettext("all objects skipped when installing in zone <%s>: skipping postinstall package <%s> script <%s>") +#define DBG_PKGINSTALL_POIS_NOUPDATING gettext("no objects updated when installing in zone <%s>: skipping postinstall package <%s> script <%s>") #define DBG_PKGINSTALL_PREINSCHK gettext("preinstallation check of package <%s> zone <%s>") #define DBG_PKGINSTALL_PREINSCHK_OK gettext("preinstall check successful") #define DBG_PKGINSTALL_RSCRIPT_IS_ROOT gettext("request script run as root = <%d>") @@ -526,7 +523,6 @@ #define ERR_NOPKGS gettext("no packages were found in <%s>") #define ERR_NOREQUEST gettext("package does not contain an interactive request script") #define ERR_NORESP gettext("response file <%s> must not exist") -#define ERR_NOSUCH_INHERITED gettext("cannot use inherited file system <%s>") #define ERR_NOTABLE gettext("unable to open %s table <%s>: %s") #define ERR_NOT_IN_GZ_AND_Z_USED gettext("The package <%s> is not currently installed\nin the global zone only; you may not specify the -Z option to install the\npackage in all non-global zones until the package is first install in the\nglobal zone only. You may optionally install the package without the -Z option\nto install the package in all zones.") #define ERR_NOT_ROOT gettext("You must be \"root\" for %s to execute properly.") @@ -749,7 +745,6 @@ #define MSG_NOCHANGE gettext("No changes were made to the system.") #define MSG_NODENAME gettext("(unknown)") #define MSG_NOTEMPTY gettext("%s ") -#define MSG_NOTREMOVED_INHERITED gettext("%s ") #define MSG_N_PKGS_NOT_PROCESSED gettext("\n%d packages were not processed!\n") #define MSG_PASSPROMPT gettext("Enter keystore password:") #define MSG_PKGADDCHK_ABADFILE gettext("\\nPackaging file <%s> is corrupt for %s <%s> on %s <%s>") @@ -856,8 +851,7 @@ #define WRN_RSCRIPTALT_BAD gettext("WARNING: the admin parameter <%s> is set to <%s> which is not recognized; the parameter may only be set to <%s> or <%s>") #define WRN_RSCRIPTALT_USING gettext("WARNING: the admin parameter <%s> is assumed to be set to <%s>") #define WRN_UNKNOWN_ADM_PARAM gettext("WARNING: unknown admin parameter <%s>") - -#define NOTE_INSTVOL_FINALCKFAIL gettext("NOTE: When the package <%s> was installed in the global zone,\nthe file <%s> was also installed. After the file was\ninstalled in the global zone, the contents and/or attributes of the file\nchanged. The contents of this file must never be changed. As a result,\nthe changes in this file have been duplicated in the non-global zone\n<%s> in the file <%s>.") +#define NOTE_INSTVOL_FINALCKFAIL gettext("NOTE: When the package <%s> was installed in the zone,\nthe file <%s> was also installed. After the file was\ninstalled in the zone, the contents and/or attributes of the file\nchanged. The contents of this file must never be changed.") #define MSG_REBOOT gettext("\\n*** IMPORTANT NOTICE ***\\n" \ "\\tThis machine must now be rebooted in order to " \ diff -r bcfc9c7baa2e -r 76969fc28795 usr/src/cmd/svr4pkg/libinst/pkgdbmerg.c --- a/usr/src/cmd/svr4pkg/libinst/pkgdbmerg.c Wed Jun 30 17:40:22 2010 +0800 +++ b/usr/src/cmd/svr4pkg/libinst/pkgdbmerg.c Wed Jun 30 03:42:01 2010 -0700 @@ -20,8 +20,7 @@ */ /* - * Copyright 2009 Sun Microsystems, Inc. All rights reserved. - * Use is subject to license terms. + * Copyright (c) 1989, 2010, Oracle and/or its affiliates. All rights reserved. */ /* Copyright (c) 1984, 1986, 1987, 1988, 1989 AT&T */ @@ -972,20 +971,7 @@ * set later. */ - /* - * for type f/v files, if the file is in an area that is - * inherited from the global zone, that area is read only - * and the object cannot be changed - ignore any settings - * in the current package database that may be present for - * any existing object because they are irrelevant - since - * the object is in a read-only area shared from the global - * zone, accept that file's actual attributes as being correct. - */ - - if (z_path_is_inherited(el_ent->cf_ent.path, - el_ent->cf_ent.ftype, get_inst_root()) == B_TRUE) { - echoDebug(DBG_PKGDBMRG_INHERITED, el_ent->cf_ent.path); - } else if (cf_ent->cinfo.size != el_ent->cf_ent.cinfo.size) { + if (cf_ent->cinfo.size != el_ent->cf_ent.cinfo.size) { changed++; el_ent->mstat.contchg = 1; } else if (cf_ent->cinfo.modtime != diff -r bcfc9c7baa2e -r 76969fc28795 usr/src/cmd/svr4pkg/libinst/pkgops.c --- a/usr/src/cmd/svr4pkg/libinst/pkgops.c Wed Jun 30 17:40:22 2010 +0800 +++ b/usr/src/cmd/svr4pkg/libinst/pkgops.c Wed Jun 30 03:42:01 2010 -0700 @@ -20,8 +20,7 @@ */ /* - * Copyright 2009 Sun Microsystems, Inc. All rights reserved. - * Use is subject to license terms. + * Copyright (c) 2004, 2010, Oracle and/or its affiliates. All rights reserved. */ @@ -888,186 +887,6 @@ } /* - * Name: pkgMatchInherited - * Description: given a pointer to a "source" and a "destination" for an object, - * along with other attributes of the object, determine if the - * object is already installed and is current. - * Arguments: a_src - pointer to string representing the "source" file to - * verify - this would be the current temporary location of - * the file that would be installed - * a_dst - pointer to string representing the "destination" file to - * verify - this would be the ultimate destination for the - * file if installed - * a_rootDir - pointer to string representing the "root directory" - * where the package is being installed - * a_mode - final "mode" file should have when installed - * a_modtime - final "modtime" file should have when installed - * a_ftype - contents "type" of file (f/e/v/s/l) - * a_cksum - final "checksum" file should have when installed - * Returns: boolean_t - * B_TRUE - the specified source file MATCHES the file - * located at the specified destination - * B_FALSE - the specified source files does NOT match - * the file located at the specified destination - */ - -boolean_t -pkgMatchInherited(char *a_src, char *a_dst, char *a_rootDir, - char a_mode, time_t a_modtime, char a_ftype, unsigned long a_cksum) -{ - char cwd[PATH_MAX+1] = {'\0'}; - char dstpath[PATH_MAX+1]; - int cksumerr; - int n; - struct stat statbufDst; - struct stat statbufSrc; - unsigned long dstcksum; - unsigned long srcksum; - - /* entry assertions */ - - assert(a_src != (char *)NULL); - assert(*a_src != '\0'); - assert(a_dst != (char *)NULL); - assert(*a_dst != '\0'); - - /* normalize root directory */ - - if ((a_rootDir == (char *)NULL) || (*a_rootDir == '\0')) { - a_rootDir = "/"; - } - - /* entry debugging */ - - echoDebug(DBG_PKGOPS_MATCHINHERIT_ENTRY); - echoDebug(DBG_PKGOPS_MATCHINHERIT_ARGS, a_src, a_dst, a_rootDir, - a_mode, a_modtime, a_ftype, a_cksum); - - /* save current working directory - resolvepath can change it */ - - (void) getcwd(cwd, sizeof (cwd)); - - n = resolvepath(a_dst, dstpath, sizeof (dstpath)); - if (n <= 0) { - if (errno != ENOENT) { - progerr(ERR_RESOLVEPATH, a_dst, strerror(errno)); - } - (void) chdir(cwd); - return (B_FALSE); - } - dstpath[n++] = '\0'; /* make sure string is terminated */ - - /* return false if path is not in inherited file system space */ - - if (!z_path_is_inherited(dstpath, a_ftype, a_rootDir)) { - return (B_FALSE); - } - - /* - * path is in inherited file system space: verify existence - */ - - /* return false if source file cannot be stat()ed */ - - if (stat(a_src, &statbufSrc) != 0) { - progerr(ERR_STAT, a_src, strerror(errno)); - return (B_FALSE); - } - - /* return false if destination file cannot be stat()ed */ - - if (stat(dstpath, &statbufDst) != 0) { - progerr(ERR_STAT, dstpath, strerror(errno)); - return (B_FALSE); - } - - /* - * if this is an editable or volatile file, then the only - * thing to guarantee is that the file exists - the file - * attributes do not need to match - */ - - /* editable file only needs to exist */ - - if (a_ftype == 'e') { - echoDebug(DBG_PKGOPS_EDITABLE_EXISTS, dstpath); - return (B_TRUE); - } - - /* volatile file only needs to exist */ - - if (a_ftype == 'v') { - echoDebug(DBG_PKGOPS_VOLATILE_EXISTS, dstpath); - return (B_TRUE); - } - - /* - * verify modtime if file is not modifiable after install - */ - - /* return false if source and destination have different mod times */ - - if (statbufSrc.st_mtim.tv_sec != statbufDst.st_mtim.tv_sec) { - echoDebug(DBG_PKGOPS_MOD_MISMATCH, a_src, - statbufSrc.st_mtim.tv_sec, dstpath, - statbufDst.st_mtim.tv_sec); - return (B_FALSE); - } - - /* return false if destination does not have required mod time */ - - if (statbufDst.st_mtim.tv_sec != a_modtime) { - echoDebug(DBG_PKGOPS_MOD_MISMATCH, dstpath, - statbufDst.st_mtim.tv_sec, "source", a_modtime); - return (B_FALSE); - } - - /* - * verify checksums of both files - */ - - /* generate checksum of installed file */ - - cksumerr = 0; - dstcksum = compute_checksum(&cksumerr, dstpath); - if (cksumerr != 0) { - progerr(ERR_CANNOT_CKSUM_FILE, dstpath, strerror(errno)); - return (B_FALSE); - } - - /* return false if destination does not match recorded checksum */ - - if (dstcksum != a_cksum) { - echoDebug(DBG_PKGOPS_CKSUM_MISMATCH, dstpath, dstcksum, - "source", a_cksum); - return (B_FALSE); - } - - /* generate checksum of file to install */ - - cksumerr = 0; - srcksum = compute_checksum(&cksumerr, a_src); - if (cksumerr != 0) { - progerr(ERR_CANNOT_CKSUM_FILE, a_src, strerror(errno)); - return (B_FALSE); - } - - /* return false if source to install does not match recorded checksum */ - - if (srcksum != dstcksum) { - echoDebug(DBG_PKGOPS_CKSUM_MISMATCH, a_src, srcksum, dstpath, - dstcksum); - return (B_FALSE); - } - - /* src/dest identical - return true */ - - echoDebug(DBG_PKGOPS_IS_INHERITED, dstpath, ""); - - return (B_TRUE); -} - -/* * return string representing path to "global zone only file" */ @@ -1156,13 +975,6 @@ assert(a_pkgInst != (char *)NULL); assert(*a_pkgInst != '\0'); - /* if no inherited file systems, there can be no match */ - - if (numThisZonePackages == 0) { - echoDebug(DBG_PKGOPS_NOT_THISZONE, a_pkgInst); - return (B_FALSE); - } - /* * see if this package is in the "this zone only" list */ diff -r bcfc9c7baa2e -r 76969fc28795 usr/src/cmd/svr4pkg/libinst/putparam.c --- a/usr/src/cmd/svr4pkg/libinst/putparam.c Wed Jun 30 17:40:22 2010 +0800 +++ b/usr/src/cmd/svr4pkg/libinst/putparam.c Wed Jun 30 03:42:01 2010 -0700 @@ -20,8 +20,7 @@ */ /* - * Copyright 2009 Sun Microsystems, Inc. All rights reserved. - * Use is subject to license terms. + * Copyright (c) 1989, 2010, Oracle and/or its affiliates. All rights reserved. */ /* Copyright (c) 1984, 1986, 1987, 1988, 1989 AT&T */ @@ -194,7 +193,6 @@ void putConditionInfo(char *a_parentZoneName, char *a_parentZoneType) { - char **pp; char *p; char *pa; SML_TAG *tag = SML_TAG__NULL; @@ -209,7 +207,6 @@ * * zoneType=/> * zoneType=/> - * /> * */ @@ -268,30 +265,6 @@ free(ntag); /* - * describe any inherited file systems: - * /> - */ - - pp = z_get_inherited_file_systems(); - if (pp != (char **)NULL) { - int n; - for (n = 0; pp[n] != (char *)NULL; n++) { - /* allocate tag for inherited file system info */ - - ntag = smlNewTag(TAG_COND_INHERITED_FS); - - /* inherited file system */ - - smlSetParam(ntag, TAG_COND_FS_NAME, pp[n]); - - /* add to top level tag */ - - (void) smlAddTag(&tag, -1, ntag); - free(ntag); - } - } - - /* * done filling in tag - convert to string and place in environment */ diff -r bcfc9c7baa2e -r 76969fc28795 usr/src/cmd/svr4pkg/pkgadd/main.c --- a/usr/src/cmd/svr4pkg/pkgadd/main.c Wed Jun 30 17:40:22 2010 +0800 +++ b/usr/src/cmd/svr4pkg/pkgadd/main.c Wed Jun 30 03:42:01 2010 -0700 @@ -20,8 +20,7 @@ */ /* - * Copyright 2009 Sun Microsystems, Inc. All rights reserved. - * Use is subject to license terms. + * Copyright (c) 1989, 2010, Oracle and/or its affiliates. All rights reserved. */ /* Copyright (c) 1984, 1986, 1987, 1988, 1989 AT&T */ @@ -201,9 +200,6 @@ #define MAX_FDS 20 -#define INHERITFS "inherited-filesystem=" -#define INHERITFS_LEN ((sizeof (INHERITFS))-1) - /* * forward declarations */ @@ -214,18 +210,17 @@ static int boot_and_install_in_zones(zoneList_t a_zlst, char *a_idsName, char *a_altBinDir, char *a_zoneAdminFile, char *a_zoneTempDir); -static void pkginstall_check_in_one_zone(char **a_inheritedPkgDirs, - char *a_zoneName, char *a_idsName, - char *a_zoneAdminFile, char *a_zoneTempDir, - char *a_altBinDir, char *a_scratchName, - zone_state_t a_zoneState, boolean_t a_tmpzn); +static void pkginstall_check_in_one_zone(char *a_zoneName, + char *a_idsName, char *a_zoneAdminFile, + char *a_zoneTempDir, char *a_altBinDir, + char *a_scratchName, zone_state_t a_zoneState, + boolean_t a_tmpzn); static void ckreturn(int retcode); static void create_zone_adminfile(char **r_zoneAdminFile, char *a_zoneTempDir, char *a_admnfile); static void create_zone_tempdir(char **r_zoneTempDir, char *a_tmpdir); -static void install_in_one_zone(char **a_inheritedPkgDirs, - char *a_zoneName, char *a_idsName, +static void install_in_one_zone(char *a_zoneName, char *a_idsName, char *a_zoneAdminFile, char *a_zoneTempDir, char *a_altBinDir, zone_state_t a_zoneState, boolean_t a_tmpzn); @@ -236,15 +231,13 @@ char *a_altBinDir, char *a_zoneAdminFile, char *a_zoneTempDir); static int pkgInstall(char *ir, char *a_idsName, char *a_pkgDir, - char *a_altBinDir, char **a_inheritedPkgDirs); + char *a_altBinDir); static int pkgZoneCheckInstall(char *a_zoneName, - char **a_inheritedPkgDirs, zone_state_t a_zoneState, char *a_idsName, char *a_altBinDir, char *a_adminFile, char *a_stdoutPath, boolean_t a_tmpzn); static int pkgZoneInstall(char *a_zoneName, - char **a_inheritedPkgDirs, zone_state_t a_zoneState, char *a_idsName, char *a_altBinDir, char *a_adminFile, boolean_t a_tmpzn); @@ -588,9 +581,6 @@ * ---> add zone name to appropriate messages * -> nozones * ---> act as though in global zone with no non-global zones - * -> inherited-filesystems - * ---> add specified file system to list of file systems - * ---> that are inherited from the global zone * -> enable-hollow-package-support * ---> Enable hollow package support. When specified, for any * ---> package that has SUNW_PKG_HOLLOW=true: @@ -627,17 +617,6 @@ continue; } - if (strncmp(p, INHERITFS, INHERITFS_LEN) == 0) { - if (z_add_inherited_file_system( - p+INHERITFS_LEN) == B_FALSE) { - progerr(ERR_NOSUCH_INHERITED, - p+INHERITFS_LEN); - quit(1); - /* NOTREACHED */ - } - continue; - } - if (strcmp(p, "addzonename") == 0) { quitSetZoneName(z_get_zonename()); continue; @@ -1493,9 +1472,6 @@ * check of the a single package in the specified zone * Arguments: a_zoneName - pointer to string representing the name of the * zone to check install the package in. - * a_inheritedPkgDirs - pointer to array of strings, each one - * representing the non-global zones full path of a - * directory that is inherited from the global zone. * a_zoneState - current state of the zone; must be mounted or * running. * a_idsName - pointer to string representing the data stream @@ -1526,9 +1502,9 @@ */ static int -pkgZoneCheckInstall(char *a_zoneName, char **a_inheritedPkgDirs, - zone_state_t a_zoneState, char *a_idsName, char *a_altBinDir, - char *a_adminFile, char *a_stdoutPath, boolean_t a_tmpzn) +pkgZoneCheckInstall(char *a_zoneName, zone_state_t a_zoneState, + char *a_idsName, char *a_altBinDir, char *a_adminFile, + char *a_stdoutPath, boolean_t a_tmpzn) { char *arg[MAXARGS]; char *p; @@ -1711,19 +1687,6 @@ } } - /* add all inherited file systems */ - - if (a_inheritedPkgDirs != (char **)NULL) { - for (n = 0; a_inheritedPkgDirs[n] != (char *)NULL; n++) { - char ifs[MAXPATHLEN+22]; - (void) snprintf(ifs, sizeof (ifs), - "inherited-filesystem=%s", - a_inheritedPkgDirs[n]); - arg[nargs++] = "-O"; - arg[nargs++] = strdup(ifs); - } - } - /* * add parent zone info/type */ @@ -1828,9 +1791,6 @@ * of a single package in the specified zone * Arguments: a_zoneName - pointer to string representing the name of the * zone to install the package in. - * a_inheritedPkgDirs - pointer to array of strings, each one - * representing the non-global zones full path of a - * directory that is inherited from the global zone. * a_zoneState - current state of the zone; must be mounted or * running. * a_idsName - pointer to string representing the data stream @@ -1861,9 +1821,8 @@ */ static int -pkgZoneInstall(char *a_zoneName, char **a_inheritedPkgDirs, - zone_state_t a_zoneState, char *a_idsName, char *a_altBinDir, - char *a_adminFile, boolean_t a_tmpzn) +pkgZoneInstall(char *a_zoneName, zone_state_t a_zoneState, char *a_idsName, + char *a_altBinDir, char *a_adminFile, boolean_t a_tmpzn) { char *arg[MAXARGS]; char *p; @@ -2076,19 +2035,6 @@ } } - /* add all inherited file systems */ - - if (a_inheritedPkgDirs != (char **)NULL) { - for (n = 0; a_inheritedPkgDirs[n] != (char *)NULL; n++) { - char ifs[MAXPATHLEN+22]; - (void) snprintf(ifs, sizeof (ifs), - "inherited-filesystem=%s", - a_inheritedPkgDirs[n]); - arg[nargs++] = "-O"; - arg[nargs++] = strdup(ifs); - } - } - /* * add parent zone info/type */ @@ -2200,9 +2146,6 @@ * a_altBinDir - pointer to string representing location of the * pkginstall executable to run. If not NULL, then pass * the path specified to the -b option to pkginstall. - * a_inheritedPkgDirs - pointer to array of strings, each one - * representing the non-global zones full path of a - * directory that is inherited from the global zone. * Returns: int (see ckreturn() function for details) * 0 - success * 1 - package operation failed (fatal error) @@ -2221,8 +2164,7 @@ */ static int -pkgInstall(char *a_altRoot, char *a_idsName, char *a_pkgDir, char *a_altBinDir, - char **a_inheritedPkgDirs) +pkgInstall(char *a_altRoot, char *a_idsName, char *a_pkgDir, char *a_altBinDir) { char *arg[MAXARGS]; char *p; @@ -2473,19 +2415,6 @@ } } - /* add all inherited file systems */ - - if (a_inheritedPkgDirs != (char **)NULL) { - for (n = 0; a_inheritedPkgDirs[n] != (char *)NULL; n++) { - char ifs[MAXPATHLEN+22]; - (void) snprintf(ifs, sizeof (ifs), - "inherited-filesystem=%s", - a_inheritedPkgDirs[n]); - arg[nargs++] = "-O"; - arg[nargs++] = strdup(ifs); - } - } - /* * add parent zone info/type */ @@ -3399,10 +3328,7 @@ /* * Name: install_in_one_zone * Description: Install a single package in a single zone - * Arguments: a_inheritedPkgDirs - pointer to array of strings, each one - * representing the non-global zones full path of a - * directory that is inherited from the global zone. - * a_zoneName - pointer to string representing the name of the + * Arguments: a_zoneName - pointer to string representing the name of the * zone to install the package into. * a_idsName - pointer to string representing the data stream * device (input data stream) containing the package to @@ -3432,8 +3358,8 @@ */ static void -install_in_one_zone(char **a_inheritedPkgDirs, char *a_zoneName, - char *a_idsName, char *a_zoneAdminFile, char *a_zoneTempDir, +install_in_one_zone(char *a_zoneName, char *a_idsName, + char *a_zoneAdminFile, char *a_zoneTempDir, char *a_altBinDir, zone_state_t a_zoneState, boolean_t a_tmpzn) { char zoneStreamName[PATH_MAX] = {'\0'}; @@ -3469,8 +3395,8 @@ echoDebug(DBG_INSTALL_IN_ZONE, pkginst, a_zoneName, zoneStreamName); - n = pkgZoneInstall(a_zoneName, a_inheritedPkgDirs, a_zoneState, - zoneStreamName, a_altBinDir, a_zoneAdminFile, a_tmpzn); + n = pkgZoneInstall(a_zoneName, a_zoneState, zoneStreamName, + a_altBinDir, a_zoneAdminFile, a_tmpzn); /* set success/fail condition variables */ @@ -3509,7 +3435,6 @@ install_in_zones(zoneList_t a_zlst, char *a_idsName, char *a_altBinDir, char *a_zoneAdminFile, char *a_zoneTempDir) { - char **inheritedPkgDirs; char *zoneName; int zoneIndex; int zonesSkipped = 0; @@ -3540,16 +3465,11 @@ continue; } - /* determine list of directories inherited from global zone */ - - inheritedPkgDirs = z_zlist_get_inherited_pkg_dirs(a_zlst, - zoneIndex); - /* install the package in this zone */ - install_in_one_zone(inheritedPkgDirs, - z_zlist_get_scratch(a_zlst, zoneIndex), a_idsName, - a_zoneAdminFile, a_zoneTempDir, a_altBinDir, zst, B_FALSE); + install_in_one_zone(z_zlist_get_scratch(a_zlst, zoneIndex), + a_idsName, a_zoneAdminFile, a_zoneTempDir, a_altBinDir, + zst, B_FALSE); } return (zonesSkipped); @@ -3583,7 +3503,6 @@ char *a_zoneAdminFile, char *a_zoneTempDir) { boolean_t b; - char **inheritedPkgDirs; char *zoneName; int zoneIndex; int zonesSkipped = 0; @@ -3636,16 +3555,10 @@ continue; } - /* determine list of directories inherited from global zone */ - - inheritedPkgDirs = z_zlist_get_inherited_pkg_dirs(a_zlst, - zoneIndex); - /* install the package in this zone */ - install_in_one_zone(inheritedPkgDirs, - z_zlist_get_scratch(a_zlst, zoneIndex), a_idsName, - a_zoneAdminFile, a_zoneTempDir, a_altBinDir, + install_in_one_zone(z_zlist_get_scratch(a_zlst, zoneIndex), + a_idsName, a_zoneAdminFile, a_zoneTempDir, a_altBinDir, ZONE_STATE_MOUNTED, B_TRUE); /* restore original state of zone */ @@ -3662,10 +3575,7 @@ /* * Name: pkginstall_check_in_one_zone * Description: Do a pre install check of a single package in a single zone - * Arguments: a_inheritedPkgDirs - pointer to array of strings, each one - * representing the non-global zones full path of a - * directory that is inherited from the global zone. - * a_zoneName - pointer to string representing the name of the + * Arguments: a_zoneName - pointer to string representing the name of the * zone to check install the package in. * a_idsName - pointer to string representing the data stream * device (input data stream) containing the package to @@ -3695,7 +3605,7 @@ */ static void -pkginstall_check_in_one_zone(char **a_inheritedPkgDirs, char *a_zoneName, +pkginstall_check_in_one_zone(char *a_zoneName, char *a_idsName, char *a_zoneAdminFile, char *a_zoneTempDir, char *a_altBinDir, char *a_scratchName, zone_state_t a_zoneState, boolean_t a_tmpzn) @@ -3723,9 +3633,8 @@ echoDebug(DBG_CHECKINSTALL_IN_ZONE, pkginst, a_zoneName, zoneStreamName); - n = pkgZoneCheckInstall(a_scratchName, a_inheritedPkgDirs, - a_zoneState, zoneStreamName, a_altBinDir, a_zoneAdminFile, - preinstallcheckPath, a_tmpzn); + n = pkgZoneCheckInstall(a_scratchName, a_zoneState, zoneStreamName, + a_altBinDir, a_zoneAdminFile, preinstallcheckPath, a_tmpzn); /* set success/fail condition variables */ @@ -3763,7 +3672,6 @@ pkginstall_check_in_zones(zoneList_t a_zlst, char *a_idsName, char *a_altBinDir, char *a_zoneAdminFile, char *a_zoneTempDir) { - char **inheritedPkgDirs; char *zoneName; int zoneIndex; int zonesSkipped = 0; @@ -3780,11 +3688,8 @@ continue; } - inheritedPkgDirs = z_zlist_get_inherited_pkg_dirs(a_zlst, - zoneIndex); - - pkginstall_check_in_one_zone(inheritedPkgDirs, zoneName, - a_idsName, a_zoneAdminFile, a_zoneTempDir, a_altBinDir, + pkginstall_check_in_one_zone(zoneName, a_idsName, + a_zoneAdminFile, a_zoneTempDir, a_altBinDir, z_zlist_get_scratch(a_zlst, zoneIndex), zst, B_FALSE); } @@ -3823,7 +3728,6 @@ int zonesSkipped = 0; char *zoneName; boolean_t b; - char **inheritedPkgDirs; zone_state_t zst; /* entry assertions */ @@ -3873,15 +3777,10 @@ continue; } - /* determine list of directories inherited from global zone */ - - inheritedPkgDirs = z_zlist_get_inherited_pkg_dirs(a_zlst, - zoneIndex); - /* pre-installation check of the package in this zone */ - pkginstall_check_in_one_zone(inheritedPkgDirs, zoneName, - a_idsName, a_zoneAdminFile, a_zoneTempDir, a_altBinDir, + pkginstall_check_in_one_zone(zoneName, a_idsName, + a_zoneAdminFile, a_zoneTempDir, a_altBinDir, z_zlist_get_scratch(a_zlst, zoneIndex), ZONE_STATE_MOUNTED, B_TRUE); @@ -4165,7 +4064,7 @@ interrupted = 0; /* last action was NOT quit */ n = pkgInstall(get_inst_root(), NULL, packageDir, - a_altBinDir, NULL); + a_altBinDir); /* set success/fail condition variables */ @@ -4418,8 +4317,7 @@ /* call pkginstall for this package */ n = pkgInstall(get_inst_root(), NULL, - packageDir, a_altBinDir, - (char **)NULL); + packageDir, a_altBinDir); /* set success/fail condition variables */ @@ -4572,8 +4470,7 @@ /* call pkginstall for this package */ n = pkgInstall(get_inst_root(), a_idsName, - pkgdev.dirname, a_altBinDir, - z_get_inherited_file_systems()); + pkgdev.dirname, a_altBinDir); /* set success/fail condition variables */ diff -r bcfc9c7baa2e -r 76969fc28795 usr/src/cmd/svr4pkg/pkgcond/main.c --- a/usr/src/cmd/svr4pkg/pkgcond/main.c Wed Jun 30 17:40:22 2010 +0800 +++ b/usr/src/cmd/svr4pkg/pkgcond/main.c Wed Jun 30 03:42:01 2010 -0700 @@ -20,8 +20,7 @@ */ /* - * Copyright 2009 Sun Microsystems, Inc. All rights reserved. - * Use is subject to license terms. + * Copyright (c) 2005, 2010, Oracle and/or its affiliates. All rights reserved. */ @@ -49,7 +48,6 @@ * is_nonglobal_zone [path] * is_path_writable path * is_running_system [path] - * is_sparse_root_nonglobal_zone [path] * is_what [path] * is_whole_root_nonglobal_zone [path] * @@ -136,8 +134,6 @@ /* holds parsed global data */ struct globalData_t { - /* sparse root (are any file systems mounted read-only)? */ - boolean_t gd_srFsMountedRO; /* initial install: PKG_INIT_INSTALL=true */ boolean_t gd_initialInstall; /* global zone install: SUNW_PKG_INSTALL_ZONENAME=global */ @@ -164,8 +160,6 @@ char *gd_currentZoneName; /* SUNW_PKGCOND_GLOBAL_DATA:currentZone:zoneType */ char *gd_currentZoneType; - /* list of inherited file systems */ - char **gd_inheritedFileSystems; /* path provided on command line */ char *gd_cmdline_path; }; @@ -206,19 +200,13 @@ GLOBALDATA_T *a_gdt); static int cmd_is_running_system(int argc, char **argv, GLOBALDATA_T *a_gdt); -static int cmd_is_sparse_root_ng_zone(int argc, char **argv, - GLOBALDATA_T *a_gdt); static int cmd_is_what(int argc, char **argv, GLOBALDATA_T *a_gdt); -static int cmd_is_whole_root_ng_zone(int argc, char **argv, - GLOBALDATA_T *a_gdt); /* Utility function Prototypes */ static boolean_t getNegateResults(void); static boolean_t recursionCheck(int *r_recursion, char *a_function); -static boolean_t checkForReadOnlyMount(GLOBALDATA_T *a_gdt, - char *a_mntPoint, char *a_fsType, char *a_mntOptions); static int adjustResults(int a_result); static int calculateFileSystemConfig(GLOBALDATA_T *a_gdt); static int getRootPath(char **r_rootPath); @@ -273,14 +261,10 @@ cmd_is_path_writable }, { "is_running_system", " [path]", cmd_is_running_system }, - { "is_sparse_root_nonglobal_zone", " [path]", - cmd_is_sparse_root_ng_zone }, { "is_what", " [path]", cmd_is_what }, - { "is_whole_root_nonglobal_zone", " [path]", - cmd_is_whole_root_ng_zone }, /* last one must be all NULLs */ - { NULL, NULL } + { NULL, NULL, NULL } }; /* @@ -553,15 +537,9 @@ * a diskless client cannot be any of the following */ - /* cannot be whole root non-global zone */ - - r = cmd_is_whole_root_ng_zone(argc, argv, a_gdt); - - /* cannot be nonglobal zone */ - - if (r != R_SUCCESS) { - r = cmd_is_nonglobal_zone(argc, argv, a_gdt); - } + /* cannot be non-global zone */ + + r = cmd_is_nonglobal_zone(argc, argv, a_gdt); /* cannot be mounted miniroot */ @@ -1495,13 +1473,11 @@ } /* - * In non-global zone if inherited FS's exits - * or zone specific read only FS's exist + * In non-global zone if zone specific read only FS's exist * or it is in a mounted state. */ - if (a_gdt->gd_inheritedFileSystems != NULL || - a_gdt->gd_srFsMountedRO || a_gdt->inMountedState) { + if (a_gdt->inMountedState) { log_msg(LOG_MSG_DEBUG, DBG_NGZN_IS_NONGLOBAL_ZONE, rootPath); return (R_SUCCESS); } @@ -2097,7 +2073,7 @@ /* * Name: cmd_is_path_writable - * Description: determine if target path is writable (not inherited) + * Description: determine if target path is writable * Scope: public * Arguments: argc,argv: * - optional path to target to test @@ -2106,7 +2082,6 @@ * != 0 - failure * IMPLEMENTATION: * - path must be found in the file systems configured - * - file system type must not be "inherited" * - mount options must not include "read only" */ @@ -2201,15 +2176,8 @@ /* * need to determine if the mount point is writeable: - * If parent mount point is "inherited" then it is not writeable */ - if (strcmp(list[nn].fsi_fsType, FSTYPE_INHERITED) == 0) { - log_msg(LOG_MSG_DEBUG, DBG_PWRT_INHERITED, rootPath, - list[nn].fsi_mntOptions); - return (R_FAILURE); - } - /* see if the file system is mounted with the "read only" option */ r = mountOptionPresent(list[nn].fsi_mntOptions, MNTOPT_RO); @@ -2578,123 +2546,6 @@ } /* - * Name: cmd_is_sparse_root_ng_zone - * Description: determine if target is a sparse non-global zone - * Scope: public - * Arguments: argc,argv: - * - optional path to target to test - * Returns: int - * == 0 - success - * != 0 - failure - * IMPLEMENATION: - * - must be a non-global zone - * - inherited file systems must be present, and/or - * - read-only lofs file systems must be present - */ - -static int -cmd_is_sparse_root_ng_zone(int argc, char **argv, GLOBALDATA_T *a_gdt) -{ - char *rootPath = NULL; - int c; - int r; -static char *cmdName = "is_sparse_root_nonglobal_zone"; -static int recursion = 0; - - /* process any command line options */ - - while ((c = getopt(argc, argv, ":")) != EOF) { - switch (c) { - case '\0': /* prevent end-of-loop not reached warning */ - break; - case '?': - default: - (void) usage(MSG_IS_INVALID_OPTION, optopt, cmdName); - return (R_USAGE); - } - } - - /* prevent recursion */ - - if (recursionCheck(&recursion, cmdName) == B_FALSE) { - - /* see if this is a non-global zone */ - - r = cmd_is_nonglobal_zone(argc, argv, a_gdt); - - /* no need to guard against recursion any more */ - - recursion--; - - switch (r) { - case R_SUCCESS: - /* is a non-global zone */ - break; - case R_FAILURE: - /* not a non-global zone */ - return (R_FAILURE); - case R_USAGE: - case R_ERROR: - default: - /* cannot determine if non-global zone */ - return (r); - } - } - - /* normalize argc/argv */ - - argc -= optind; - argv += optind; - - /* error if more than one argument */ - - if (argc > 1) { - log_msg(LOG_MSG_ERR, ERR_UNRECOGNIZED_OPTION, argv[1]); - (void) usage(MSG_IS_INVALID_OPTION, argv[1]); - return (R_USAGE); - } - - /* process root path if first argument present */ - - if (argc == 1) { - if (setRootPath(argv[0], "argv[0]", B_TRUE) != R_SUCCESS) { - return (R_ERROR); - } - } - - /* get current root path */ - - r = getRootPath(&rootPath); - if (r != R_SUCCESS) { - return (r); - } - - /* start of command debugging information */ - - echoDebug(DBG_ROOTPATH_IS, rootPath); - - /* - * in a non-global zone: - * if any file systems are inherited, or if /usr is read only, - * then the target is a sparse root non-global zone. - */ - - if ((a_gdt->gd_inheritedFileSystems != (char **)NULL) || - (a_gdt->gd_srFsMountedRO == B_TRUE)) { - /* no inherited file systems */ - log_msg(LOG_MSG_DEBUG, DBG_SRNG_IS, rootPath); - return (R_SUCCESS); - } - - /* target is not a sparse root non-global zone */ - - log_msg(LOG_MSG_DEBUG, DBG_SRNG_IS_NOT, rootPath); - - return (R_FAILURE); - -} - -/* * Name: cmd_is_what * Description: determine what the target is * Scope: public @@ -2792,122 +2643,6 @@ } /* - * Name: cmd_is_whole_root_ng_zone - * Description: determine if target is a global zone - * Scope: public - * Arguments: argc,argv: - * - optional path to target to test - * Returns: int - * == 0 - success - * != 0 - failure - * IMPLEMENTATION: - * - must be a non-global zone - * - no inherited file systems may be present - * - no read-only lofs file systems may be present - */ - -static int -cmd_is_whole_root_ng_zone(int argc, char **argv, GLOBALDATA_T *a_gdt) -{ - char *rootPath = NULL; - int c; - int r; -static char *cmdName = "is_whole_root_nonglobal_zone"; -static int recursion = 0; - - /* process any command line options */ - - while ((c = getopt(argc, argv, ":")) != EOF) { - switch (c) { - case '\0': /* prevent end-of-loop not reached warning */ - break; - case '?': - default: - (void) usage(MSG_IS_INVALID_OPTION, optopt, cmdName); - return (R_USAGE); - } - } - - /* prevent recursion */ - - if (recursionCheck(&recursion, cmdName) == B_FALSE) { - - /* see if this is a non-global zone */ - - r = cmd_is_nonglobal_zone(argc, argv, a_gdt); - - /* no need to guard against recursion any more */ - - recursion--; - - switch (r) { - case R_SUCCESS: - /* is a non-global zone */ - break; - case R_FAILURE: - /* not a non-global zone */ - return (R_FAILURE); - case R_USAGE: - case R_ERROR: - default: - /* cannot determine if non-global zone */ - return (r); - } - } - - /* normalize argc/argv */ - - argc -= optind; - argv += optind; - - /* error if more than one argument */ - - if (argc > 1) { - log_msg(LOG_MSG_ERR, ERR_UNRECOGNIZED_OPTION, argv[1]); - (void) usage(MSG_IS_INVALID_OPTION, argv[1]); - return (R_USAGE); - } - - /* process root path if first argument present */ - - if (argc == 1) { - if (setRootPath(argv[0], "argv[0]", B_TRUE) != R_SUCCESS) { - return (R_ERROR); - } - } - - /* get current root path */ - - r = getRootPath(&rootPath); - if (r != R_SUCCESS) { - return (r); - } - - /* start of command debugging information */ - - echoDebug(DBG_ROOTPATH_IS, rootPath); - - /* - * in a non-global zone: - * if no file systems are inherited, and if /usr is not - * read only, then the target is a whole root non-global zone. - */ - - if ((a_gdt->gd_inheritedFileSystems == (char **)NULL) && - (a_gdt->gd_srFsMountedRO == B_FALSE)) { - /* no inherited file systems */ - log_msg(LOG_MSG_DEBUG, DBG_WRNG_IS, rootPath); - return (R_SUCCESS); - } - - /* target is not a whole-root non-global zone */ - - log_msg(LOG_MSG_DEBUG, DBG_WRNG_IS_NOT, rootPath); - - return (R_FAILURE); -} - -/* * ***************************************************************************** * utility support functions * ***************************************************************************** @@ -3174,16 +2909,11 @@ struct mnttab mntbuf; FSI_T *list; long listSize; - boolean_t readOnlyMountFound = B_FALSE; /* entry assetions */ assert(a_gdt != (GLOBALDATA_T *)NULL); - /* entry debugging info */ - - echoDebug(DBG_CALCSCFG_ENTRY); - /* allocate a list that has one termination entry */ list = (FSI_T *)calloc(1, sizeof (FSI_T)); @@ -3192,24 +2922,6 @@ list[0].fsi_mntOptions = NULL; listSize = 0; - /* insert entries for all inherited file systems */ - - if (a_gdt->gd_inheritedFileSystems) { - int n; - char **ifs = a_gdt->gd_inheritedFileSystems; - - /* debugging info */ - - echoDebug(DBG_CALCSCFG_INHERITED); - - /* insert all inherited file systems */ - - for (n = 0; ifs[n]; n++) { - sortedInsert(&list, &listSize, ifs[n], - FSTYPE_INHERITED, MNTOPT_RO); - } - } - /* open the mount table for reading */ fp = fopen(MNTTAB, "r"); @@ -3242,11 +2954,6 @@ a_gdt->inMountedState = B_TRUE; } - if (!readOnlyMountFound) { - readOnlyMountFound = checkForReadOnlyMount(a_gdt, - mntbuf.mnt_mountp, mntbuf.mnt_fstype, - mntbuf.mnt_mntopts); - } } /* close mount table file */ @@ -3262,99 +2969,6 @@ } /* - * Name: checkForReadOnlyMount - * Description: given a mount point, type and options, determine if the - * mounted file system is part of a "sparse root" configuration - * by checking if the known Zone directories a ro LOFS mounted. - * Arguments: a_gdt - global data structure to place sorted entries into - * a_mntPoint - pointer to string representing mount point - * a_fsType - pointer to string representing file system type - * a_mntOptions - pointer to string representing the options - * used to mount the file system - * Returns: B_TRUE - if sparse root mount is found - * B_FLASE - if no sparse root mount's are found - * Side Effects: set: - * a_gdt->gd_srFsMountedRO = B_TRUE - * if the mounted file system is part of a 'sparse root' config - */ - -static boolean_t -checkForReadOnlyMount(GLOBALDATA_T *a_gdt, char *a_mntPoint, - char *a_fsType, char *a_mntOptions) -{ - /* entry assertions */ - int i; - char mntPoint[MAXPATHLEN]; - char *zDirs[] = { "/usr", "/lib", "/platform", "/sbin", NULL }; - char *aZDirs[] = { "/a/usr", "/a/lib", "/a/platform", "/a/sbin", NULL }; - - assert(a_gdt != (GLOBALDATA_T *)NULL); - assert(a_mntPoint != NULL); - assert(a_fsType != NULL); - - /* return if no read-only mount option */ - - if (mountOptionPresent(a_mntOptions, MNTOPT_RO) != R_SUCCESS) { - return (B_FALSE); - } - - /* return if file system is not read-only mounted */ - - if (strcmp(a_fsType, MNTTYPE_LOFS) != 0) { - return (B_FALSE); - } - - /* file system is a read-only lofs mounted. */ - - /* Check read-only lofs mount's appended to the command line path */ - - if (a_gdt->gd_cmdline_path != NULL) { - if (strncmp(a_mntPoint, a_gdt->gd_cmdline_path, - strlen(a_gdt->gd_cmdline_path)) == 0) { - for (i = 0; zDirs[i] != NULL; i++) { - (void) snprintf(mntPoint, sizeof (mntPoint), - "%s%s", a_gdt->gd_cmdline_path, - zDirs[i]); - if (strcmp(a_mntPoint, mntPoint) == 0) { - echoDebug(DBG_CKSR_FSREADONLY, - a_mntPoint, a_fsType); - a_gdt->gd_srFsMountedRO = B_TRUE; - return (B_TRUE); - } - } - } - - /* Check read-only lofs mount's in the mounted state */ - - } else if (a_gdt->inMountedState) { - for (i = 0; aZDirs[i] != NULL; i++) { - if (strncmp(a_mntPoint, aZDirs[i], - sizeof (aZDirs[i])) == 0) { - echoDebug(DBG_CKSR_FSREADONLY, a_mntPoint, - a_fsType); - a_gdt->gd_srFsMountedRO = B_TRUE; - return (B_TRUE); - } - } - - /* Check read-only lofs mount's for live system */ - - } else { - for (i = 0; zDirs[i] != NULL; i++) { - if (strncmp(a_mntPoint, zDirs[i], - sizeof (zDirs[i])) == 0) { - echoDebug(DBG_CKSR_FSREADONLY, a_mntPoint, - a_fsType); - a_gdt->gd_srFsMountedRO = B_TRUE; - return (B_TRUE); - } - } - } - - return (B_FALSE); -} - -/* * Name: adjustResults * Description: adjust output result code before existing * Arguments: a_result - result code to adjust @@ -4344,33 +3958,6 @@ TAG_COND_ZONE_TYPE); (*r_gdt)->gd_currentZoneType = a; - /* extract any inherited file systems */ - - for (n = 0; ; n++) { - char **ifs; - - a = smlGetParamByTag(ntag, n, TAG_COND_INHERITED_FS, - TAG_COND_FS_NAME); - - if (a == NULL) { - if (n > 0) { - /* LINTED warning: variable may be used */ - (*r_gdt)->gd_inheritedFileSystems = ifs; - } - break; - } - - if (n == 0) { - ifs = (char **)calloc(1, sizeof (char **)*(n+2)); - ifs[n] = a; - ifs[n+1] = NULL; - } else { - ifs = (char **)realloc(ifs, sizeof (char **)*(n+2)); - ifs[n] = a; - ifs[n+1] = NULL; - } - } - return (R_SUCCESS); } @@ -4399,13 +3986,6 @@ a_gdt->gd_currentZoneName ? a_gdt->gd_currentZoneName : "", a_gdt->gd_currentZoneType ? a_gdt->gd_currentZoneType : ""); - if (a_gdt->gd_inheritedFileSystems) { - int n; - char **ifs = a_gdt->gd_inheritedFileSystems; - for (n = 0; ifs[n]; n++) { - echoDebug(DBG_DUMP_GLOBAL_LINE, n, ifs[n]); - } - } } /* diff -r bcfc9c7baa2e -r 76969fc28795 usr/src/cmd/svr4pkg/pkgcond/pkgcond.h --- a/usr/src/cmd/svr4pkg/pkgcond/pkgcond.h Wed Jun 30 17:40:22 2010 +0800 +++ b/usr/src/cmd/svr4pkg/pkgcond/pkgcond.h Wed Jun 30 03:42:01 2010 -0700 @@ -20,8 +20,7 @@ */ /* - * Copyright 2006 Sun Microsystems, Inc. All rights reserved. - * Use is subject to license terms. + * Copyright (c) 2005, 2010, Oracle and/or its affiliates. All rights reserved. */ #ifndef _PKGCOND_H @@ -46,9 +45,6 @@ #define ENV_VAR_INITIAL_INSTALL "PKG_INIT_INSTALL" #define ENV_VAR_PATCH_CLIENTVER "PATCH_CLIENT_VERSION" -/* file system types */ -#define FSTYPE_INHERITED "inherited" - /* return codes used with pkgcond itself */ #define R_SUCCESS 0x0 /* condition match / success */ #define R_FAILURE 0x1 /* condition no match / failure */ diff -r bcfc9c7baa2e -r 76969fc28795 usr/src/cmd/svr4pkg/pkgcond/pkgcond_msgs.h --- a/usr/src/cmd/svr4pkg/pkgcond/pkgcond_msgs.h Wed Jun 30 17:40:22 2010 +0800 +++ b/usr/src/cmd/svr4pkg/pkgcond/pkgcond_msgs.h Wed Jun 30 03:42:01 2010 -0700 @@ -20,8 +20,7 @@ */ /* - * Copyright 2007 Sun Microsystems, Inc. All rights reserved. - * Use is subject to license terms. + * Copyright (c) 2005, 2010, Oracle and/or its affiliates. All rights reserved. */ #ifndef _PKGCOND_MSGS_H @@ -198,9 +197,6 @@ #define DBG_PARSED_ENVIRONMENT gettext(\ "global data parsed from environment variable <%s>") -#define DBG_DUMP_GLOBAL_LINE gettext(\ -"inherited file system <%d> is <%s>") - #define DBG_DUMP_GLOBAL_ENTRY gettext(\ "global data settings") @@ -378,17 +374,6 @@ #define DBG_WRNG_IS gettext(\ "root path <%s> is a whole root non-global zone") -#define DBG_WRNG_IS_NOT gettext(\ -"root path <%s> is not a whole root non-global zones: " \ -"file systems are inherited") - -#define DBG_SRNG_IS_NOT gettext(\ -"root path <%s> is not a sparse root non-global zones: " \ -"file systems are not inherited") - -#define DBG_SRNG_IS gettext(\ -"root path <%s> is a sparse root non-global zone") - #define DBG_BENV_INITIAL_INSTALL gettext(\ "path <%s> is not an alternative boot environment: initial " \ "installation in progress") @@ -414,9 +399,6 @@ #define DBG_BENV_BAD_ROOTPATH gettext(\ "path <%s> is not an alternative boot environment: root directory is <%s>") -#define DBG_PWRT_INHERITED gettext(\ -"root path <%s> is not writeable: is inherited with <%s>") - #define DBG_PWRT_READONLY gettext(\ "root path <%s> is not writeable: is read only <%s>") @@ -432,12 +414,6 @@ #define DBG_CKSR_FSREADONLY gettext(\ "file system <%s> type <%s> is read-only") -#define DBG_CALCSCFG_ENTRY gettext(\ -"analyzing inherited and mounted file systems") - -#define DBG_CALCSCFG_INHERITED gettext(\ -"analyzing inherited file systems") - #define DBG_CALCSCFG_MOUNTED gettext(\ "analyzing mounted file systems") diff -r bcfc9c7baa2e -r 76969fc28795 usr/src/cmd/svr4pkg/pkginstall/instvol.c --- a/usr/src/cmd/svr4pkg/pkginstall/instvol.c Wed Jun 30 17:40:22 2010 +0800 +++ b/usr/src/cmd/svr4pkg/pkginstall/instvol.c Wed Jun 30 03:42:01 2010 -0700 @@ -20,8 +20,7 @@ */ /* - * Copyright 2009 Sun Microsystems, Inc. All rights reserved. - * Use is subject to license terms. + * Copyright (c) 1989, 2010, Oracle and/or its affiliates. All rights reserved. */ /* Copyright (c) 1984, 1986, 1987, 1988, 1989 AT&T */ @@ -108,8 +107,7 @@ static int domerg(struct cfextra **extlist, int part, int nparts, int myclass, char **srcp, char **dstp, - char **r_updated, char **r_skipped, - char **r_anyPathLocal); + char **r_updated); static void endofclass(struct cfextra **extlist, int myclass, int ckflag, PKGserver server, VFP_T **a_cfTmpVfp); static int fix_attributes(struct cfextra **, int); @@ -138,13 +136,10 @@ void instvol(struct cfextra **extlist, char *srcinst, int part, int nparts, PKGserver pkgserver, VFP_T **a_cfTmpVfp, - char **r_updated, char **r_skipped, - char *a_zoneName) + char **r_updated, char *a_zoneName) { FILE *listfp; char *updated = (char *)NULL; - char *skipped = (char *)NULL; - char *anyPathLocal = (char *)NULL; char *relocpath = (char *)NULL; char *dstp; char *listfile; @@ -163,14 +158,13 @@ struct reg_files *rfp = NULL; /* - * r_updated and r_skipped are optional parameters that can be passed in - * by the caller if the caller wants to know if any objects are either - * updated or skipped. Do not initialize either r_updated or r_skipped; - * the call to instvol could be cumulative and any previous update or - * skipped indication must not be disturbed - these flags are only set, - * they must never be reset. These flags are "char *" pointers so that - * the object that was skipped or updated can be displayed in debugging - * output. + * r_updated is an optional parameter that can be passed in + * by the caller if the caller wants to know if any objects are + * updated. Do not initialize r_updated; the call to instvol + * could be cumulative and any previous update indication must not + * be disturbed - this flag is only set, it must never be reset. + * This flag is a "char *" pointer so that the object that was + * updated can be displayed in debugging output. */ if (part == 1) { @@ -241,8 +235,7 @@ */ entryidx = domerg(extlist, (pass++ ? 0 : part), nparts, - classidx, &srcp, &dstp, &updated, &skipped, - &anyPathLocal); + classidx, &srcp, &dstp, &updated); /* Evaluate the return code */ if (entryidx == DMRG_DONE) { @@ -496,45 +489,18 @@ * If doing a partial installation (creating a * non-global zone), extra steps need to be taken: * - * 1) if the file is not type 'e' and not type 'v' and + * If the file is not type 'e' and not type 'v' and * the class is "none": then the file must already * exist (as a result of the initial non-global zone * installation which caused all non-e/v files to be * copied from the global zone to the non-global * zone). If this is the case, verify that the file * exists and has the correct attributes. - * - * 2) if the file is not type 'e' and not type 'v' - * and the class is NOT "none", *OR* if the file is - * type 'e' or type 'v': then check to see if the - * file is located in an area inherited from the - * global zone. If so, then there is no ability to - * change the file since inherited file systems are - * "read only" - just verify that the file exists and - * verify attributes only if not 'e' or 'v'. */ if (is_partial_inst() != 0) { /* - * determine if the destination package is in an - * area inherited from the global zone - */ - - n = pkgMatchInherited(srcp, dstp, - get_inst_root(), ept->ainfo.mode, - ept->cinfo.modtime, ept->ftype, - ept->cinfo.cksum); - - echoDebug(DBG_INSTVOL_PARTIAL_INST, - srcp ? srcp : "", dstp ? dstp: "", - ((get_inst_root()) && - (strcmp(get_inst_root(), "/") != 0)) ? - get_inst_root() : "", - ept->ainfo.mode, ept->cinfo.modtime, - ept->ftype, ept->cinfo.cksum, n); - - /* * if not type 'e|v' and class 'none', then the * file must already exist. */ @@ -544,69 +510,14 @@ (strcmp(cl_nam(ept->pkg_class_idx), "none") == 0)) { - /* - * if the file is in a space inherited - * from the global zone, and if the - * contents or attributes are incorrect, - * then generate a warning that the - * global zone file contents and/or file - * attributes have been modified and - * that the modifications are extended - * to the non-global zone (inherited - * from the global zone). - */ + /* is file changed? */ + n = finalck(ept, 1, 1, B_TRUE); - if (n == 0) { - /* is file changed? */ - n = finalck(ept, 1, 1, B_TRUE); - - /* no - ok - continue */ - if (n == 0) { - continue; - } - + /* not - ok - warn */ + if (n != 0) { /* output warning message */ logerr(NOTE_INSTVOL_FINALCKFAIL, - pkginst, ext->map_path, - a_zoneName, ept->path); - continue; - } else if (!finalck(ept, 1, 1, - B_FALSE)) { - /* - * non-e/v file of class "none" - * not inherited from the global - * zone: verify file already - * exists:everything checks here - */ - mstat->attrchg = 0; - mstat->contchg = 0; - } - continue; - } - - /* - * non-e/v file with class action script, or - * e/v file: if the file is in an area inherited - * from the global zone, then no need (or the - * ability) to update just accept the file as is - */ - - if (n == B_TRUE) { - /* - * the object is in an area inherited - * from the global zone and the objects - * attributes are verified - */ - - mstat->attrchg = 0; - mstat->contchg = 0; - - /* NOTE: package object skipped */ - - if (skipped == (char *)NULL) { - skipped = dstp; - echoDebug(DBG_INSTVOL_OBJ_SKIPPED, - skipped); + pkginst, ext->map_path); } continue; } @@ -617,39 +528,29 @@ * mode and permission now in case installation halted. */ - if (z_path_is_inherited(dstp, ept->ftype, - get_inst_root()) == B_FALSE) { + /* + * If the filesystem is read-only don't attempt + * to copy a file. Just check that the content + * and attributes of the file are correct. + * + * Normally this doesn't happen, because files, + * which don't change, are not returned by + * domerg(). + */ + n = 0; + if (is_fs_writeable(ept->path, + &(ext->fsys_value))) + n = cppath(MODE_SET|DIR_DISPLAY, srcp, + dstp, ept->ainfo.mode); + if (n != 0) { + warnflag++; + } else if (!finalck(ept, 1, 1, B_FALSE)) { /* - * If the filesystem is read-only don't attempt - * to copy a file. Just check that the content - * and attributes of the file are correct. - * - * Normally this doesn't happen, because files, - * which don't change, are not returned by - * domerg(). However when installing a patch in - * a sparse zone, which was already installed - * in global zone with -G option, NGZ's - * contents db still contains the old record - * for this file and therefore domerg() - * considers these files to be different even - * though they are the same. + * everything checks here */ - n = 0; - if (is_fs_writeable(ept->path, - &(ext->fsys_value))) - n = cppath(MODE_SET|DIR_DISPLAY, srcp, - dstp, ept->ainfo.mode); - - if (n != 0) { - warnflag++; - } else if (!finalck(ept, 1, 1, B_FALSE)) { - /* - * everything checks here - */ - mstat->attrchg = 0; - mstat->contchg = 0; - } + mstat->attrchg = 0; + mstat->contchg = 0; } /* NOTE: a package object was updated */ @@ -680,34 +581,18 @@ (void) fclose(listfp); } - /* - * if the object associated with the class action script - * is in an area inherited from the global zone, then - * there is no need to run the class action script - - * assume that anything the script would do has already - * been done in the area shared from the global zone. - */ - - /* nothing updated, nothing skipped */ + /* nothing updated */ echoDebug(DBG_INSTVOL_CAS_INFO, is_partial_inst(), - updated ? updated : "", - skipped ? skipped : "", - anyPathLocal ? anyPathLocal : ""); + updated ? updated : ""); if ((is_partial_inst() != 0) && - (updated == (char *)NULL) && - (anyPathLocal == (char *)NULL)) { + (updated == (char *)NULL)) { /* * installing in non-global zone, and no object - * has been updated (installed/verified in non- - * inherited area), and no path delivered by the - * package is in an area not inherited from the - * global zone (all paths delivered are in - * areas inherited from the global zone): do not - * run the class action script because the only - * affected areas are inherited (read only). + * has been updated (installed/verified): + * do not run the class action script. */ echoDebug(DBG_INSTVOL_NOT_RUNNING_CAS, @@ -717,13 +602,6 @@ cl_nam(classidx), cl_iscript(classidx)); - if ((r_skipped != (char **)NULL) && - (*r_skipped == (char *)NULL) && - (skipped == (char *)NULL)) { - skipped = "postinstall"; - echoDebug(DBG_INSTVOL_OBJ_SKIPPED, - skipped); - } } else { /* run the class action script */ @@ -902,9 +780,8 @@ } /* - * if any package objects were updated (not inherited from the - * global zone or otherwise already in existence), set the updated - * flag as appropriate + * if any package objects were updated (not otherwise already in + * existence), set the updated flag as appropriate */ if (updated != (char *)NULL) { @@ -914,17 +791,6 @@ } } - /* - * if any package objects were skipped (verified inherited from the - * global zone), set the skipped flag as appropriate - */ - - if (skipped != (char *)NULL) { - echoDebug(DBG_INSTVOL_OBJ_SKIPPED, skipped); - if (r_skipped != (char **)NULL) { - *r_skipped = skipped; - } - } } /* @@ -959,33 +825,9 @@ * path for the next object from the package to process * char **r_updated - [RO, *RW] * - pointer to pointer to string - set if the last path - * returned exists or does not need updating and the - * object is NOT located in an area inherited from the - * global zone. This is used to determine if the last - * path object returned DOES exist in an area that is - * inherited from the global zone. If no paths are - * inherited from the global zone, this is always set - * when a path to be installed exists and has the - * correct contents. - * char **r_skipped - [RO, *RW] - * - pointer to pointer to string - set if the last path - * returned exists or does not need updating and the - * object IS located in an area inherited from the - * global zone. This is used to determine if the last - * path object returned does NOT exist in an area that - * is inherited from the global zone. If no paths are - * inherited from the global zone, this is never set. - * char **r_anyPathLocal - [RO, *RW] - * - pointer to pointer to string - set if any object - * belonging to the package is NOT located in an area - * inherited from the global zone. This is used to - * determine if the package references ANY objects that - * are NOT located in an area inherited from the global - * zone - regardless of whether or not they need to be - * updated (installed/copied). If no paths are inherited - * from the global zone, this is always set when a path - * to be installed already exists and has the correct - * contents. + * returned exists or does not need updating. This is + * always set when a path to be installed exists and + * has the correct contents. * Returns: int * != DMRG_DONE - index into extlist of the next path to * be processed - that needs to be installed/copied @@ -995,8 +837,7 @@ static int domerg(struct cfextra **extlist, int part, int nparts, int myclass, char **srcp, char **dstp, - char **r_updated, char **r_skipped, - char **r_anyPathLocal) + char **r_updated) { boolean_t stateFlag = B_FALSE; int i; @@ -1032,24 +873,6 @@ ept = &(extlist[i]->cf_ent); mstat = &(extlist[i]->mstat); - /* - * as paths are processed, if the "anyPathLocal" flag has not - * been set, if the object is not of type 'i' (package script), - * check to see if the object is in an area inherited from the - * global zone - if not, set "anyPathLocal" to the path found, - * indicating that at least one path is in an area that is not - * inherited from the global zone. - */ - - if ((r_anyPathLocal != (char **)NULL) && - (*r_anyPathLocal == (char *)NULL) && - (ept->ftype != 'i') && - (z_path_is_inherited(ept->path, ept->ftype, - get_inst_root()) == B_FALSE)) { - echoDebug(DBG_INSTVOL_OBJ_LOCAL, ept->path); - *r_anyPathLocal = ept->path; - } - /* if this isn't the class of current interest, skip it */ if (myclass != ept->pkg_class_idx) { @@ -1173,9 +996,7 @@ * If we can't get to it for legitimate reasons, * don't try to verify it. */ - if ((z_path_is_inherited(ept->path, ept->ftype, - get_inst_root())) || - is_remote_fs(ept->path, + if (is_remote_fs(ept->path, &(extlist[i]->fsys_value)) && !is_fs_writeable(ept->path, &(extlist[i]->fsys_value))) { @@ -1311,11 +1132,8 @@ } /* - * package object exists, or does not need updating: if the path - * is in an area inherited from the global zone, then treat - * the object as if it were "skipped" - if the path is not in an - * area inherited from the global zone, then treat the object as - * if it were "updated" + * package object exists, or does not need updating: + * treat the object as if it were "updated" */ /* LINTED warning: statement has no consequent: if */ @@ -1324,21 +1142,10 @@ * the object in question is a directory or special * file - the fact that this type of object already * exists or does not need updating must not trigger - * the object updated/object skipped indication - - * that would cause class action scripts to be run - * when installing a new non-global zone - that action - * must only be done when a file object that is in - * an area inherited from the global zone is present. + * the object updated indication - that would cause + * class action scripts to be run when installing a + * new non-global zone */ - } else if (z_path_is_inherited(ept->path, ept->ftype, - get_inst_root()) == B_TRUE) { - if (r_skipped != (char **)NULL) { - if (*r_skipped == (char *)NULL) { - echoDebug(DBG_INSTVOL_OBJ_SKIPPED, - ept->path); - *r_skipped = ept->path; - } - } } else { if (r_updated != (char **)NULL) { if (*r_updated == (char *)NULL) { @@ -1520,13 +1327,9 @@ &(extlist[idx]->fsys_value))) { flag = -1; } else { - boolean_t inheritedFlag; - inheritedFlag = - z_path_is_inherited(ept->path, - ept->ftype, get_inst_root()); flag = finalck(ept, mstat->attrchg, (ckflag ? mstat->contchg : - (-1)), inheritedFlag); + (-1)), B_FALSE); } pinfo = entry.cf_ent.pinfo; diff -r bcfc9c7baa2e -r 76969fc28795 usr/src/cmd/svr4pkg/pkginstall/main.c --- a/usr/src/cmd/svr4pkg/pkginstall/main.c Wed Jun 30 17:40:22 2010 +0800 +++ b/usr/src/cmd/svr4pkg/pkginstall/main.c Wed Jun 30 03:42:01 2010 -0700 @@ -215,11 +215,6 @@ #define TEXT_DOMAIN "SYS_TEST" #endif -/* This is the text for the "-O inherited-filesystem=" option */ - -#define INHERITFS "inherited-filesystem=" -#define INHERITFS_LEN ((sizeof (INHERITFS))-1) - /* This is the text for the "-O parent-zone-name=" option */ #define PARENTZONENAME "parent-zone-name=" @@ -257,7 +252,6 @@ char *p; char *prog_full_name = NULL; char *pt; - char *skipped = (char *)NULL; char *updated = (char *)NULL; char *vfstab_file = NULL; char *zoneName = (char *)NULL; @@ -600,19 +594,6 @@ continue; } - /* process inherited-filesystem= option */ - - if (strncmp(p, INHERITFS, INHERITFS_LEN) == 0) { - if (z_add_inherited_file_system( - p+INHERITFS_LEN) == B_FALSE) { - progerr(ERR_NOSUCH_INHERITED, - p+INHERITFS_LEN); - quit(1); - /* NOTREACHED */ - } - continue; - } - /* process preinstallcheck option */ if (strcmp(p, "preinstallcheck") == 0) { @@ -2165,8 +2146,7 @@ } instvol(extlist, srcinst, part, nparts, - pkgserver, &cfTmpVfp, &updated, - &skipped, zoneName); + pkgserver, &cfTmpVfp, &updated, zoneName); if (part++ >= nparts) { break; @@ -2198,7 +2178,6 @@ echoDebug(DBG_PKGINSTALL_INSDONE, is_depend_pkginfo_DB(), is_depend_pkginfo_DB(), saveSpoolInstall, updated ? updated : "", - skipped ? skipped : "", script ? script : "", script ? access(script, F_OK) : -1); @@ -2214,16 +2193,13 @@ } else if (is_depend_pkginfo_DB()) { echoDebug(DBG_PKGINSTALL_POIS_DBUPD, pkginst, script, zoneName ? zoneName : "global"); - } else if ((saveSpoolInstall != 0) && (updated == (char *)NULL) && - (skipped != (char *)NULL)) { + } else if ((saveSpoolInstall != 0) && (updated == (char *)NULL)) { /* * fresh installing into non-global zone, no object was - * updated (installed/verified in non-inherited area), - * and and at least one object was skipped (verified in - * inherited area) - this means all objects were skipped - * so do not run the postinstall script. + * updated (installed/verified in area), so do not run + * the postinstall script. */ - echoDebug(DBG_PKGINSTALL_POIS_SKIPPING, + echoDebug(DBG_PKGINSTALL_POIS_NOUPDATING, zoneName ? zoneName : "global", pkginst, script); } else { /* script present and ok to run: run the script */ diff -r bcfc9c7baa2e -r 76969fc28795 usr/src/cmd/svr4pkg/pkginstall/pkginstall.h --- a/usr/src/cmd/svr4pkg/pkginstall/pkginstall.h Wed Jun 30 17:40:22 2010 +0800 +++ b/usr/src/cmd/svr4pkg/pkginstall/pkginstall.h Wed Jun 30 03:42:01 2010 -0700 @@ -20,8 +20,7 @@ */ /* - * Copyright 2009 Sun Microsystems, Inc. All rights reserved. - * Use is subject to license terms. + * Copyright (c) 1994, 2010, Oracle and/or its affiliates. All rights reserved. */ #ifndef __PKG_PKGINSTALL_H__ @@ -68,8 +67,7 @@ extern int pkgenv __P((char *pkginst, char *p_pkginfo, char *p_pkgmap)); extern void instvol __P((struct cfextra **extlist, char *srcinst, int part, int nparts, PKGserver server, VFP_T **a_cfTmpVfp, - char **r_updated, char **r_skipped, - char *a_zoneName)); + char **r_updated, char *a_zoneName)); extern int reqexec __P((int update, char *script, int non_abi_scripts, boolean_t enable_root_user)); extern int chkexec __P((int update, char *script)); diff -r bcfc9c7baa2e -r 76969fc28795 usr/src/cmd/svr4pkg/pkgremove/main.c --- a/usr/src/cmd/svr4pkg/pkgremove/main.c Wed Jun 30 17:40:22 2010 +0800 +++ b/usr/src/cmd/svr4pkg/pkgremove/main.c Wed Jun 30 03:42:01 2010 -0700 @@ -20,8 +20,7 @@ */ /* - * Copyright 2009 Sun Microsystems, Inc. All rights reserved. - * Use is subject to license terms. + * Copyright (c) 1989, 2010, Oracle and/or its affiliates. All rights reserved. */ /* Copyright (c) 1984, 1986, 1987, 1988, 1989 AT&T */ @@ -89,11 +88,6 @@ #define TEXT_DOMAIN "SYS_TEST" #endif -/* This is the text for the "-O inherited-filesystem=" option */ - -#define INHERITFS "inherited-filesystem=" -#define INHERITFS_LEN ((sizeof (INHERITFS))-1) - /* This is the text for the "-O parent-zone-name=" option */ #define PARENTZONENAME "parent-zone-name=" @@ -359,19 +353,6 @@ continue; } - /* process inherited-filesystem= option */ - - if (strncmp(p, INHERITFS, INHERITFS_LEN) == 0) { - if (z_add_inherited_file_system( - p+INHERITFS_LEN) == B_FALSE) { - progerr(ERR_NOSUCH_INHERITED, - p+INHERITFS_LEN); - quit(1); - /* NOTREACHED */ - } - continue; - } - /* process preremovecheck option */ if (strcmp(p, "preremovecheck") == 0) { @@ -973,8 +954,6 @@ * Run a preremove script if one is provided by the package. * Don't execute preremove script if only updating the DB. * Don't execute preremove script if files are not being deleted. - * Don't execute preremove script if one or more files reside in - * an inherited FS. */ /* update the lock - at the preremove script */ @@ -1261,14 +1240,6 @@ * requested through the "-f" option. */ echo(MSG_SERVER, ept->path); - } else if (z_path_is_inherited(ept->path, ept->ftype, - get_inst_root())) { - /* - * object is in an area inherited from the global zone, - * and the object cannot be removed - output a message - * indicating the object cannot be removed and continue. - */ - echo(MSG_NOTREMOVED_INHERITED, ept->path); } else if (script[0]) { /* * If there's a class action script, just put the diff -r bcfc9c7baa2e -r 76969fc28795 usr/src/cmd/svr4pkg/pkgrm/main.c --- a/usr/src/cmd/svr4pkg/pkgrm/main.c Wed Jun 30 17:40:22 2010 +0800 +++ b/usr/src/cmd/svr4pkg/pkgrm/main.c Wed Jun 30 03:42:01 2010 -0700 @@ -20,8 +20,7 @@ */ /* - * Copyright 2009 Sun Microsystems, Inc. All rights reserved. - * Use is subject to license terms. + * Copyright (c) 1989, 2010, Oracle and/or its affiliates. All rights reserved. */ /* Copyright (c) 1984, 1986, 1987, 1988, 1989 AT&T */ @@ -169,9 +168,6 @@ #define TEXT_DOMAIN "SYS_TEST" #endif -#define INHERITFS "inherited-filesystem=" -#define INHERITFS_LEN ((sizeof (INHERITFS))-1) - /* * forward declarations */ @@ -185,13 +181,11 @@ int a_longestPkg, char *a_adminFile, char *a_zoneAdminFile, zoneList_t zlst); static int pkgRemove(int a_nodelete, char *a_altBinDir, - char *a_adminFile, char **a_inheritedPkgDirs); -static int pkgZoneCheckRemove(char *a_zoneName, - char **a_inheritedPkgDirs, char *a_altBinDir, + char *a_adminFile); +static int pkgZoneCheckRemove(char *a_zoneName, char *a_altBinDir, char *a_adminFile, char *a_stdoutPath, zone_state_t a_zoneState, boolean_t tmpzone); -static int pkgZoneRemove(char *a_zoneName, - char **a_inheritedPkgDirs, int a_nodelete, +static int pkgZoneRemove(char *a_zoneName, int a_nodelete, char *a_altBinDir, char *a_adminFile, zone_state_t a_zoneState, boolean_t tmpzone); static void resetreturn(); @@ -382,9 +376,6 @@ * ---> enable debugging output * -> nozones * ---> act as though in global zone with no non-global zones - * -> inherited-filesystems - * ---> add specified file system to list of file systems - * ---> that are inherited from the global zone * -> enable-hollow-package-support * --> Enable hollow package support. When specified, for any * --> package that has SUNW_PKG_HOLLOW=true: @@ -407,17 +398,6 @@ continue; } - if (strncmp(p, INHERITFS, INHERITFS_LEN) == 0) { - if (z_add_inherited_file_system( - p+INHERITFS_LEN) == B_FALSE) { - progerr(ERR_NOSUCH_INHERITED, - p+INHERITFS_LEN); - quit(1); - /* NOTREACHED */ - } - continue; - } - if (strcmp(p, "enable-hollow-package-support") == 0) { set_depend_pkginfo_DB(B_TRUE); @@ -868,7 +848,6 @@ char *a_zoneAdminFile, zoneList_t a_zlst) { boolean_t b; - char **inheritedPkgDirs; char *zoneName; char ans[MAX_INPUT]; int n; @@ -1007,19 +986,14 @@ echo(MSG_REMOVE_PKG_FROM_ZONE, pkginst, zoneName); echoDebug(DBG_REMOVE_PKG_FROM_ZONE, pkginst, zoneName); - /* determine list of directories inherited from global zone */ - - inheritedPkgDirs = z_zlist_get_inherited_pkg_dirs(a_zlst, - zoneIndex); - /* * remove package from zone; use the zone admin file which * suppresses all checks. */ n = pkgZoneRemove(z_zlist_get_scratch(a_zlst, zoneIndex), - inheritedPkgDirs, a_nodelete, a_altBinDir, - a_zoneAdminFile, zst, B_FALSE); + a_nodelete, a_altBinDir, a_zoneAdminFile, + zst, B_FALSE); /* set success/fail condition variables */ @@ -1073,21 +1047,14 @@ echo(MSG_REMOVE_PKG_FROM_ZONE, pkginst, zoneName); - /* determine list of dirs inherited from global zone */ - - inheritedPkgDirs = - z_zlist_get_inherited_pkg_dirs(a_zlst, - zoneIndex); - /* * remove package from zone; use the zone admin file * which suppresses all checks. */ n = pkgZoneRemove(z_zlist_get_scratch(a_zlst, - zoneIndex), inheritedPkgDirs, - a_nodelete, a_altBinDir, a_zoneAdminFile, - ZONE_STATE_MOUNTED, B_TRUE); + zoneIndex), a_nodelete, a_altBinDir, + a_zoneAdminFile, ZONE_STATE_MOUNTED, B_TRUE); /* set success/fail condition variables */ @@ -1118,8 +1085,7 @@ * call pkgremove for this package for the global zone; * use the admin file passed in by the user via -a. */ - n = pkgRemove(a_nodelete, a_altBinDir, a_adminFile, - z_get_inherited_file_systems()); + n = pkgRemove(a_nodelete, a_altBinDir, a_adminFile); /* set success/fail condition variables */ ckreturn(n); @@ -1213,9 +1179,8 @@ } static int -pkgZoneCheckRemove(char *a_zoneName, char **a_inheritedPkgDirs, - char *a_altBinDir, char *a_adminFile, char *a_stdoutPath, - zone_state_t a_zoneState, boolean_t tmpzone) +pkgZoneCheckRemove(char *a_zoneName, char *a_altBinDir, char *a_adminFile, + char *a_stdoutPath, zone_state_t a_zoneState, boolean_t tmpzone) { char *arg[MAXARGS]; char *p; @@ -1353,19 +1318,6 @@ arg[nargs++] = "-O"; arg[nargs++] = "addzonename"; - /* add all inherited file systems */ - - if (a_inheritedPkgDirs != (char **)NULL) { - for (n = 0; a_inheritedPkgDirs[n] != (char *)NULL; n++) { - char ifs[MAXPATHLEN+22]; - (void) snprintf(ifs, sizeof (ifs), - "inherited-filesystem=%s", - a_inheritedPkgDirs[n]); - arg[nargs++] = "-O"; - arg[nargs++] = strdup(ifs); - } - } - /* * add parent zone info/type */ @@ -1450,9 +1402,8 @@ } static int -pkgZoneRemove(char *a_zoneName, char **a_inheritedPkgDirs, - int a_nodelete, char *a_altBinDir, char *a_adminFile, - zone_state_t a_zoneState, boolean_t tmpzone) +pkgZoneRemove(char *a_zoneName, int a_nodelete, char *a_altBinDir, + char *a_adminFile, zone_state_t a_zoneState, boolean_t tmpzone) { char *arg[MAXARGS]; char *p; @@ -1593,20 +1544,6 @@ arg[nargs++] = "-O"; arg[nargs++] = "addzonename"; - /* add all inherited file systems */ - - if (a_inheritedPkgDirs != (char **)NULL) { - for (n = 0; a_inheritedPkgDirs[n] != (char *)NULL; n++) { - char ifs[MAXPATHLEN+22]; - - (void) snprintf(ifs, sizeof (ifs), - "inherited-filesystem=%s", - a_inheritedPkgDirs[n]); - arg[nargs++] = "-O"; - arg[nargs++] = strdup(ifs); - } - } - /* * add parent zone info/type */ @@ -1704,9 +1641,6 @@ * a_adminFile - pointer to string representing the admin * file to pass to pkgremove when removing the package. * If this is == NULL no admin file is given to pkgremove. - * a_inheritedPkgDirs - pointer to array of strings, each one - * representing the non-global zones full path of a - * directory that is inherited from the global zone. * Returns: int (see ckreturn() function for details) * 0 - success * 1 - package operation failed (fatal error) @@ -1719,8 +1653,7 @@ */ static int -pkgRemove(int a_nodelete, char *a_altBinDir, char *a_adminFile, - char **a_inheritedPkgDirs) +pkgRemove(int a_nodelete, char *a_altBinDir, char *a_adminFile) { char *arg[MAXARGS]; char *p; @@ -1832,19 +1765,6 @@ arg[nargs++] = "-F"; } - /* add all inherited file systems */ - - if (a_inheritedPkgDirs != (char **)NULL) { - for (n = 0; a_inheritedPkgDirs[n] != (char *)NULL; n++) { - char ifs[MAXPATHLEN+22]; - (void) snprintf(ifs, sizeof (ifs), - "inherited-filesystem=%s", - a_inheritedPkgDirs[n]); - arg[nargs++] = "-O"; - arg[nargs++] = strdup(ifs); - } - } - /* * add parent zone info/type */ @@ -1963,7 +1883,6 @@ static char *zoneAdminFile = (char *)NULL; boolean_t b; - char **inheritedPkgDirs; char *zoneName; char *scratchName; char preremovecheckPath[PATH_MAX+1]; @@ -2061,20 +1980,14 @@ "%s/%s.%s.preremovecheck.txt", zoneTempDir, pkginst, scratchName); - /* determine list of dirs inherited from global zone */ - - inheritedPkgDirs = - z_zlist_get_inherited_pkg_dirs(a_zlst, - zoneIndex); - /* * dependency check this package this zone; use the * user supplied admin file so that the appropriate * level of dependency checking is (or is not) done. */ - n = pkgZoneCheckRemove(scratchName, inheritedPkgDirs, - a_altBinDir, admnfile, preremovecheckPath, + n = pkgZoneCheckRemove(scratchName, a_altBinDir, + admnfile, preremovecheckPath, zst, B_FALSE); /* set success/fail condition variables */ @@ -2142,20 +2055,14 @@ "%s/%s.%s.preremovecheck.txt", zoneTempDir, pkginst, scratchName); - /* determine list of dirs inherited from global zone */ - - inheritedPkgDirs = - z_zlist_get_inherited_pkg_dirs(a_zlst, - zoneIndex); - /* * dependency check this package this zone; use the * user supplied admin file so that the appropriate * level of dependency checking is (or is not) done. */ - n = pkgZoneCheckRemove(scratchName, inheritedPkgDirs, - a_altBinDir, admnfile, preremovecheckPath, + n = pkgZoneCheckRemove(scratchName, a_altBinDir, + admnfile, preremovecheckPath, ZONE_STATE_MOUNTED, B_TRUE); /* set success/fail condition variables */ diff -r bcfc9c7baa2e -r 76969fc28795 usr/src/cmd/zoneadm/zoneadm.c --- a/usr/src/cmd/zoneadm/zoneadm.c Wed Jun 30 17:40:22 2010 +0800 +++ b/usr/src/cmd/zoneadm/zoneadm.c Wed Jun 30 03:42:01 2010 -0700 @@ -2076,58 +2076,6 @@ return (Z_OK); } -static int -verify_ipd(zone_dochandle_t handle) -{ - int return_code = Z_OK; - struct zone_fstab fstab; - struct stat st; - char specdir[MAXPATHLEN]; - - if (zonecfg_setipdent(handle) != Z_OK) { - /* - * TRANSLATION_NOTE - * inherit-pkg-dirs is a literal that should not be translated. - */ - (void) fprintf(stderr, gettext("could not verify " - "inherit-pkg-dirs: unable to enumerate mounts\n")); - return (Z_ERR); - } - while (zonecfg_getipdent(handle, &fstab) == Z_OK) { - /* - * Verify fs_dir exists. - */ - (void) snprintf(specdir, sizeof (specdir), "%s%s", - zonecfg_get_root(), fstab.zone_fs_dir); - if (stat(specdir, &st) != 0) { - /* - * TRANSLATION_NOTE - * inherit-pkg-dir is a literal that should not be - * translated. - */ - (void) fprintf(stderr, gettext("could not verify " - "inherit-pkg-dir %s: %s\n"), - fstab.zone_fs_dir, strerror(errno)); - return_code = Z_ERR; - } - if (strcmp(st.st_fstype, MNTTYPE_NFS) == 0) { - /* - * TRANSLATION_NOTE - * inherit-pkg-dir and NFS are literals that should - * not be translated. - */ - (void) fprintf(stderr, gettext("cannot verify " - "inherit-pkg-dir %s: NFS mounted file system.\n" - "\tA local file system must be used.\n"), - fstab.zone_fs_dir); - return_code = Z_ERR; - } - } - (void) zonecfg_endipdent(handle); - - return (return_code); -} - /* * Verify that the special device/file system exists and is valid. */ @@ -2190,10 +2138,6 @@ struct stat st; /* - * No need to verify inherit-pkg-dir fs types, as their type is - * implicitly lofs, which is known. Therefore, the types are only - * verified for regular file systems below. - * * Since the actual mount point is not known until the dependent mounts * are performed, we don't attempt any path validation here: that will * happen later when zoneadmd actually does the mounts. @@ -2702,8 +2646,6 @@ if (verify_filesystems(handle) != Z_OK) return_code = Z_ERR; - if (verify_ipd(handle) != Z_OK) - return_code = Z_ERR; if (!in_alt_root && verify_rctls(handle) != Z_OK) return_code = Z_ERR; if (!in_alt_root && verify_pool(handle) != Z_OK) @@ -3063,95 +3005,6 @@ return ((err == Z_OK) ? Z_OK : Z_ERR); } -/* - * Check that the inherited pkg dirs are the same for the clone and its source. - * The easiest way to do that is check that the list of ipds is the same - * by matching each one against the other. This algorithm should be fine since - * the list of ipds should not be that long. - */ -static int -valid_ipd_clone(zone_dochandle_t s_handle, char *source_zone, - zone_dochandle_t t_handle, char *target_zone) -{ - int err; - int res = Z_OK; - int s_cnt = 0; - int t_cnt = 0; - struct zone_fstab s_fstab; - struct zone_fstab t_fstab; - - /* - * First check the source of the clone against the target. - */ - if ((err = zonecfg_setipdent(s_handle)) != Z_OK) { - errno = err; - zperror2(source_zone, gettext("could not enumerate " - "inherit-pkg-dirs")); - return (Z_ERR); - } - - while (zonecfg_getipdent(s_handle, &s_fstab) == Z_OK) { - boolean_t match = B_FALSE; - - s_cnt++; - - if ((err = zonecfg_setipdent(t_handle)) != Z_OK) { - errno = err; - zperror2(target_zone, gettext("could not enumerate " - "inherit-pkg-dirs")); - (void) zonecfg_endipdent(s_handle); - return (Z_ERR); - } - - while (zonecfg_getipdent(t_handle, &t_fstab) == Z_OK) { - if (strcmp(s_fstab.zone_fs_dir, t_fstab.zone_fs_dir) - == 0) { - match = B_TRUE; - break; - } - } - (void) zonecfg_endipdent(t_handle); - - if (!match) { - (void) fprintf(stderr, gettext("inherit-pkg-dir " - "'%s' is not configured in zone %s.\n"), - s_fstab.zone_fs_dir, target_zone); - res = Z_ERR; - } - } - - (void) zonecfg_endipdent(s_handle); - - /* skip the next check if we already have errors */ - if (res == Z_ERR) - return (res); - - /* - * Now check the number of ipds in the target so we can verify - * that the source is not a subset of the target. - */ - if ((err = zonecfg_setipdent(t_handle)) != Z_OK) { - errno = err; - zperror2(target_zone, gettext("could not enumerate " - "inherit-pkg-dirs")); - return (Z_ERR); - } - - while (zonecfg_getipdent(t_handle, &t_fstab) == Z_OK) - t_cnt++; - - (void) zonecfg_endipdent(t_handle); - - if (t_cnt != s_cnt) { - (void) fprintf(stderr, gettext("Zone %s is configured " - "with inherit-pkg-dirs that are not configured in zone " - "%s.\n"), target_zone, source_zone); - res = Z_ERR; - } - - return (res); -} - static void warn_dev_match(zone_dochandle_t s_handle, char *source_zone, zone_dochandle_t t_handle, char *target_zone) @@ -3477,9 +3330,6 @@ if (err != Z_OK) goto done; - /* verify new zone has same inherit-pkg-dirs */ - err = valid_ipd_clone(s_handle, source_zone, t_handle, target_zone); - /* warn about imported fs's which are the same */ warn_fs_match(s_handle, source_zone, t_handle, target_zone); diff -r bcfc9c7baa2e -r 76969fc28795 usr/src/cmd/zoneadmd/vplat.c --- a/usr/src/cmd/zoneadmd/vplat.c Wed Jun 30 17:40:22 2010 +0800 +++ b/usr/src/cmd/zoneadmd/vplat.c Wed Jun 30 03:42:01 2010 -0700 @@ -123,7 +123,7 @@ #define V4_ADDR_LEN 32 #define V6_ADDR_LEN 128 -#define IPD_DEFAULT_OPTS \ +#define RESOURCE_DEFAULT_OPTS \ MNTOPT_RO "," MNTOPT_LOFS_NOSUB "," MNTOPT_NODEVICES #define DFSTYPES "/etc/dfs/fstypes" @@ -396,8 +396,8 @@ fsptr->zone_fs_raw[0] = '\0'; /* - * Discard all but one of the original options and set that to be the - * same set of options used for inherit package directory resources. + * Discard all but one of the original options and set that to our + * default set of options used for resources. */ optptr = fsptr->zone_fs_options; if (optptr == NULL) { @@ -413,7 +413,7 @@ free(onext); } } - (void) strcpy(optptr->zone_fsopt_opt, IPD_DEFAULT_OPTS); + (void) strcpy(optptr->zone_fsopt_opt, RESOURCE_DEFAULT_OPTS); optptr->zone_fsopt_next = NULL; fsptr->zone_fs_options = optptr; return (0); @@ -969,19 +969,10 @@ * It must be a non-null string that starts with a '/'. */ if (dir[0] != '/') { - if (spec[0] == '\0') { - /* - * This must be an invalid ipd entry (see comments - * in mount_filesystems_ipdent()). - */ - zerror(zlogp, B_FALSE, - "invalid inherit-pkg-dir entry: \"%s\"", dir); - } else { - /* Something went wrong. */ - zerror(zlogp, B_FALSE, "invalid mount directory, " - "type: \"%s\", special: \"%s\", dir: \"%s\"", - fstype, spec, dir); - } + /* Something went wrong. */ + zerror(zlogp, B_FALSE, "invalid mount directory, " + "type: \"%s\", special: \"%s\", dir: \"%s\"", + fstype, spec, dir); return (-1); } @@ -1174,7 +1165,6 @@ zone_mnt_t mount_cmd) { char path[MAXPATHLEN]; - char specpath[MAXPATHLEN]; char optstr[MAX_MNTOPT_STR]; zone_fsopt_t *optptr; int rv; @@ -1213,30 +1203,6 @@ (void) snprintf(path, sizeof (path), "%s%s", rootpath, fsptr->zone_fs_dir); - if (strlen(fsptr->zone_fs_special) == 0) { - /* - * A zero-length special is how we distinguish IPDs from - * general-purpose FSs. Make sure it mounts from a place that - * can be seen via the alternate zone's root. - */ - if (snprintf(specpath, sizeof (specpath), "%s%s", - zonecfg_get_root(), fsptr->zone_fs_dir) >= - sizeof (specpath)) { - zerror(zlogp, B_FALSE, "cannot mount %s: path too " - "long in alternate root", fsptr->zone_fs_dir); - return (-1); - } - if (zonecfg_in_alt_root()) - resolve_lofs(zlogp, specpath, sizeof (specpath)); - if (domount(zlogp, MNTTYPE_LOFS, IPD_DEFAULT_OPTS, - specpath, path) != 0) { - zerror(zlogp, B_TRUE, "failed to loopback mount %s", - specpath); - return (-1); - } - return (0); - } - /* * In general the strategy here is to do just as much verification as * necessary to avoid crashing or otherwise doing something bad; if the @@ -1410,7 +1376,7 @@ zerror(zlogp, B_TRUE, "cannot create %s", tmp); return (B_FALSE); } - if (domount(zlogp, MNTTYPE_LOFS, IPD_DEFAULT_OPTS, fromdir, + if (domount(zlogp, MNTTYPE_LOFS, RESOURCE_DEFAULT_OPTS, fromdir, tmp) != 0) { zerror(zlogp, B_TRUE, "cannot mount %s on %s", tmp, fromdir); @@ -1517,7 +1483,7 @@ if (!S_ISDIR(st.st_mode)) continue; } - if (domount(zlogp, MNTTYPE_LOFS, IPD_DEFAULT_OPTS, *cpp, + if (domount(zlogp, MNTTYPE_LOFS, RESOURCE_DEFAULT_OPTS, *cpp, tmp) != 0) { zerror(zlogp, B_TRUE, "cannot mount %s on %s", tmp, *cpp); @@ -1608,50 +1574,6 @@ } static int -mount_filesystems_ipdent(zone_dochandle_t handle, zlog_t *zlogp, - struct zone_fstab **fs_tabp, int *num_fsp) -{ - struct zone_fstab *tmp_ptr, *fs_ptr, *fsp, fstab; - int num_fs; - - num_fs = *num_fsp; - fs_ptr = *fs_tabp; - - if (zonecfg_setipdent(handle) != Z_OK) { - zerror(zlogp, B_FALSE, "invalid configuration"); - return (-1); - } - while (zonecfg_getipdent(handle, &fstab) == Z_OK) { - num_fs++; - if ((tmp_ptr = realloc(fs_ptr, - num_fs * sizeof (*tmp_ptr))) == NULL) { - zerror(zlogp, B_TRUE, "memory allocation failed"); - (void) zonecfg_endipdent(handle); - return (-1); - } - - /* update the pointers passed in */ - *fs_tabp = tmp_ptr; - *num_fsp = num_fs; - - /* - * IPDs logically only have a mount point; all other properties - * are implied. - */ - fs_ptr = tmp_ptr; - fsp = &fs_ptr[num_fs - 1]; - (void) strlcpy(fsp->zone_fs_dir, - fstab.zone_fs_dir, sizeof (fsp->zone_fs_dir)); - fsp->zone_fs_special[0] = '\0'; - fsp->zone_fs_raw[0] = '\0'; - fsp->zone_fs_type[0] = '\0'; - fsp->zone_fs_options = NULL; - } - (void) zonecfg_endipdent(handle); - return (0); -} - -static int mount_filesystems_fsent(zone_dochandle_t handle, zlog_t *zlogp, struct zone_fstab **fs_tabp, int *num_fsp, zone_mnt_t mount_cmd) { @@ -1795,14 +1717,11 @@ brand_close(bh); /* - * Iterate through the rest of the filesystems, first the IPDs, then - * the general FSs. Sort them all, then mount them in sorted order. - * This is to make sure the higher level directories (e.g., /usr) - * get mounted before any beneath them (e.g., /usr/local). + * Iterate through the rest of the filesystems. Sort them all, + * then mount them in sorted order. This is to make sure the + * higher level directories (e.g., /usr) get mounted before + * any beneath them (e.g., /usr/local). */ - if (mount_filesystems_ipdent(handle, zlogp, &fs_ptr, &num_fs) != 0) - goto bad; - if (mount_filesystems_fsent(handle, zlogp, &fs_ptr, &num_fs, mount_cmd) != 0) goto bad; diff -r bcfc9c7baa2e -r 76969fc28795 usr/src/cmd/zonecfg/zonecfg.c --- a/usr/src/cmd/zonecfg/zonecfg.c Wed Jun 30 17:40:22 2010 +0800 +++ b/usr/src/cmd/zonecfg/zonecfg.c Wed Jun 30 03:42:01 2010 -0700 @@ -161,7 +161,6 @@ "autoboot", "pool", "fs", - "inherit-pkg-dir", "net", "device", "rctl", @@ -270,7 +269,6 @@ static const char *add_cmds[] = { "add fs", - "add inherit-pkg-dir", "add net", "add device", "add rctl", @@ -302,7 +300,6 @@ static const char *remove_cmds[] = { "remove fs ", - "remove inherit-pkg-dir ", "remove net ", "remove device ", "remove rctl ", @@ -317,7 +314,6 @@ static const char *select_cmds[] = { "select fs ", - "select inherit-pkg-dir ", "select net ", "select device ", "select rctl ", @@ -354,7 +350,6 @@ static const char *info_cmds[] = { "info fs ", - "info inherit-pkg-dir ", "info net ", "info device ", "info rctl ", @@ -413,16 +408,6 @@ NULL }; -static const char *ipd_res_scope_cmds[] = { - "cancel", - "end", - "exit", - "help", - "info", - "set dir=", - NULL -}; - static const char *device_res_scope_cmds[] = { "cancel", "end", @@ -574,7 +559,6 @@ * select_func() and filled in by add_property() or set_func(). */ static struct zone_fstab old_fstab, in_progress_fstab; -static struct zone_fstab old_ipdtab, in_progress_ipdtab; static struct zone_nwiftab old_nwiftab, in_progress_nwiftab; static struct zone_devtab old_devtab, in_progress_devtab; static struct zone_rctltab old_rctltab, in_progress_rctltab; @@ -642,8 +626,6 @@ switch (resource_scope) { case RT_FS: return (add_stuff(cpl, line, fs_res_scope_cmds, word_end)); - case RT_IPD: - return (add_stuff(cpl, line, ipd_res_scope_cmds, word_end)); case RT_NET: return (add_stuff(cpl, line, net_res_scope_cmds, word_end)); case RT_DEVICE: @@ -986,15 +968,6 @@ /*CSTYLED*/ "such as \"%s=5\".\n"), MNTOPT_RETRY); break; - case RT_IPD: - (void) fprintf(fp, gettext("The '%s' resource scope is " - "used to configure a directory\ninherited from the " - "global zone into a non-global zone in read-only " - "mode.\n"), rt_to_str(resource_scope)); - (void) fprintf(fp, gettext("Valid commands:\n")); - (void) fprintf(fp, "\t%s %s=%s\n", cmd_to_str(CMD_SET), - pt_to_str(PT_DIR), gettext("")); - break; case RT_NET: (void) fprintf(fp, gettext("The '%s' resource scope is " "used to configure a network interface.\n"), @@ -1195,10 +1168,10 @@ gettext(" := [A-Za-z0-9][A-Za-z0-9-.]*\n")); } if (flags & HELP_RESOURCES) { - (void) fprintf(fp, "<%s> := %s | %s | %s | %s | %s | %s |\n\t" + (void) fprintf(fp, "<%s> := %s | %s | %s | %s | %s |\n\t" "%s | %s | %s | %s | %s\n\n", gettext("resource type"), rt_to_str(RT_FS), - rt_to_str(RT_IPD), rt_to_str(RT_NET), rt_to_str(RT_DEVICE), + rt_to_str(RT_NET), rt_to_str(RT_DEVICE), rt_to_str(RT_RCTL), rt_to_str(RT_ATTR), rt_to_str(RT_DATASET), rt_to_str(RT_DCPU), rt_to_str(RT_PCAP), rt_to_str(RT_MCAP), @@ -1247,8 +1220,6 @@ rt_to_str(RT_FS), pt_to_str(PT_DIR), pt_to_str(PT_SPECIAL), pt_to_str(PT_RAW), pt_to_str(PT_TYPE), pt_to_str(PT_OPTIONS)); - (void) fprintf(fp, "\t%s\t%s\n", rt_to_str(RT_IPD), - pt_to_str(PT_DIR)); (void) fprintf(fp, "\t%s\t\t%s, %s, %s\n", rt_to_str(RT_NET), pt_to_str(PT_ADDRESS), pt_to_str(PT_PHYSICAL), pt_to_str(PT_DEFROUTER)); @@ -1834,18 +1805,6 @@ pt_to_str(PT_FS_ALLOWED), fsallowedp); } - if ((err = zonecfg_setipdent(handle)) != Z_OK) { - zone_perror(zone, err, B_FALSE); - goto done; - } - while (zonecfg_getipdent(handle, &fstab) == Z_OK) { - (void) fprintf(of, "%s %s\n", cmd_to_str(CMD_ADD), - rt_to_str(RT_IPD)); - export_prop(of, PT_DIR, fstab.zone_fs_dir); - (void) fprintf(of, "%s\n", cmd_to_str(CMD_END)); - } - (void) zonecfg_endipdent(handle); - if ((err = zonecfg_setfsent(handle)) != Z_OK) { zone_perror(zone, err, B_FALSE); goto done; @@ -2086,15 +2045,6 @@ case RT_FS: bzero(&in_progress_fstab, sizeof (in_progress_fstab)); return; - case RT_IPD: - if (state_atleast(ZONE_STATE_INSTALLED)) { - zerr(gettext("Zone %s already installed; %s %s not " - "allowed."), zone, cmd_to_str(CMD_ADD), - rt_to_str(RT_IPD)); - goto bad; - } - bzero(&in_progress_ipdtab, sizeof (in_progress_ipdtab)); - return; case RT_NET: bzero(&in_progress_nwiftab, sizeof (in_progress_nwiftab)); return; @@ -2393,7 +2343,7 @@ static boolean_t gz_invalid_resource(int type) { - return (global_zone && (type == RT_FS || type == RT_IPD || + return (global_zone && (type == RT_FS || type == RT_NET || type == RT_DEVICE || type == RT_ATTR || type == RT_DATASET)); } @@ -2629,39 +2579,6 @@ } static int -fill_in_ipdtab(cmd_t *cmd, struct zone_fstab *ipdtab, boolean_t fill_in_only) -{ - int err, i; - property_value_ptr_t pp; - - if ((err = initialize(B_TRUE)) != Z_OK) - return (err); - - bzero(ipdtab, sizeof (*ipdtab)); - for (i = 0; i < cmd->cmd_prop_nv_pairs; i++) { - pp = cmd->cmd_property_ptr[i]; - if (pp->pv_type != PROP_VAL_SIMPLE || pp->pv_simple == NULL) { - zerr(gettext("A simple value was expected here.")); - saw_error = B_TRUE; - return (Z_INSUFFICIENT_SPEC); - } - switch (cmd->cmd_prop_name[i]) { - case PT_DIR: - (void) strlcpy(ipdtab->zone_fs_dir, pp->pv_simple, - sizeof (ipdtab->zone_fs_dir)); - break; - default: - zone_perror(pt_to_str(cmd->cmd_prop_name[i]), - Z_NO_PROPERTY_TYPE, B_TRUE); - return (Z_INSUFFICIENT_SPEC); - } - } - if (fill_in_only) - return (Z_OK); - return (zonecfg_lookup_ipd(handle, ipdtab)); -} - -static int fill_in_nwiftab(cmd_t *cmd, struct zone_nwiftab *nwiftab, boolean_t fill_in_only) { @@ -3001,46 +2918,6 @@ } static void -remove_ipd(cmd_t *cmd) -{ - int err; - - if (state_atleast(ZONE_STATE_INSTALLED)) { - zerr(gettext("Zone %s already installed; %s %s not allowed."), - zone, cmd_to_str(CMD_REMOVE), rt_to_str(RT_IPD)); - return; - } - - /* traditional, qualified ipd removal */ - if (cmd->cmd_prop_nv_pairs > 0) { - struct zone_fstab fstab; - - if ((err = fill_in_ipdtab(cmd, &fstab, B_FALSE)) != Z_OK) { - z_cmd_rt_perror(CMD_REMOVE, RT_IPD, err, B_TRUE); - return; - } - if ((err = zonecfg_delete_ipd(handle, &fstab)) != Z_OK) - z_cmd_rt_perror(CMD_REMOVE, RT_IPD, err, B_TRUE); - else - need_to_commit = B_TRUE; - return; - } - - /* - * unqualified ipd removal. remove all ipds but prompt if more - * than one. - */ - if (!prompt_remove_resource(cmd, "inherit-pkg-dir")) - return; - - if ((err = zonecfg_del_all_resources(handle, "inherit-pkg-dir")) - != Z_OK) - z_cmd_rt_perror(CMD_REMOVE, RT_IPD, err, B_TRUE); - else - need_to_commit = B_TRUE; -} - -static void remove_net(cmd_t *cmd) { int err; @@ -3368,9 +3245,6 @@ case RT_FS: remove_fs(cmd); return; - case RT_IPD: - remove_ipd(cmd); - return; case RT_NET: remove_net(cmd); return; @@ -3777,23 +3651,6 @@ bcopy(&old_fstab, &in_progress_fstab, sizeof (struct zone_fstab)); return; - case RT_IPD: - if (state_atleast(ZONE_STATE_INCOMPLETE)) { - zerr(gettext("Zone %s not in %s state; %s %s not " - "allowed."), zone, - zone_state_str(ZONE_STATE_CONFIGURED), - cmd_to_str(CMD_SELECT), rt_to_str(RT_IPD)); - global_scope = B_TRUE; - end_op = -1; - return; - } - if ((err = fill_in_ipdtab(cmd, &old_ipdtab, B_FALSE)) != Z_OK) { - z_cmd_rt_perror(CMD_SELECT, RT_IPD, err, B_TRUE); - global_scope = B_TRUE; - } - bcopy(&old_ipdtab, &in_progress_ipdtab, - sizeof (struct zone_fstab)); - return; case RT_NET: if ((err = fill_in_nwiftab(cmd, &old_nwiftab, B_FALSE)) != Z_OK) { @@ -4452,19 +4309,6 @@ long_usage(CMD_SET, B_TRUE); usage(B_FALSE, HELP_PROPS); return; - case RT_IPD: - switch (prop_type) { - case PT_DIR: - (void) strlcpy(in_progress_ipdtab.zone_fs_dir, prop_id, - sizeof (in_progress_ipdtab.zone_fs_dir)); - return; - default: - break; - } - zone_perror(pt_to_str(prop_type), Z_NO_PROPERTY_TYPE, B_TRUE); - long_usage(CMD_SET, B_TRUE); - usage(B_FALSE, HELP_PROPS); - return; case RT_NET: switch (prop_type) { case PT_ADDRESS: @@ -4992,13 +4836,6 @@ } static void -output_ipd(FILE *fp, struct zone_fstab *ipdtab) -{ - (void) fprintf(fp, "%s:\n", rt_to_str(RT_IPD)); - output_prop(fp, PT_DIR, ipdtab->zone_fs_dir, B_TRUE); -} - -static void info_fs(zone_dochandle_t handle, FILE *fp, cmd_t *cmd) { struct zone_fstab lookup, user; @@ -5038,37 +4875,6 @@ } static void -info_ipd(zone_dochandle_t handle, FILE *fp, cmd_t *cmd) -{ - struct zone_fstab lookup, user; - boolean_t output = B_FALSE; - - if (zonecfg_setipdent(handle) != Z_OK) - return; - while (zonecfg_getipdent(handle, &lookup) == Z_OK) { - if (cmd->cmd_prop_nv_pairs == 0) { - output_ipd(fp, &lookup); - continue; - } - if (fill_in_ipdtab(cmd, &user, B_TRUE) != Z_OK) - continue; - if (strlen(user.zone_fs_dir) > 0 && - strcmp(user.zone_fs_dir, lookup.zone_fs_dir) != 0) - continue; /* no match */ - output_ipd(fp, &lookup); - output = B_TRUE; - } - (void) zonecfg_endipdent(handle); - /* - * If a property n/v pair was specified, warn the user if there was - * nothing to output. - */ - if (!output && cmd->cmd_prop_nv_pairs > 0) - (void) printf(gettext("No such %s resource.\n"), - rt_to_str(RT_IPD)); -} - -static void output_net(FILE *fp, struct zone_nwiftab *nwiftab) { (void) fprintf(fp, "%s:\n", rt_to_str(RT_NET)); @@ -5501,9 +5307,6 @@ case RT_FS: output_fs(fp, &in_progress_fstab); break; - case RT_IPD: - output_ipd(fp, &in_progress_ipdtab); - break; case RT_NET: output_net(fp, &in_progress_nwiftab); break; @@ -5579,7 +5382,6 @@ info_aliased_rctl(handle, fp, ALIAS_MAXSEMIDS); info_aliased_rctl(handle, fp, ALIAS_SHARES); if (!global_zone) { - info_ipd(handle, fp, cmd); info_fs(handle, fp, cmd); info_net(handle, fp, cmd); info_dev(handle, fp, cmd); @@ -5645,9 +5447,6 @@ case RT_FS: info_fs(handle, fp, cmd); break; - case RT_IPD: - info_ipd(handle, fp, cmd); - break; case RT_NET: info_net(handle, fp, cmd); break; @@ -5886,14 +5685,6 @@ ret_val = Z_REQD_RESOURCE_MISSING; saw_error = B_TRUE; } - if ((err = zonecfg_setipdent(handle)) != Z_OK) { - zone_perror(zone, err, B_TRUE); - return; - } - while (zonecfg_getipdent(handle, &fstab) == Z_OK) { - check_reqd_prop(fstab.zone_fs_dir, RT_IPD, PT_DIR, &ret_val); - } - (void) zonecfg_endipdent(handle); if (zonecfg_get_hostid(handle, hostidp, sizeof (hostidp)) == Z_INVALID_PROPERTY) { @@ -6143,7 +5934,6 @@ zonecfg_free_fs_option_list(in_progress_fstab.zone_fs_options); bzero(&in_progress_fstab, sizeof (in_progress_fstab)); bzero(&in_progress_nwiftab, sizeof (in_progress_nwiftab)); - bzero(&in_progress_ipdtab, sizeof (in_progress_ipdtab)); bzero(&in_progress_devtab, sizeof (in_progress_devtab)); zonecfg_free_rctl_value_list(in_progress_rctltab.zone_rctl_valptr); bzero(&in_progress_rctltab, sizeof (in_progress_rctltab)); @@ -6338,43 +6128,6 @@ in_progress_fstab.zone_fs_options = NULL; break; - case RT_IPD: - /* First make sure everything was filled in. */ - if (end_check_reqd(in_progress_ipdtab.zone_fs_dir, PT_DIR, - &validation_failed) == Z_OK) { - if (in_progress_ipdtab.zone_fs_dir[0] != '/') { - zerr(gettext("%s %s is not an absolute path."), - pt_to_str(PT_DIR), - in_progress_ipdtab.zone_fs_dir); - validation_failed = B_TRUE; - } - } - if (validation_failed) { - saw_error = B_TRUE; - return; - } - - if (end_op == CMD_ADD) { - /* Make sure there isn't already one like this. */ - bzero(&tmp_fstab, sizeof (tmp_fstab)); - (void) strlcpy(tmp_fstab.zone_fs_dir, - in_progress_ipdtab.zone_fs_dir, - sizeof (tmp_fstab.zone_fs_dir)); - err = zonecfg_lookup_ipd(handle, &tmp_fstab); - if (err == Z_OK) { - zerr(gettext("An %s resource " - "with the %s '%s' already exists."), - rt_to_str(RT_IPD), pt_to_str(PT_DIR), - in_progress_ipdtab.zone_fs_dir); - saw_error = B_TRUE; - return; - } - err = zonecfg_add_ipd(handle, &in_progress_ipdtab); - } else { - err = zonecfg_modify_ipd(handle, &old_ipdtab, - &in_progress_ipdtab); - } - break; case RT_NET: /* * First make sure everything was filled in. diff -r bcfc9c7baa2e -r 76969fc28795 usr/src/cmd/zonecfg/zonecfg.h --- a/usr/src/cmd/zonecfg/zonecfg.h Wed Jun 30 17:40:22 2010 +0800 +++ b/usr/src/cmd/zonecfg/zonecfg.h Wed Jun 30 03:42:01 2010 -0700 @@ -67,30 +67,29 @@ #define RT_AUTOBOOT 3 /* really a property, but for info ... */ #define RT_POOL 4 /* really a property, but for info ... */ #define RT_FS 5 -#define RT_IPD 6 -#define RT_NET 7 -#define RT_DEVICE 8 -#define RT_RCTL 9 -#define RT_ATTR 10 -#define RT_DATASET 11 -#define RT_LIMITPRIV 12 /* really a property, but for info ... */ -#define RT_BOOTARGS 13 /* really a property, but for info ... */ -#define RT_BRAND 14 /* really a property, but for info ... */ -#define RT_DCPU 15 -#define RT_MCAP 16 -#define RT_MAXLWPS 17 /* really a rctl alias property, but for info */ -#define RT_MAXSHMMEM 18 /* really a rctl alias property, but for info */ -#define RT_MAXSHMIDS 19 /* really a rctl alias property, but for info */ -#define RT_MAXMSGIDS 20 /* really a rctl alias property, but for info */ -#define RT_MAXSEMIDS 21 /* really a rctl alias property, but for info */ -#define RT_SHARES 22 /* really a rctl alias property, but for info */ -#define RT_SCHED 23 /* really a property, but for info ... */ -#define RT_IPTYPE 24 /* really a property, but for info ... */ -#define RT_PCAP 25 -#define RT_HOSTID 26 /* really a property, but for info ... */ -#define RT_ADMIN 27 -#define RT_FS_ALLOWED 28 -#define RT_MAXPROCS 29 /* really a rctl alias property, but for info */ +#define RT_NET 6 +#define RT_DEVICE 7 +#define RT_RCTL 8 +#define RT_ATTR 9 +#define RT_DATASET 10 +#define RT_LIMITPRIV 11 /* really a property, but for info ... */ +#define RT_BOOTARGS 12 /* really a property, but for info ... */ +#define RT_BRAND 13 /* really a property, but for info ... */ +#define RT_DCPU 14 +#define RT_MCAP 15 +#define RT_MAXLWPS 16 /* really a rctl alias property, but for info */ +#define RT_MAXSHMMEM 17 /* really a rctl alias property, but for info */ +#define RT_MAXSHMIDS 18 /* really a rctl alias property, but for info */ +#define RT_MAXMSGIDS 19 /* really a rctl alias property, but for info */ +#define RT_MAXSEMIDS 20 /* really a rctl alias property, but for info */ +#define RT_SHARES 21 /* really a rctl alias property, but for info */ +#define RT_SCHED 22 /* really a property, but for info ... */ +#define RT_IPTYPE 23 /* really a property, but for info ... */ +#define RT_PCAP 24 +#define RT_HOSTID 25 /* really a property, but for info ... */ +#define RT_ADMIN 26 +#define RT_FS_ALLOWED 27 +#define RT_MAXPROCS 28 /* really a rctl alias property, but for info */ #define RT_MIN RT_UNKNOWN #define RT_MAX RT_MAXPROCS diff -r bcfc9c7baa2e -r 76969fc28795 usr/src/cmd/zonecfg/zonecfg_grammar.y --- a/usr/src/cmd/zonecfg/zonecfg_grammar.y Wed Jun 30 17:40:22 2010 +0800 +++ b/usr/src/cmd/zonecfg/zonecfg_grammar.y Wed Jun 30 03:42:01 2010 -0700 @@ -122,7 +122,7 @@ %token HELP CREATE EXPORT ADD DELETE REMOVE SELECT SET INFO CANCEL END VERIFY %token COMMIT REVERT EXIT SEMICOLON TOKEN ZONENAME ZONEPATH AUTOBOOT POOL NET -%token FS IPD ATTR DEVICE RCTL SPECIAL RAW DIR OPTIONS TYPE ADDRESS PHYSICAL +%token FS ATTR DEVICE RCTL SPECIAL RAW DIR OPTIONS TYPE ADDRESS PHYSICAL %token IPTYPE HOSTID FS_ALLOWED %token NAME MATCH PRIV LIMIT ACTION VALUE EQUAL OPEN_SQ_BRACKET CLOSE_SQ_BRACKET %token OPEN_PAREN CLOSE_PAREN COMMA DATASET LIMITPRIV BOOTARGS BRAND PSET PCAP @@ -132,7 +132,7 @@ %type TOKEN EQUAL OPEN_SQ_BRACKET CLOSE_SQ_BRACKET property_value OPEN_PAREN CLOSE_PAREN COMMA simple_prop_val %type complex_piece complex_prop_val -%type resource_type NET FS IPD DEVICE RCTL ATTR DATASET PSET PCAP MCAP +%type resource_type NET FS DEVICE RCTL ATTR DATASET PSET PCAP MCAP ADMIN %type property_name SPECIAL RAW DIR OPTIONS TYPE ADDRESS PHYSICAL NAME MATCH ZONENAME ZONEPATH AUTOBOOT POOL LIMITPRIV BOOTARGS VALUE PRIV LIMIT @@ -934,7 +934,6 @@ resource_type: NET { $$ = RT_NET; } | FS { $$ = RT_FS; } - | IPD { $$ = RT_IPD; } | DEVICE { $$ = RT_DEVICE; } | RCTL { $$ = RT_RCTL; } | ATTR { $$ = RT_ATTR; } diff -r bcfc9c7baa2e -r 76969fc28795 usr/src/cmd/zonecfg/zonecfg_lex.l --- a/usr/src/cmd/zonecfg/zonecfg_lex.l Wed Jun 30 17:40:22 2010 +0800 +++ b/usr/src/cmd/zonecfg/zonecfg_lex.l Wed Jun 30 03:42:01 2010 -0700 @@ -155,8 +155,6 @@ fs { return FS; } -inherit-pkg-dir { return IPD; } - device { return DEVICE; } rctl { return RCTL; } diff -r bcfc9c7baa2e -r 76969fc28795 usr/src/head/libzonecfg.h --- a/usr/src/head/libzonecfg.h Wed Jun 30 17:40:22 2010 +0800 +++ b/usr/src/head/libzonecfg.h Wed Jun 30 03:42:01 2010 -0700 @@ -338,11 +338,6 @@ struct zone_fstab *, struct zone_fstab *); extern int zonecfg_lookup_filesystem(zone_dochandle_t, struct zone_fstab *); -extern int zonecfg_add_ipd(zone_dochandle_t, struct zone_fstab *); -extern int zonecfg_delete_ipd(zone_dochandle_t, struct zone_fstab *); -extern int zonecfg_modify_ipd(zone_dochandle_t, - struct zone_fstab *, struct zone_fstab *); -extern int zonecfg_lookup_ipd(zone_dochandle_t, struct zone_fstab *); extern int zonecfg_add_fs_option(struct zone_fstab *, char *); extern int zonecfg_remove_fs_option(struct zone_fstab *, char *); extern void zonecfg_free_fs_option_list(zone_fsopt_t *); @@ -480,9 +475,6 @@ extern int zonecfg_setfsent(zone_dochandle_t); extern int zonecfg_getfsent(zone_dochandle_t, struct zone_fstab *); extern int zonecfg_endfsent(zone_dochandle_t); -extern int zonecfg_setipdent(zone_dochandle_t); -extern int zonecfg_getipdent(zone_dochandle_t, struct zone_fstab *); -extern int zonecfg_endipdent(zone_dochandle_t); extern int zonecfg_setnwifent(zone_dochandle_t); extern int zonecfg_getnwifent(zone_dochandle_t, struct zone_nwiftab *); extern int zonecfg_endnwifent(zone_dochandle_t); diff -r bcfc9c7baa2e -r 76969fc28795 usr/src/lib/brand/shared/zone/common.ksh --- a/usr/src/lib/brand/shared/zone/common.ksh Wed Jun 30 17:40:22 2010 +0800 +++ b/usr/src/lib/brand/shared/zone/common.ksh Wed Jun 30 03:42:01 2010 -0700 @@ -18,7 +18,7 @@ # # CDDL HEADER END # -# Copyright (c) 2010, Oracle and/or its affiliates. All rights reserved. +# Copyright (c) 2009, 2010, Oracle and/or its affiliates. All rights reserved. # # @@ -234,11 +234,9 @@ } # -# Read zonecfg ipd and fs entries and save the relevant data, one entry per +# Read zonecfg fs entries and save the relevant data, one entry per # line. # This assumes the properties from the zonecfg output, e.g.: -# inherit-pkg-dir: -# dir: /usr # fs: # dir: /opt # special: /opt @@ -246,37 +244,10 @@ # type: lofs # options: [noexec,ro,noatime] # -# and it assumes the order of the fs properties as above. This also saves the -# inherit-pkg-dir patterns into the ipd.{cpio|pax} temporary files for -# filtering while extracting the image into the zonepath. We have to save the -# IPD patterns in the appropriate format for filtering with the different -# archivers and we don't know what format we'll get until after the flash -# archive is unpacked. +# and it assumes the order of the fs properties as above. # get_fs_info() { - zonecfg -z $zonename info inherit-pkg-dir | \ - nawk -v ipdcpiof=$ipdcpiofile -v ipdpaxf=$ipdpaxfile '{ - if ($1 == "dir:") { - dir=$2; - printf("%s lofs %s ro\n", dir, dir); - - if (substr(dir, 1, 1) == "/") { - printf("%s\n", substr(dir, 2)) >> ipdcpiof - printf("%s/*\n", substr(dir, 2)) >> ipdcpiof - } else { - printf("%s\n", dir) >> ipdcpiof - printf("%s/*\n", dir) >> ipdcpiof - } - - if (substr(dir, 1, 1) == "/") { - printf("%s ", substr(dir, 2)) >> ipdpaxf - } else { - printf("%s ", dir) >> ipdpaxf - } - } - }' >> $fstmpfile - zonecfg -z $zonename info fs | nawk '{ if ($1 == "options:") { # Remove brackets. @@ -501,16 +472,16 @@ if [[ $archiver == "pax" ]]; then # pax archiver specified archiver_command="/usr/bin/pax" - if [[ -s $ipdpaxfile ]]; then + if [[ -s $fspaxfile ]]; then archiver_arguments="-r -p e -c \ - $(/usr/bin/cat $ipdpaxfile)" + $(/usr/bin/cat $fspaxfile)" else archiver_arguments="-r -p e" fi elif [[ $archiver == "cpio" || -z $archiver ]]; then # cpio archived specified OR no archiver specified - use default archiver_command="/usr/bin/cpio" - archiver_arguments="-icdumfE $ipdcpiofile" + archiver_arguments="-icdumfE $fscpiofile" else # unknown archiver specified log "$unknown_archiver" $archiver @@ -659,7 +630,7 @@ get_archive_base "$stage1" "$archive" "cpio -it" - cpioopts="-idmfE $ipdcpiofile" + cpioopts="-idmfE $fscpiofile" vlog "cd \"$ARCHIVE_BASE\" && $stage1 \"$archive\" | cpio $cpioopts" @@ -681,8 +652,8 @@ get_archive_base "cat" "$archive" "pax" - if [[ -s $ipdpaxfile ]]; then - filtopt="-c $(/usr/bin/cat $ipdpaxfile)" + if [[ -s $fspaxfile ]]; then + filtopt="-c $(/usr/bin/cat $fspaxfile)" fi vlog "cd \"$ARCHIVE_BASE\" && pax -r -f \"$archive\" $filtopt" @@ -708,8 +679,6 @@ # # ufsrestore goes interactive if you ^C it. To prevent that, # we make sure its stdin is not a terminal. - # Note that there is no way to filter inherit-pkg-dirs for a full - # restore so there will be warnings in the log file. # ( cd "$ZONEROOT" && ufsrestore rf "$archive" < /dev/null ) result=$? @@ -729,7 +698,7 @@ cpioopts="-pdm" first=1 - filt=$(for i in $(cat $ipdpaxfile) + filt=$(for i in $(cat $fspaxfile) do echo $i | egrep -s "/" && continue if [[ $first == 1 ]]; then @@ -906,33 +875,32 @@ # Make sure we always have the files holding the directories to filter # out when extracting from a CPIO or PAX archive. We'll add the fs - # entries to these files in get_fs_info() (there may be no IPDs for - # some brands but thats ok). - ipdcpiofile=$(/usr/bin/mktemp -t -p /var/tmp ipd.cpio.XXXXXX) - if [[ -z "$ipdcpiofile" ]]; then + # entries to these files in get_fs_info() + fscpiofile=$(/usr/bin/mktemp -t -p /var/tmp fs.cpio.XXXXXX) + if [[ -z "$fscpiofile" ]]; then rm -f $fstmpfile fatal "$e_tmpfile" fi - # In addition to the IPDs, also filter out these directories. - echo 'dev/*' >>$ipdcpiofile - echo 'devices/*' >>$ipdcpiofile - echo 'devices' >>$ipdcpiofile - echo 'proc/*' >>$ipdcpiofile - echo 'tmp/*' >>$ipdcpiofile - echo 'var/run/*' >>$ipdcpiofile - echo 'system/contract/*' >>$ipdcpiofile - echo 'system/object/*' >>$ipdcpiofile + # Filter out these directories. + echo 'dev/*' >>$fscpiofile + echo 'devices/*' >>$fscpiofile + echo 'devices' >>$fscpiofile + echo 'proc/*' >>$fscpiofile + echo 'tmp/*' >>$fscpiofile + echo 'var/run/*' >>$fscpiofile + echo 'system/contract/*' >>$fscpiofile + echo 'system/object/*' >>$fscpiofile - ipdpaxfile=$(/usr/bin/mktemp -t -p /var/tmp ipd.pax.XXXXXX) - if [[ -z "$ipdpaxfile" ]]; then - rm -f $fstmpfile $ipdcpiofile + fspaxfile=$(/usr/bin/mktemp -t -p /var/tmp fs.pax.XXXXXX) + if [[ -z "$fspaxfile" ]]; then + rm -f $fstmpfile $fscpiofile fatal "$e_tmpfile" fi printf "%s " \ "dev devices proc tmp var/run system/contract system/object" \ - >>$ipdpaxfile + >>$fspaxfile # Set up any fs mounts so the archive will install into the correct # locations. @@ -940,7 +908,7 @@ mnt_fs if (( $? != 0 )); then umnt_fs >/dev/null 2>&1 - rm -f $fstmpfile $ipdcpiofile $ipdpaxfile + rm -f $fstmpfile $fscpiofile $fspaxfile fatal "$mount_failed" fi @@ -1013,7 +981,7 @@ # Clean up any fs mounts used during unpacking. umnt_fs - rm -f $fstmpfile $ipdcpiofile $ipdpaxfile + rm -f $fstmpfile $fscpiofile $fspaxfile chmod 700 $zonepath diff -r bcfc9c7baa2e -r 76969fc28795 usr/src/lib/brand/solaris10/s10_support/s10_support.c --- a/usr/src/lib/brand/solaris10/s10_support/s10_support.c Wed Jun 30 17:40:22 2010 +0800 +++ b/usr/src/lib/brand/solaris10/s10_support/s10_support.c Wed Jun 30 03:42:01 2010 -0700 @@ -99,7 +99,6 @@ s10_verify(char *xmlfile) { zone_dochandle_t handle; - struct zone_fstab fstab; struct zone_devtab devtab; zone_iptype_t iptype; @@ -112,21 +111,6 @@ } /* - * Check to see whether the zone has any inherit-pkg-dirs - * configured. - */ - if (zonecfg_setipdent(handle) != Z_OK) { - zonecfg_fini_handle(handle); - s10_err(gettext("zonecfg provided an invalid XML file")); - } - if (zonecfg_getipdent(handle, &fstab) == Z_OK) { - zonecfg_fini_handle(handle); - s10_err(gettext("solaris10 zones do not support " - "inherit-pkg-dirs")); - } - (void) zonecfg_endipdent(handle); - - /* * Check to see whether the zone has any unsupported devices * configured. * diff -r bcfc9c7baa2e -r 76969fc28795 usr/src/lib/libinstzones/common/instzones_lib.h --- a/usr/src/lib/libinstzones/common/instzones_lib.h Wed Jun 30 17:40:22 2010 +0800 +++ b/usr/src/lib/libinstzones/common/instzones_lib.h Wed Jun 30 03:42:01 2010 -0700 @@ -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 @@ typedef unsigned long _zone_status_t; struct _zoneListElement_t { - char **_zlInheritedDirs; char *_zlName; char *_zlPath; char *_zlScratchName; @@ -307,7 +305,6 @@ /*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 -r bcfc9c7baa2e -r 76969fc28795 usr/src/lib/libinstzones/common/mapfile-vers --- a/usr/src/lib/libinstzones/common/mapfile-vers Wed Jun 30 17:40:22 2010 +0800 +++ b/usr/src/lib/libinstzones/common/mapfile-vers Wed Jun 30 03:42:01 2010 -0700 @@ -42,7 +42,6 @@ SYMBOL_VERSION SUNWprivate { global: UmountAllZones; - z_add_inherited_file_system; z_brands_are_implemented; z_canoninplace; z_createMountTable; @@ -51,9 +50,7 @@ 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 @@ 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 @@ 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 -r bcfc9c7baa2e -r 76969fc28795 usr/src/lib/libinstzones/common/zones.c --- a/usr/src/lib/libinstzones/common/zones.c Wed Jun 30 17:40:22 2010 +0800 +++ b/usr/src/lib/libinstzones/common/zones.c Wed Jun 30 03:42:01 2010 -0700 @@ -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 @@ 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 @@ 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 @@ } /* - * 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 -r bcfc9c7baa2e -r 76969fc28795 usr/src/lib/libinstzones/common/zones_paths.c --- a/usr/src/lib/libinstzones/common/zones_paths.c Wed Jun 30 17:40:22 2010 +0800 +++ b/usr/src/lib/libinstzones/common/zones_paths.c Wed Jun 30 03:42:01 2010 -0700 @@ -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 @@ 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 -r bcfc9c7baa2e -r 76969fc28795 usr/src/lib/libinstzones/common/zones_strings.h --- a/usr/src/lib/libinstzones/common/zones_strings.h Wed Jun 30 17:40:22 2010 +0800 +++ b/usr/src/lib/libinstzones/common/zones_strings.h Wed Jun 30 03:42:01 2010 -0700 @@ -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 @@ #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 @@ #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 @@ #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 @@ #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 -r bcfc9c7baa2e -r 76969fc28795 usr/src/lib/libinstzones/common/zones_utils.c --- a/usr/src/lib/libinstzones/common/zones_utils.c Wed Jun 30 17:40:22 2010 +0800 +++ b/usr/src/lib/libinstzones/common/zones_utils.c Wed Jun 30 03:42:01 2010 -0700 @@ -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 @@ } /* - * 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 -r bcfc9c7baa2e -r 76969fc28795 usr/src/lib/libinstzones/hdrs/instzones_api.h --- a/usr/src/lib/libinstzones/hdrs/instzones_api.h Wed Jun 30 17:40:22 2010 +0800 +++ b/usr/src/lib/libinstzones/hdrs/instzones_api.h Wed Jun 30 03:42:01 2010 -0700 @@ -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 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 @@ 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); diff -r bcfc9c7baa2e -r 76969fc28795 usr/src/lib/libzonecfg/common/libzonecfg.c --- a/usr/src/lib/libzonecfg/common/libzonecfg.c Wed Jun 30 17:40:22 2010 +0800 +++ b/usr/src/lib/libzonecfg/common/libzonecfg.c Wed Jun 30 03:42:01 2010 -0700 @@ -83,7 +83,6 @@ #define DTD_ELEM_DEVICE (const xmlChar *) "device" #define DTD_ELEM_FS (const xmlChar *) "filesystem" #define DTD_ELEM_FSOPTION (const xmlChar *) "fsoption" -#define DTD_ELEM_IPD (const xmlChar *) "inherited-pkg-dir" #define DTD_ELEM_NET (const xmlChar *) "network" #define DTD_ELEM_RCTL (const xmlChar *) "rctl" #define DTD_ELEM_RCTLVALUE (const xmlChar *) "rctl-value" @@ -1695,35 +1694,6 @@ return (Z_OK); } -static int -zonecfg_add_ipd_core(zone_dochandle_t handle, struct zone_fstab *tabptr) -{ - xmlNodePtr newnode, cur = handle->zone_dh_cur; - int err; - - newnode = xmlNewTextChild(cur, NULL, DTD_ELEM_IPD, NULL); - if ((err = newprop(newnode, DTD_ATTR_DIR, tabptr->zone_fs_dir)) != Z_OK) - return (err); - return (Z_OK); -} - -int -zonecfg_add_ipd(zone_dochandle_t handle, struct zone_fstab *tabptr) -{ - int err; - - if (tabptr == NULL) - return (Z_INVAL); - - if ((err = operation_prep(handle)) != Z_OK) - return (err); - - if ((err = zonecfg_add_ipd_core(handle, tabptr)) != Z_OK) - return (err); - - return (Z_OK); -} - int zonecfg_add_fs_option(struct zone_fstab *tabptr, char *option) { @@ -1866,61 +1836,6 @@ return (Z_OK); } -static int -zonecfg_delete_ipd_core(zone_dochandle_t handle, struct zone_fstab *tabptr) -{ - xmlNodePtr cur = handle->zone_dh_cur; - - for (cur = cur->xmlChildrenNode; cur != NULL; cur = cur->next) { - if (xmlStrcmp(cur->name, DTD_ELEM_IPD)) - continue; - if (match_prop(cur, DTD_ATTR_DIR, tabptr->zone_fs_dir)) { - xmlUnlinkNode(cur); - xmlFreeNode(cur); - return (Z_OK); - } - } - return (Z_NO_RESOURCE_ID); -} - -int -zonecfg_delete_ipd(zone_dochandle_t handle, struct zone_fstab *tabptr) -{ - int err; - - if (tabptr == NULL) - return (Z_INVAL); - - if ((err = operation_prep(handle)) != Z_OK) - return (err); - - if ((err = zonecfg_delete_ipd_core(handle, tabptr)) != Z_OK) - return (err); - - return (Z_OK); -} - -int -zonecfg_modify_ipd(zone_dochandle_t handle, struct zone_fstab *oldtabptr, - struct zone_fstab *newtabptr) -{ - int err; - - if (oldtabptr == NULL || newtabptr == NULL) - return (Z_INVAL); - - if ((err = operation_prep(handle)) != Z_OK) - return (err); - - if ((err = zonecfg_delete_ipd_core(handle, oldtabptr)) != Z_OK) - return (err); - - if ((err = zonecfg_add_ipd_core(handle, newtabptr)) != Z_OK) - return (err); - - return (Z_OK); -} - int zonecfg_lookup_filesystem( zone_dochandle_t handle, @@ -2050,55 +1965,6 @@ return (Z_OK); } -int -zonecfg_lookup_ipd(zone_dochandle_t handle, struct zone_fstab *tabptr) -{ - xmlNodePtr cur, match; - int err; - char dirname[MAXPATHLEN]; - - if (tabptr == NULL) - return (Z_INVAL); - - if ((err = operation_prep(handle)) != Z_OK) - return (err); - - /* - * General algorithm: - * Walk the list of children looking for matches on any properties - * specified in the fstab parameter. If more than one resource - * matches, we return Z_INSUFFICIENT_SPEC; if none match, we return - * Z_NO_RESOURCE_ID. - */ - cur = handle->zone_dh_cur; - match = NULL; - for (cur = cur->xmlChildrenNode; cur != NULL; cur = cur->next) { - if (xmlStrcmp(cur->name, DTD_ELEM_IPD)) - continue; - if (strlen(tabptr->zone_fs_dir) > 0) { - if ((fetchprop(cur, DTD_ATTR_DIR, dirname, - sizeof (dirname)) == Z_OK) && - (strcmp(tabptr->zone_fs_dir, dirname) == 0)) { - if (match == NULL) - match = cur; - else - return (Z_INSUFFICIENT_SPEC); - } - } - } - - if (match == NULL) - return (Z_NO_RESOURCE_ID); - - cur = match; - - if ((err = fetchprop(cur, DTD_ATTR_DIR, tabptr->zone_fs_dir, - sizeof (tabptr->zone_fs_dir))) != Z_OK) - return (err); - - return (Z_OK); -} - /* * Compare two IP addresses in string form. Allow for the possibility that * one might have "/" at the end: allow a match on just the @@ -3969,8 +3835,6 @@ return (DTD_ELEM_DEVICE); if (strcmp(nm, "fs") == 0) return (DTD_ELEM_FS); - if (strcmp(nm, "inherit-pkg-dir") == 0) - return (DTD_ELEM_IPD); if (strcmp(nm, "net") == 0) return (DTD_ELEM_NET); if (strcmp(nm, "attr") == 0) @@ -4839,48 +4703,6 @@ } int -zonecfg_setipdent(zone_dochandle_t handle) -{ - return (zonecfg_setent(handle)); -} - -int -zonecfg_getipdent(zone_dochandle_t handle, struct zone_fstab *tabptr) -{ - xmlNodePtr cur; - int err; - - if (handle == NULL) - return (Z_INVAL); - - if ((cur = handle->zone_dh_cur) == NULL) - return (Z_NO_ENTRY); - - for (; cur != NULL; cur = cur->next) - if (!xmlStrcmp(cur->name, DTD_ELEM_IPD)) - break; - if (cur == NULL) { - handle->zone_dh_cur = handle->zone_dh_top; - return (Z_NO_ENTRY); - } - - if ((err = fetchprop(cur, DTD_ATTR_DIR, tabptr->zone_fs_dir, - sizeof (tabptr->zone_fs_dir))) != Z_OK) { - handle->zone_dh_cur = handle->zone_dh_top; - return (err); - } - - handle->zone_dh_cur = cur->next; - return (Z_OK); -} - -int -zonecfg_endipdent(zone_dochandle_t handle) -{ - return (zonecfg_endent(handle)); -} - -int zonecfg_setnwifent(zone_dochandle_t handle) { return (zonecfg_setent(handle)); diff -r bcfc9c7baa2e -r 76969fc28795 usr/src/lib/libzonecfg/common/mapfile-vers --- a/usr/src/lib/libzonecfg/common/mapfile-vers Wed Jun 30 17:40:22 2010 +0800 +++ b/usr/src/lib/libzonecfg/common/mapfile-vers Wed Jun 30 03:42:01 2010 -0700 @@ -19,7 +19,7 @@ # CDDL HEADER END # # -# Copyright (c) 2010, Oracle and/or its affiliates. All rights reserved. +# Copyright (c) 2006, 2010, Oracle and/or its affiliates. All rights reserved. # # @@ -52,7 +52,6 @@ zonecfg_add_filesystem; zonecfg_add_fs_option; zonecfg_add_admin; - zonecfg_add_ipd; zonecfg_add_nwif; zonecfg_add_patch; zonecfg_add_patch_obs; @@ -82,7 +81,6 @@ zonecfg_delete_dev; zonecfg_delete_ds; zonecfg_delete_filesystem; - zonecfg_delete_ipd; zonecfg_delete_mcap; zonecfg_delete_nwif; zonecfg_delete_pset; @@ -103,7 +101,6 @@ zonecfg_enddevperment; zonecfg_enddsent; zonecfg_endfsent; - zonecfg_endipdent; zonecfg_endnwifent; zonecfg_endrctlent; zonecfg_find_mounts; @@ -130,7 +127,6 @@ zonecfg_get_fs_allowed; zonecfg_get_handle; zonecfg_get_hostid; - zonecfg_getipdent; zonecfg_get_iptype; zonecfg_get_limitpriv; zonecfg_getmcapent; @@ -166,7 +162,6 @@ zonecfg_lookup_dev; zonecfg_lookup_ds; zonecfg_lookup_filesystem; - zonecfg_lookup_ipd; zonecfg_lookup_mcap; zonecfg_lookup_nwif; zonecfg_lookup_pset; @@ -176,7 +171,6 @@ zonecfg_modify_dev; zonecfg_modify_ds; zonecfg_modify_filesystem; - zonecfg_modify_ipd; zonecfg_modify_mcap; zonecfg_modify_nwif; zonecfg_modify_pset; @@ -210,7 +204,6 @@ zonecfg_setfsent; zonecfg_set_fs_allowed; zonecfg_set_hostid; - zonecfg_setipdent; zonecfg_set_iptype; zonecfg_set_limitpriv; zonecfg_set_name; diff -r bcfc9c7baa2e -r 76969fc28795 usr/src/lib/libzonecfg/dtd/zonecfg.dtd.1 --- a/usr/src/lib/libzonecfg/dtd/zonecfg.dtd.1 Wed Jun 30 17:40:22 2010 +0800 +++ b/usr/src/lib/libzonecfg/dtd/zonecfg.dtd.1 Wed Jun 30 03:42:01 2010 -0700 @@ -20,7 +20,7 @@ CDDL HEADER END - Copyright (c) 2009, 2010, Oracle and/or its affiliates. All rights reserved. + Copyright (c) 2003, 2010, Oracle and/or its affiliates. All rights reserved. --> @@ -36,6 +36,12 @@ directory CDATA #REQUIRED type CDATA #REQUIRED> + +