2N/A * The contents of this file are subject to the terms of the 2N/A * Common Development and Distribution License (the "License"). 2N/A * You may not use this file except in compliance with the License. 2N/A * See the License for the specific language governing permissions 2N/A * and limitations under the License. 2N/A * When distributing Covered Code, include this CDDL HEADER in each 2N/A * If applicable, add the following below this CDDL HEADER, with the 2N/A * fields enclosed by brackets "[]" replaced with your own identifying 2N/A * information: Portions Copyright [yyyy] [name of copyright owner] 2N/A * Copyright (c) 2006, 2011, Oracle and/or its affiliates. All rights reserved. 2N/A * Description: Returns the global zone pathname corresponding 2N/A * to the specified label. The pathname does 2N/A * not need to match an existing file system object. 2N/A * This structure is used to chain mntent structures into a list 2N/A * and to cache stat information for each member of the list. 2N/A * Return a pointer to the trailing suffix of full that follows the prefix 2N/A * given by pref. If pref isn't a prefix of full, return NULL. Apply 2N/A * pathname semantics to the prefix test, so that pref must match at a 2N/A * component boundary. 2N/A * pref is a substring of full. To be a subpath, it cannot cover a 2N/A * partial component of full. The last clause of the test handles the 2N/A * special case of the root. 2N/A * Return zero iff the path named by sub is a leading subpath 2N/A * of the path named by full. 2N/A * Treat null paths as matching nothing. 2N/A * This function attempts to convert local zone NFS mounted pathnames 2N/A * into equivalent global zone NFS mounted pathnames. At present 2N/A * it only works for automounted filesystems. It depends on the 2N/A * assumption that both the local and global zone automounters 2N/A * share the same nameservices. It also assumes that any automount 2N/A * map used by a local zone is available to the global zone automounter. 2N/A * The algorithm used consists of three phases. 2N/A * 1. The local zone's mnttab is searched to find the automount map 2N/A * with the closest matching mountpath. 2N/A * 2. The matching autmount map name is looked up in the global zone's 2N/A * mnttab to determine the path where it should be mounted in the 2N/A * 3. A pathname covered by an appropiate autofs trigger mount in 2N/A * the global zone is generated as the resolved pathname 2N/A * Among the things that can go wrong is that global zone doesn't have 2N/A * a matching automount map or the mount was not done via the automounter. 2N/A * Either of these cases return a NULL path. 2N/A * First we need to get the zonename to look for 2N/A * Find the best match for an automount map that 2N/A * corresponds to the local zone's pathname 2N/A * Now we may have found the corresponding autofs mount 2N/A * Try to find the matching global zone autofs entry 2N/A * OK, we have a matching global zone automap 2N/A * so adjust the path for the global zone. 2N/A * If both global zone and zone-relative 2N/A * mountpoint match, just use the same pathname 2N/A * Find the pathname for the entry in mlist that corresponds to the 2N/A * file named by path (i.e., that names a mount table entry for the 2N/A * file system in which path lies). 2N/A * Return 0 is there an error. 2N/A * Handle interesting mounts. 2N/A * count up what's left 2N/A * If this is a cross-zone reference to 2N/A * a home directory, it must be corrected. 2N/A * We should only get here if the zone's 2N/A * automounter hasn't yet mounted its 2N/A * autofs trigger on /home. 2N/A * Since it is likely to do so in the 2N/A * future, we will assume that the global 2N/A * zone already has an equivalent autofs 2N/A * mount established. By convention, 2N/A * this should be mounted at the 2N/A * This function is only useful for global zone callers 2N/A * It uses the global zone mnttab to translate local zone pathnames 2N/A * into global zone pathnames. 2N/A * Construct the list of mounted file systems. 2N/A}
/* end getpathbylabel() */