FreeBSD/cddl/contrib/opensolaris/lib/libzfs/common/libzfs_config.c
/*
 * Iterate over root datasets, calling the given function for each.  The zfs
 * handle passed each time must be explicitly closed by the callback.
 */
Iterate over root datasets, calling the given function for each.  The zfs
handle passed each time must be explicitly closed by the callback.
Iterate over root datasets calling the given function for each . The zfs handle passed each time must be explicitly closed by the callback .
int
zfs_iter_root(libzfs_handle_t *hdl, zfs_iter_f func, void *data)
{
	config_node_t *cn;
	zfs_handle_t *zhp;
	int ret;
	if (namespace_reload(hdl) != 0)
		return (-1);
	for (cn = uu_avl_first(hdl->libzfs_ns_avl); cn != NULL;
	    cn = uu_avl_next(hdl->libzfs_ns_avl, cn)) {
		if (check_restricted(cn->cn_name))
			continue;
		if ((zhp = make_dataset_handle(hdl, cn->cn_name)) == NULL)
			continue;
		if ((ret = func(zhp, data)) != 0)
			return (ret);
	}
	return (0);
}
int zfs_iter_root ( libzfs_handle_t * hdl , zfs_iter_f func , void * data ) { config_node_t * cn ; zfs_handle_t * zhp ; int ret ; if ( namespace_reload ( hdl ) != 0 ) return ( -1 ) ; for ( cn = uu_avl_first ( hdl -> libzfs_ns_avl ) ; cn != NULL ; cn = uu_avl_next ( hdl -> libzfs_ns_avl , cn ) ) { if ( check_restricted ( cn -> cn_name ) ) continue ; if ( ( zhp = make_dataset_handle ( hdl , cn -> cn_name ) ) == NULL ) continue ; if ( ( ret = func ( zhp , data ) ) != 0 ) return ( ret ) ; } return ( 0 ) ; }
Iterate over root datasets, calling the given function for each.
Iterate over root datasets calling the given function for each .