topo_tree.c revision 724365f7556fc4201fdb11766ebc6bd918523130
/*
* CDDL HEADER START
*
* The contents of this file are subject to the terms of the
* Common Development and Distribution License (the "License").
* You may not use this file except in compliance with the License.
*
* You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE
* See the License for the specific language governing permissions
* and limitations under the License.
*
* When distributing Covered Code, include this CDDL HEADER in each
* file and include the License file at usr/src/OPENSOLARIS.LICENSE.
* If applicable, add the following below this CDDL HEADER, with the
* fields enclosed by brackets "[]" replaced with your own identifying
* information: Portions Copyright [yyyy] [name of copyright owner]
*
* CDDL HEADER END
*/
/*
* Copyright 2006 Sun Microsystems, Inc. All rights reserved.
* Use is subject to license terms.
*/
#pragma ident "%Z%%M% %I% %E% SMI"
/*
* Topology Trees
*
* Toplogy trees are instantiated for each builtin (FMRI) scheme specified
* in topo_builtin.c. Each ttree_t data structure contains the
* skeleton of the topology tree (scheme, root node, and file information).
* The root node of a topology does not represent any FMRI but rather serves
* as the entry point for topology access interfaces. The file information
* provides a handle to access static .xml files that seed scheme-specifc
* topologies
*
* Topology trees will remain unpopulated until topo_snap_hold() is called.
* At that time, a ttree_t structure is allocated and added to the list
* trees maintained in topo_hdl_t. Builtin scheme-specific enumerators are
* called upon to create nodes that represent FMRIs for resources present in the
* system. If a <scheme>-topology.xml file exists in a standard file
* location, the file is used to seed the topology while the rest is
* dynamically created by the builtin or helper enumerator modules.
* For example, the 'hc' tree is enumerated by the hc enumerator (hc.c)
* is created with a properly formatted hc FMRI resource.
*
* Toplogy trees are released and deallocated when topo_snap_hold is called.
* Upon return from topo_snap_rele(), all node resources are deallocated
* and all that remains is the ttree_t structure containing the root node.
*/
#include <pthread.h>
#include <limits.h>
#include <assert.h>
#include <sys/systeminfo.h>
#include <topo_alloc.h>
#include <topo_error.h>
#include <topo_module.h>
#include <topo_string.h>
#include <topo_subr.h>
#include <topo_tree.h>
static ttree_t *
{
if (err != 0)
return (NULL);
}
static void
{
int err;
char platform[MAXNAMELEN];
char isa[MAXNAMELEN];
platform[0] = '\0';
isa[0] = '\0';
}
ttree_t *
{
/*
* Initialize a private walker for internal use
*/
/*
* Create the root of this tree: LINKED but never BOUND
*/
rp->tn_instance = 0;
return (tp);
}
void
{
return;
}
/*
* Deallocate this last, because a pointer alias for tt_scheme
* (stored in the root node's name field) may be used in
* topo_node_rele().
*/
}
static int
{
/*
* Attempt to populate the tree from a topology file
*/
/*
* If this tree does not have a matching static topology file,
* continue on.
*/
}
return (0);
}
int
{
int err = 0;
}
if (err != 0)
return (-1);
else
return (0);
}