/*
* CDDL HEADER START
*
* The contents of this file are subject to the terms of the
* Common Development and Distribution License (the "License").
* You may not use this file except in compliance with the License.
*
* You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE
* See the License for the specific language governing permissions
* and limitations under the License.
*
* When distributing Covered Code, include this CDDL HEADER in each
* file and include the License file at usr/src/OPENSOLARIS.LICENSE.
* If applicable, add the following below this CDDL HEADER, with the
* fields enclosed by brackets "[]" replaced with your own identifying
* information: Portions Copyright [yyyy] [name of copyright owner]
*
* CDDL HEADER END
*/
/*
* Copyright 2006 Sun Microsystems, Inc. All rights reserved.
* Use is subject to license terms.
*/
#pragma ident "%Z%%M% %I% %E% SMI"
#include <stdlib.h>
#include <strings.h>
#include <zone.h>
#include <errno.h>
/*
* Get label from zone name
*/
{
return (NULL);
}
return (getzonelabelbyid(zoneid));
}
/*
* Get label from zone id
*/
{
return (NULL);
sizeof (m_label_t)) < 0) {
return (NULL);
}
return (slabel);
}
/*
* Get zone id from label
*/
{
int i;
/* Check for admin_low or admin_high; both are global zone */
return (GLOBAL_ZONEID);
nzents = 0;
return (-1);
if (nzents == 0) {
return (-1);
}
/*
* Add a small amount of padding here to avoid spinning in a tight loop
* if there's a process running somewhere that's creating lots of zones
* all at once.
*/
nzents += 8;
return (-1);
return (-1);
}
if (nzents > nzents_saved) {
/* list changed, try again */
goto again;
}
for (i = 0; i < nzents; i++) {
if (zids[i] == GLOBAL_ZONEID)
continue;
sizeof (m_label_t)) < 0)
continue; /* Badly configured zone info */
return (zoneid);
}
}
return (-1);
}
/*
* Get zoneroot for a zoneid
*/
char *
{
sizeof (zoneroot)) == -1) {
return (NULL);
}
}
/*
* Get zoneroot for a zonename
*/
char *
{
return (NULL);
return (getzonerootbyid(zoneid));
}
/*
* Get zoneroot for a label
*/
char *
{
return (NULL);
return (getzonerootbyid(zoneid));
}
/*
* Get label of path relative to global zone
*
* This function must be called from the global zone
*/
{
int i;
if (getzoneid() != GLOBAL_ZONEID) {
return (NULL);
}
nzents = 0;
return (NULL);
/* Add a small amount of padding to avoid loops */
nzents += 8;
return (NULL);
return (NULL);
}
if (nzents > nzents_saved) {
/* list changed, try again */
goto again;
}
return (NULL);
}
for (i = 0; i < nzents; i++) {
int zonerootlen;
if (zids[i] == GLOBAL_ZONEID)
continue;
sizeof (zoneroot)) == -1)
continue; /* Badly configured zone info */
/*
* Need to handle the case for the /dev directory which is
* parallel to the zone's root directory. So we back up
* 4 bytes - the strlen of "root".
*/
continue; /* Badly configured zone info */
/*
* If we get a match, the file is in a labeled zone.
* Return the label of that zone.
*/
sizeof (m_label_t)) < 0)
continue; /* Badly configured zone info */
return (slabel);
}
}
return (slabel);
}