scheme.c revision 990b4856d0eaada6f8140335733a1b1771ed2746
ea8dc4b6d2251b437950c0056bc626b311c73c27eschrock * CDDL HEADER START
ea8dc4b6d2251b437950c0056bc626b311c73c27eschrock * The contents of this file are subject to the terms of the
ea8dc4b6d2251b437950c0056bc626b311c73c27eschrock * Common Development and Distribution License (the "License").
ea8dc4b6d2251b437950c0056bc626b311c73c27eschrock * You may not use this file except in compliance with the License.
ea8dc4b6d2251b437950c0056bc626b311c73c27eschrock * You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE
ea8dc4b6d2251b437950c0056bc626b311c73c27eschrock * See the License for the specific language governing permissions
ea8dc4b6d2251b437950c0056bc626b311c73c27eschrock * and limitations under the License.
ea8dc4b6d2251b437950c0056bc626b311c73c27eschrock * When distributing Covered Code, include this CDDL HEADER in each
ea8dc4b6d2251b437950c0056bc626b311c73c27eschrock * file and include the License file at usr/src/OPENSOLARIS.LICENSE.
ea8dc4b6d2251b437950c0056bc626b311c73c27eschrock * If applicable, add the following below this CDDL HEADER, with the
ea8dc4b6d2251b437950c0056bc626b311c73c27eschrock * fields enclosed by brackets "[]" replaced with your own identifying
ea8dc4b6d2251b437950c0056bc626b311c73c27eschrock * information: Portions Copyright [yyyy] [name of copyright owner]
ea8dc4b6d2251b437950c0056bc626b311c73c27eschrock * CDDL HEADER END
990b4856d0eaada6f8140335733a1b1771ed2746lling * Copyright 2007 Sun Microsystems, Inc. All rights reserved.
ea8dc4b6d2251b437950c0056bc626b311c73c27eschrock * Use is subject to license terms.
ea8dc4b6d2251b437950c0056bc626b311c73c27eschrock#pragma ident "%Z%%M% %I% %E% SMI"
ea8dc4b6d2251b437950c0056bc626b311c73c27eschrocktypedef struct cbdata {
990b4856d0eaada6f8140335733a1b1771ed2746lling if (zpool_get_prop_int(zhp, ZPOOL_PROP_GUID, NULL) == cbp->cb_guid) {
ea8dc4b6d2251b437950c0056bc626b311c73c27eschrock return (1);
ea8dc4b6d2251b437950c0056bc626b311c73c27eschrock return (0);
ea8dc4b6d2251b437950c0056bc626b311c73c27eschrockfmd_fmri_nvl2str(nvlist_t *nvl, char *buf, size_t buflen)
ea8dc4b6d2251b437950c0056bc626b311c73c27eschrock const char *name;
ea8dc4b6d2251b437950c0056bc626b311c73c27eschrock (void) nvlist_lookup_uint64(nvl, FM_FMRI_ZFS_POOL, &pool_guid);
ea8dc4b6d2251b437950c0056bc626b311c73c27eschrock * Attempt to convert the pool guid to a name.
ea8dc4b6d2251b437950c0056bc626b311c73c27eschrock (void) snprintf(guidbuf, sizeof (guidbuf), "%llx", pool_guid);
ea8dc4b6d2251b437950c0056bc626b311c73c27eschrock if (nvlist_lookup_uint64(nvl, FM_FMRI_ZFS_VDEV, &vdev_guid) == 0)
ea8dc4b6d2251b437950c0056bc626b311c73c27eschrock len = snprintf(buf, buflen, "%s://pool=%s/vdev=%llx",
ea8dc4b6d2251b437950c0056bc626b311c73c27eschrock (void) nvlist_lookup_uint64(nv, ZPOOL_CONFIG_GUID, &guid);
ea8dc4b6d2251b437950c0056bc626b311c73c27eschrock if (nvlist_lookup_nvlist_array(nv, ZPOOL_CONFIG_CHILDREN,
ea8dc4b6d2251b437950c0056bc626b311c73c27eschrock return (0);
ea8dc4b6d2251b437950c0056bc626b311c73c27eschrock for (c = 0; c < children; c++)
ea8dc4b6d2251b437950c0056bc626b311c73c27eschrock (void) nvlist_lookup_nvlist(config, ZPOOL_CONFIG_VDEV_TREE, &nvroot);
ea8dc4b6d2251b437950c0056bc626b311c73c27eschrock (void) nvlist_lookup_uint64(nvl, FM_FMRI_ZFS_POOL, &pool_guid);
ea8dc4b6d2251b437950c0056bc626b311c73c27eschrock return (0);
ea8dc4b6d2251b437950c0056bc626b311c73c27eschrock if (nvlist_lookup_uint64(nvl, FM_FMRI_ZFS_VDEV, &vdev_guid) != 0) {
ea8dc4b6d2251b437950c0056bc626b311c73c27eschrock return (1);
ea8dc4b6d2251b437950c0056bc626b311c73c27eschrock (void) nvlist_lookup_uint64(nvl, FM_FMRI_ZFS_POOL, &pool_guid);
ea8dc4b6d2251b437950c0056bc626b311c73c27eschrock return (1);
ea8dc4b6d2251b437950c0056bc626b311c73c27eschrock if (nvlist_lookup_uint64(nvl, FM_FMRI_ZFS_VDEV, &vdev_guid) != 0) {
ea8dc4b6d2251b437950c0056bc626b311c73c27eschrock ret = (zpool_get_state(cb.cb_pool) == POOL_STATE_UNAVAIL);
ea8dc4b6d2251b437950c0056bc626b311c73c27eschrock (void) nvlist_lookup_uint64_array(vd, ZPOOL_CONFIG_STATS,
99653d4ee642c6528e88224f12409a5f23060994eschrock return (-1);
99653d4ee642c6528e88224f12409a5f23060994eschrock return (0);