vplat.c (fa3d7ae1f555ae8ec43c4166bab9c17fc2347566) vplat.c (e767a340776ab621d2b82ee83e1755c45fa979c8)
1/*
2 * CDDL HEADER START
3 *
4 * The contents of this file are subject to the terms of the
5 * Common Development and Distribution License (the "License").
6 * You may not use this file except in compliance with the License.
7 *
8 * You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE

--- 1077 unchanged lines hidden (view full) ---

1086 goto cleanup;
1087 }
1088
1089 retval = 0;
1090
1091cleanup:
1092 if (bh != NULL)
1093 brand_close(bh);
1/*
2 * CDDL HEADER START
3 *
4 * The contents of this file are subject to the terms of the
5 * Common Development and Distribution License (the "License").
6 * You may not use this file except in compliance with the License.
7 *
8 * You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE

--- 1077 unchanged lines hidden (view full) ---

1086 goto cleanup;
1087 }
1088
1089 retval = 0;
1090
1091cleanup:
1092 if (bh != NULL)
1093 brand_close(bh);
1094 if (handle)
1094 if (handle != NULL)
1095 zonecfg_fini_handle(handle);
1096 if (prof)
1097 di_prof_fini(prof);
1098 return (retval);
1099}
1100
1101static int
1102mount_one(zlog_t *zlogp, struct zone_fstab *fsptr, const char *rootpath)

--- 532 unchanged lines hidden (view full) ---

1635 zerror(zlogp, B_FALSE, "invalid configuration");
1636 goto bad;
1637 }
1638
1639 /* Get a handle to the brand info for this zone */
1640 if ((zone_get_brand(zone_name, brand, sizeof (brand)) != Z_OK) ||
1641 (bh = brand_open(brand)) == NULL) {
1642 zerror(zlogp, B_FALSE, "unable to determine zone brand");
1095 zonecfg_fini_handle(handle);
1096 if (prof)
1097 di_prof_fini(prof);
1098 return (retval);
1099}
1100
1101static int
1102mount_one(zlog_t *zlogp, struct zone_fstab *fsptr, const char *rootpath)

--- 532 unchanged lines hidden (view full) ---

1635 zerror(zlogp, B_FALSE, "invalid configuration");
1636 goto bad;
1637 }
1638
1639 /* Get a handle to the brand info for this zone */
1640 if ((zone_get_brand(zone_name, brand, sizeof (brand)) != Z_OK) ||
1641 (bh = brand_open(brand)) == NULL) {
1642 zerror(zlogp, B_FALSE, "unable to determine zone brand");
1643 zonecfg_fini_handle(handle);
1643 return (-1);
1644 }
1645
1646 /*
1647 * Get the list of global filesystems to mount from the brand
1648 * configuration.
1649 */
1650 cb.pgcd_zlogp = zlogp;
1651 cb.pgcd_fs_tab = &fs_ptr;
1652 cb.pgcd_num_fs = &num_fs;
1653 if (brand_platform_iter_gmounts(bh, zonepath,
1654 plat_gmount_cb, &cb) != 0) {
1655 zerror(zlogp, B_FALSE, "unable to mount filesystems");
1656 brand_close(bh);
1644 return (-1);
1645 }
1646
1647 /*
1648 * Get the list of global filesystems to mount from the brand
1649 * configuration.
1650 */
1651 cb.pgcd_zlogp = zlogp;
1652 cb.pgcd_fs_tab = &fs_ptr;
1653 cb.pgcd_num_fs = &num_fs;
1654 if (brand_platform_iter_gmounts(bh, zonepath,
1655 plat_gmount_cb, &cb) != 0) {
1656 zerror(zlogp, B_FALSE, "unable to mount filesystems");
1657 brand_close(bh);
1658 zonecfg_fini_handle(handle);
1657 return (-1);
1658 }
1659 brand_close(bh);
1660
1661 /*
1662 * Iterate through the rest of the filesystems, first the IPDs, then
1663 * the general FSs. Sort them all, then mount them in sorted order.
1664 * This is to make sure the higher level directories (e.g., /usr)

--- 1176 unchanged lines hidden (view full) ---

2841 case ZS_SHARED:
2842 curr_iptype = "shared";
2843 break;
2844 case ZS_EXCLUSIVE:
2845 curr_iptype = "exclusive";
2846 break;
2847 }
2848
1659 return (-1);
1660 }
1661 brand_close(bh);
1662
1663 /*
1664 * Iterate through the rest of the filesystems, first the IPDs, then
1665 * the general FSs. Sort them all, then mount them in sorted order.
1666 * This is to make sure the higher level directories (e.g., /usr)

--- 1176 unchanged lines hidden (view full) ---

2843 case ZS_SHARED:
2844 curr_iptype = "shared";
2845 break;
2846 case ZS_EXCLUSIVE:
2847 curr_iptype = "exclusive";
2848 break;
2849 }
2850
2849 if (zonecfg_default_privset(privs, curr_iptype) == Z_OK)
2851 if (zonecfg_default_privset(privs, curr_iptype) == Z_OK) {
2852 zonecfg_fini_handle(handle);
2850 return (0);
2853 return (0);
2854 }
2851 zerror(zlogp, B_FALSE,
2852 "failed to determine the zone's default privilege set");
2853 zonecfg_fini_handle(handle);
2854 return (-1);
2855 }
2856
2857 switch (zonecfg_get_privset(handle, privs, &privname)) {
2858 case Z_OK:

--- 1231 unchanged lines hidden (view full) ---

4090 return (-1);
4091 }
4092
4093 /*
4094 * If this brand requires any kernel support, now is the time to
4095 * get it loaded and initialized.
4096 */
4097 if (brand_get_modname(bh, modname, MAXPATHLEN) < 0) {
2855 zerror(zlogp, B_FALSE,
2856 "failed to determine the zone's default privilege set");
2857 zonecfg_fini_handle(handle);
2858 return (-1);
2859 }
2860
2861 switch (zonecfg_get_privset(handle, privs, &privname)) {
2862 case Z_OK:

--- 1231 unchanged lines hidden (view full) ---

4094 return (-1);
4095 }
4096
4097 /*
4098 * If this brand requires any kernel support, now is the time to
4099 * get it loaded and initialized.
4100 */
4101 if (brand_get_modname(bh, modname, MAXPATHLEN) < 0) {
4102 brand_close(bh);
4098 zerror(zlogp, B_FALSE, "unable to determine brand kernel "
4099 "module");
4100 return (-1);
4101 }
4103 zerror(zlogp, B_FALSE, "unable to determine brand kernel "
4104 "module");
4105 return (-1);
4106 }
4107 brand_close(bh);
4102
4103 if (strlen(modname) > 0) {
4104 (void) strlcpy(attr.ba_modname, modname, MAXPATHLEN);
4105 if (zone_setattr(zoneid, ZONE_ATTR_BRAND, &attr,
4106 sizeof (attr) != 0)) {
4107 zerror(zlogp, B_TRUE, "could not set zone brand "
4108 "attribute.");
4109 goto error;

--- 380 unchanged lines hidden (view full) ---

4490 if (rebooting) {
4491 struct zone_psettab pset_tab;
4492 zone_dochandle_t handle;
4493
4494 if ((handle = zonecfg_init_handle()) != NULL &&
4495 zonecfg_get_handle(zone_name, handle) == Z_OK &&
4496 zonecfg_lookup_pset(handle, &pset_tab) == Z_OK)
4497 destroy_tmp_pool = B_FALSE;
4108
4109 if (strlen(modname) > 0) {
4110 (void) strlcpy(attr.ba_modname, modname, MAXPATHLEN);
4111 if (zone_setattr(zoneid, ZONE_ATTR_BRAND, &attr,
4112 sizeof (attr) != 0)) {
4113 zerror(zlogp, B_TRUE, "could not set zone brand "
4114 "attribute.");
4115 goto error;

--- 380 unchanged lines hidden (view full) ---

4496 if (rebooting) {
4497 struct zone_psettab pset_tab;
4498 zone_dochandle_t handle;
4499
4500 if ((handle = zonecfg_init_handle()) != NULL &&
4501 zonecfg_get_handle(zone_name, handle) == Z_OK &&
4502 zonecfg_lookup_pset(handle, &pset_tab) == Z_OK)
4503 destroy_tmp_pool = B_FALSE;
4504
4505 zonecfg_fini_handle(handle);
4498 }
4499
4500 if (destroy_tmp_pool) {
4501 if ((res = zonecfg_destroy_tmp_pool(zone_name, pool_err,
4502 sizeof (pool_err))) != Z_OK) {
4503 if (res == Z_POOL)
4504 zerror(zlogp, B_FALSE, pool_err);
4505 }

--- 24 unchanged lines hidden ---
4506 }
4507
4508 if (destroy_tmp_pool) {
4509 if ((res = zonecfg_destroy_tmp_pool(zone_name, pool_err,
4510 sizeof (pool_err))) != Z_OK) {
4511 if (res == Z_POOL)
4512 zerror(zlogp, B_FALSE, pool_err);
4513 }

--- 24 unchanged lines hidden ---