Lines Matching defs:path

89 	 * ignore lofs mounts where the source path is the same
90 * as the target path. (This can happen when a non-global
92 * the source path can't expose information about global
126 pn_push(path_node_t **pnp, char *path)
133 if ((pn->pn_path = strdup(path)) == NULL) {
162 pn_pop(path_node_t **pnp, char *path)
173 if (path == NULL) {
177 (void) strlcpy(path, pn->pn_path, PATH_MAX);
179 return (path);
297 * Plofspath() takes a path, "path", and removes any lofs components from
298 * that path. The resultant path (if different from the starting path)
300 * value is the pointer s. If there are no lofs components in the path
301 * the NULL is returned and s is not modified. It's ok for "path" and
303 * in the input buffer.) The path that is passed in must be an absolute
304 * path.
307 * if "path" == "/foo/bar", and "/candy/" is lofs mounted on "/foo/"
311 Plofspath(const char *path, char *s, size_t n)
319 dprintf("Plofspath path '%s'\n", path);
322 if (path[0] != '/')
325 /* Make a copy of the path so that we can muck with it */
326 (void) strlcpy(tmp, path, sizeof (tmp) - 1);
330 * trailing '/'s in the path.
351 * So now we're going to search the path for any components that
353 * path and then step back through each parent directly till
354 * we reach the root. If we find a lofs mount point in the path
355 * then we'll replace the initial portion of the path (up
361 * tmp - A pointer to our working copy of the path. Sometimes
362 * this path will be divided into two strings by a
365 * string is the path components we've already checked.
372 * Initially, p will point to the end of our path and p[1] will point
383 * We found a lofs mount. Update the path that we're
385 * portion of the path we've already checked to the
389 * in the path.
416 * We know that tmp was an absolute path, so if we
419 * to check the whole path and so we're done.
424 /* Restore the leading '/' in the path */
427 if (strcmp(tmp, path) == 0) {
428 /* The path didn't change */
433 * It's possible that lofs source path we just
442 * It's always possible that our lofs source path is
444 * recursively to resolve that path.
448 /* Copy out our final resolved lofs source path */
450 dprintf("Plofspath path result '%s'\n", s);
455 * So the path we just checked is not a lofs mount. Next we
456 * want to check the parent path component for a lofs mount.
463 * the part of the path that we've already verified so there
470 * Second, replace the last '/' in the part of the path
473 * path.
482 * Pzonepath() - Way too much code to attempt to derive the full path of
485 * Pzonepath() takes a path and attempts to resolve it relative to the
491 * We can't simply append the file path to the zone root, because in
493 * links that specify an absolute path need to be interpreted relative
499 * special version of resolvepath() which took an addition root path
501 * that we want to have special handling for native paths. (A native path
502 * is a path that begins with "/native/" or "/.SUNWnative/".) Native
504 * in a symlink that is part of the path passed into this function.
507 * a resolvepath() on a native path when the zone wasn't booted the
511 * Given all these constraints, we just implement a path walking function
512 * that resolves a file path relative to a zone root by manually inspecting
513 * each of the path components and verifying its existence. This means that
515 * path must exist for this operation to succeed.
518 Pzonepath(struct ps_prochandle *P, const char *path, char *s, size_t n)
526 dprintf("Pzonepath lookup '%s'\n", path);
533 * Make a temporary copy of the path specified.
534 * If it's a relative path then make it into an absolute path.
537 if (path[0] != '/')
539 (void) strlcat(tmp, path, sizeof (tmp));
542 * If the path that was passed in is the zone root, we're done.
543 * If the path that was passed in already contains the zone root
544 * then strip the zone root out and verify the rest of the path.
548 dprintf("Pzonepath found zone path (1) '%s'\n", zroot);
556 /* If no path is passed in, then it maps to the zone root */
559 dprintf("Pzonepath found zone path (2) '%s'\n", zroot);
565 * Push each path component that we plan to verify onto a stack of
566 * path components, with parent components at the top of the stack.
567 * So for example, if we're going to verify the path /foo/bar/bang
581 /* We're going to store the final zone relative path in zpath */
586 * Drop zero length path components (which come from
587 * consecutive '/'s) and '.' path components.
593 * Check the current path component for '..', if found
594 * drop any previous path component.
602 /* The path we want to verify now is zpath + / + tmp. */
612 * that they exist in the global zone with the same path sans
623 /* Reconstruct the path from our path component stack */
630 /* Verify that the path actually exists */
633 dprintf("Pzonepath invalid native path '%s'\n",
639 /* Return the path */
640 dprintf("Pzonepath found native path '%s'\n", tmp);
647 * Check if the path points to a symlink. We do this
661 * around and check the next path component.
680 /* Save this symlink path for future loop checks */
698 * Push each path component of the symlink target onto our
699 * path components stack since we need to verify each one.
717 * Relative symlink. Push the first path component of the
719 * remove the current path component from zpath.
738 dprintf("Pzonepath found zone path (3) '%s'\n", zpath);
745 Pfindobj(struct ps_prochandle *P, const char *path, char *s, size_t n)
749 dprintf("Pfindobj '%s'\n", path);
752 if (path[0] != '/')
755 /* First try to resolve the path to some zone */
756 if (Pzonepath(P, path, s, n) != NULL)
759 /* If that fails resolve any lofs links in the path */
760 if (Plofspath(path, s, n) != NULL)
763 /* If that fails then just see if the path exists */
764 if ((len = resolvepath(path, s, n)) > 0) {
798 (void) snprintf(buf, sizeof (buf), "%s/%d/path/%s",
810 * try to expand it on the current system to a real object path.