FreeBSD/cddl/contrib/opensolaris/lib/libzfs/common/libzfs_status.c
/*
 * Detect if any leaf devices that have seen errors or could not be opened.
 */
Detect if any leaf devices that have seen errors or could not be opened.
Detect if any leaf devices that have seen errors or could not be opened .
static boolean_t
find_vdev_problem(nvlist_t *vdev, int (*func)(vdev_stat_t *, uint_t),
    boolean_t ignore_replacing)
{
	nvlist_t **child;
	vdev_stat_t *vs;
	uint_t c, vsc, children;
	if (ignore_replacing == B_TRUE) {
		char *type;
		verify(nvlist_lookup_string(vdev, ZPOOL_CONFIG_TYPE,
		    &type) == 0);
		if (strcmp(type, VDEV_TYPE_REPLACING) == 0)
			return (B_FALSE);
	}
	if (nvlist_lookup_nvlist_array(vdev, ZPOOL_CONFIG_CHILDREN, &child,
	    &children) == 0) {
		for (c = 0; c < children; c++)
			if (find_vdev_problem(child[c], func, ignore_replacing))
				return (B_TRUE);
	} else {
		verify(nvlist_lookup_uint64_array(vdev, ZPOOL_CONFIG_VDEV_STATS,
		    (uint64_t **)&vs, &vsc) == 0);
		if (func(vs, vsc) != 0)
			return (B_TRUE);
	}
	if (nvlist_lookup_nvlist_array(vdev, ZPOOL_CONFIG_L2CACHE, &child,
	    &children) == 0) {
		for (c = 0; c < children; c++)
			if (find_vdev_problem(child[c], func, ignore_replacing))
				return (B_TRUE);
	}
	return (B_FALSE);
}
static boolean_t find_vdev_problem ( nvlist_t * vdev , int ( * func ) ( vdev_stat_t * , uint_t ) , boolean_t ignore_replacing ) { nvlist_t * * child ; vdev_stat_t * vs ; uint_t c , vsc , children ; if ( ignore_replacing == B_TRUE ) { char * type ; verify ( nvlist_lookup_string ( vdev , ZPOOL_CONFIG_TYPE , & type ) == 0 ) ; if ( strcmp ( type , VDEV_TYPE_REPLACING ) == 0 ) return ( B_FALSE ) ; } if ( nvlist_lookup_nvlist_array ( vdev , ZPOOL_CONFIG_CHILDREN , & child , & children ) == 0 ) { for ( c = 0 ; c < children ; c ++ ) if ( find_vdev_problem ( child [ c ] , func , ignore_replacing ) ) return ( B_TRUE ) ; } else { verify ( nvlist_lookup_uint64_array ( vdev , ZPOOL_CONFIG_VDEV_STATS , ( uint64_t * * ) & vs , & vsc ) == 0 ) ; if ( func ( vs , vsc ) != 0 ) return ( B_TRUE ) ; } if ( nvlist_lookup_nvlist_array ( vdev , ZPOOL_CONFIG_L2CACHE , & child , & children ) == 0 ) { for ( c = 0 ; c < children ; c ++ ) if ( find_vdev_problem ( child [ c ] , func , ignore_replacing ) ) return ( B_TRUE ) ; } return ( B_FALSE ) ; }
Detect if any leaf devices that have seen errors or could not be opened.
Detect if any leaf devices that have seen errors or could not be opened .
/*
	 * Ignore problems within a 'replacing' vdev, since we're presumably in
	 * the process of repairing any such errors, and don't want to call them
	 * out again.  We'll pick up the fact that a resilver is happening
	 * later.
	 */ /*
	 * Check any L2 cache devs
	 */