topo_node.c revision 1e95bfe1233bd7a59421a96c6fa25601561073f3
17aec1d6cindi/*
27aec1d6cindi * CDDL HEADER START
37aec1d6cindi *
47aec1d6cindi * The contents of this file are subject to the terms of the
50eb822acindi * Common Development and Distribution License (the "License").
60eb822acindi * You may not use this file except in compliance with the License.
77aec1d6cindi *
87aec1d6cindi * You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE
97aec1d6cindi * or http://www.opensolaris.org/os/licensing.
107aec1d6cindi * See the License for the specific language governing permissions
117aec1d6cindi * and limitations under the License.
127aec1d6cindi *
137aec1d6cindi * When distributing Covered Code, include this CDDL HEADER in each
147aec1d6cindi * file and include the License file at usr/src/OPENSOLARIS.LICENSE.
157aec1d6cindi * If applicable, add the following below this CDDL HEADER, with the
167aec1d6cindi * fields enclosed by brackets "[]" replaced with your own identifying
177aec1d6cindi * information: Portions Copyright [yyyy] [name of copyright owner]
187aec1d6cindi *
197aec1d6cindi * CDDL HEADER END
207aec1d6cindi */
217aec1d6cindi/*
22f6e214cGavin Maltby * Copyright (c) 2006, 2010, Oracle and/or its affiliates. All rights reserved.
231e95bfeRob Johnston * Copyright (c) 2019, Joyent, Inc. All rights reserved.
247aec1d6cindi */
257aec1d6cindi
267aec1d6cindi/*
277aec1d6cindi * Topology Nodes
287aec1d6cindi *
297aec1d6cindi * Topology nodes, tnode_t, are data structures containing per-FMRI
307aec1d6cindi * information and are linked together to form the topology tree.
317aec1d6cindi * Nodes are created during the enumeration process of topo_snap_hold()
327aec1d6cindi * and destroyed during topo_snap_rele().  For the most part, tnode_t data
337aec1d6cindi * is read-only and no lock protection is required.  Nodes are
347aec1d6cindi * held in place during tree walk functions.  Tree walk functions
357aec1d6cindi * may access node data safely without locks.  The exception to this rule
367aec1d6cindi * is data associated with node properties (topo_prop.c).  Properties
377aec1d6cindi * may change at anytime and are protected by a per-property locking
387aec1d6cindi * strategy.
397aec1d6cindi *
40c40d734cindi * Enumerator plugin modules may also safely access topology nodes within their
41c40d734cindi * scope of operation: the parent node passed into the enumeration op or those
42c40d734cindi * nodes created by the enumerator.  Enumeration occurs only during
43c40d734cindi * topo_snap_hold() where a per-topo_hdl_t lock prevents multi-threaded access
44c40d734cindi * to the topology trees.
45