0eb822a1c0c2bea495647510b75f77f0e57633ebcindi * CDDL HEADER START
0eb822a1c0c2bea495647510b75f77f0e57633ebcindi * The contents of this file are subject to the terms of the
0eb822a1c0c2bea495647510b75f77f0e57633ebcindi * Common Development and Distribution License (the "License").
0eb822a1c0c2bea495647510b75f77f0e57633ebcindi * You may not use this file except in compliance with the License.
0eb822a1c0c2bea495647510b75f77f0e57633ebcindi * You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE
0eb822a1c0c2bea495647510b75f77f0e57633ebcindi * See the License for the specific language governing permissions
0eb822a1c0c2bea495647510b75f77f0e57633ebcindi * and limitations under the License.
0eb822a1c0c2bea495647510b75f77f0e57633ebcindi * When distributing Covered Code, include this CDDL HEADER in each
0eb822a1c0c2bea495647510b75f77f0e57633ebcindi * file and include the License file at usr/src/OPENSOLARIS.LICENSE.
0eb822a1c0c2bea495647510b75f77f0e57633ebcindi * If applicable, add the following below this CDDL HEADER, with the
0eb822a1c0c2bea495647510b75f77f0e57633ebcindi * fields enclosed by brackets "[]" replaced with your own identifying
0eb822a1c0c2bea495647510b75f77f0e57633ebcindi * information: Portions Copyright [yyyy] [name of copyright owner]
0eb822a1c0c2bea495647510b75f77f0e57633ebcindi * CDDL HEADER END
8393544efeffe8042bf5273c148010b32fa827e2Hyon Kim * Copyright (c) 2006, 2010, Oracle and/or its affiliates. All rights reserved.
0eb822a1c0c2bea495647510b75f77f0e57633ebcindi * FMD Topology Handling
0eb822a1c0c2bea495647510b75f77f0e57633ebcindi * Fault manager scheme and module plug-ins may need access to the latest
0eb822a1c0c2bea495647510b75f77f0e57633ebcindi * libtopo snapshot. Upon fmd initialization, a snapshot is taken and
0eb822a1c0c2bea495647510b75f77f0e57633ebcindi * made available via fmd_fmri_topology() and fmd_hdl_topology(). Each
0eb822a1c0c2bea495647510b75f77f0e57633ebcindi * of these routines returns a libtopo snapshot handle back to the caller.
0eb822a1c0c2bea495647510b75f77f0e57633ebcindi * New snapshots are taken if and when a DR event causes the DR generation
0eb822a1c0c2bea495647510b75f77f0e57633ebcindi * number to increase. The current snapshot is retained to assure consistency
0eb822a1c0c2bea495647510b75f77f0e57633ebcindi * for modules still using older snapshots and the latest snapshot handle is
0eb822a1c0c2bea495647510b75f77f0e57633ebcindi * returned to the caller.
24db46411fd54f70c35b94bb952eb7ba040e43b4eschrock fmd.d_stats->ds_topo_drgen.fmds_value.ui64 = fmd_fmri_get_drgen();
0eb822a1c0c2bea495647510b75f77f0e57633ebcindi * Update the topology snapshot.
0eb822a1c0c2bea495647510b75f77f0e57633ebcindi if ((tp = topo_open(TOPO_VERSION, name, &err)) == NULL)
07312882d9573a94daa8260c0744011540574003Eric Schrock ftp = fmd_alloc(sizeof (fmd_topo_t), FMD_SLEEP);
24db46411fd54f70c35b94bb952eb7ba040e43b4eschrock * We always keep a reference count on the last topo snapshot taken.
24db46411fd54f70c35b94bb952eb7ba040e43b4eschrock * Release the previous snapshot (if present), and set the current
24db46411fd54f70c35b94bb952eb7ba040e43b4eschrock * reference count to 1.
24db46411fd54f70c35b94bb952eb7ba040e43b4eschrock if ((prev = fmd_list_next(&fmd.d_topo_list)) != NULL)
24db46411fd54f70c35b94bb952eb7ba040e43b4eschrock for (ftp = fmd_list_next(&fmd.d_topo_list); ftp != NULL;
0eb822a1c0c2bea495647510b75f77f0e57633ebcindi while ((ftp = fmd_list_next(&fmd.d_topo_list)) != NULL) {