topo_parse.h revision e5dcf7beb7c949f9234713d5818b581ec3825443
7aec1d6e253b21f9e9b7ef68b4d81ab9859b51fecindi * CDDL HEADER START
7aec1d6e253b21f9e9b7ef68b4d81ab9859b51fecindi * The contents of this file are subject to the terms of the
7aec1d6e253b21f9e9b7ef68b4d81ab9859b51fecindi * Common Development and Distribution License (the "License").
7aec1d6e253b21f9e9b7ef68b4d81ab9859b51fecindi * You may not use this file except in compliance with the License.
7aec1d6e253b21f9e9b7ef68b4d81ab9859b51fecindi * You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE
7aec1d6e253b21f9e9b7ef68b4d81ab9859b51fecindi * See the License for the specific language governing permissions
7aec1d6e253b21f9e9b7ef68b4d81ab9859b51fecindi * and limitations under the License.
7aec1d6e253b21f9e9b7ef68b4d81ab9859b51fecindi * When distributing Covered Code, include this CDDL HEADER in each
7aec1d6e253b21f9e9b7ef68b4d81ab9859b51fecindi * file and include the License file at usr/src/OPENSOLARIS.LICENSE.
7aec1d6e253b21f9e9b7ef68b4d81ab9859b51fecindi * If applicable, add the following below this CDDL HEADER, with the
7aec1d6e253b21f9e9b7ef68b4d81ab9859b51fecindi * fields enclosed by brackets "[]" replaced with your own identifying
7aec1d6e253b21f9e9b7ef68b4d81ab9859b51fecindi * information: Portions Copyright [yyyy] [name of copyright owner]
7aec1d6e253b21f9e9b7ef68b4d81ab9859b51fecindi * CDDL HEADER END
e5dcf7beb7c949f9234713d5818b581ec3825443Robert Johnston * Copyright 2009 Sun Microsystems, Inc. All rights reserved.
7aec1d6e253b21f9e9b7ef68b4d81ab9859b51fecindi * Use is subject to license terms.
7aec1d6e253b21f9e9b7ef68b4d81ab9859b51fecindiextern "C" {
0eb822a1c0c2bea495647510b75f77f0e57633ebcindi#define TOPO_DTD_PATH "/usr/share/lib/xml/dtd/topology.dtd.1"
7aec1d6e253b21f9e9b7ef68b4d81ab9859b51fecindi * Plenty of room to hold string representation of an instance
7aec1d6e253b21f9e9b7ef68b4d81ab9859b51fecindi * Forward declaration
7aec1d6e253b21f9e9b7ef68b4d81ab9859b51fecindi * This structure summarizes an enumerator as described by an xml
7aec1d6e253b21f9e9b7ef68b4d81ab9859b51fecindi * topology file.
7aec1d6e253b21f9e9b7ef68b4d81ab9859b51fecinditypedef struct tf_edata {
7aec1d6e253b21f9e9b7ef68b4d81ab9859b51fecindi topo_stability_t te_stab; /* stability of the enumerator, if any */
0eb822a1c0c2bea495647510b75f77f0e57633ebcindi topo_version_t te_vers; /* version of the enumerator, if any */
7aec1d6e253b21f9e9b7ef68b4d81ab9859b51fecindi/* properties and dependents off of an instance or a range */
7aec1d6e253b21f9e9b7ef68b4d81ab9859b51fecinditypedef struct tf_pad {
7aec1d6e253b21f9e9b7ef68b4d81ab9859b51fecindi int tpad_pgcnt; /* number of property-groups of node */
7aec1d6e253b21f9e9b7ef68b4d81ab9859b51fecindi int tpad_dcnt; /* number of dependents groups of node */
7aec1d6e253b21f9e9b7ef68b4d81ab9859b51fecinditypedef struct tf_idata {
7aec1d6e253b21f9e9b7ef68b4d81ab9859b51fecindi tnode_t *ti_tn; /* topology node representing the instance */
7aec1d6e253b21f9e9b7ef68b4d81ab9859b51fecindi * This structure summarizes a topology node range as described by a
7aec1d6e253b21f9e9b7ef68b4d81ab9859b51fecindi * topology file.
7aec1d6e253b21f9e9b7ef68b4d81ab9859b51fecinditypedef struct tf_rdata {
7aec1d6e253b21f9e9b7ef68b4d81ab9859b51fecindi struct tf_rdata *rd_next; /* for linking a group of tf_rdatas */
7aec1d6e253b21f9e9b7ef68b4d81ab9859b51fecindi struct tf_info *rd_finfo; /* pointer back to .xml file details */
7aec1d6e253b21f9e9b7ef68b4d81ab9859b51fecindi topo_mod_t *rd_mod; /* pointer to loaded enumerator */
7aec1d6e253b21f9e9b7ef68b4d81ab9859b51fecindi tf_edata_t *rd_einfo; /* enumerator information, if any */
7aec1d6e253b21f9e9b7ef68b4d81ab9859b51fecindi * While we're parsing we need a handy way to pass around the data
7aec1d6e253b21f9e9b7ef68b4d81ab9859b51fecindi * related to what we're currently parsing, what topology nodes may be
7aec1d6e253b21f9e9b7ef68b4d81ab9859b51fecindi * affected, etc.
7aec1d6e253b21f9e9b7ef68b4d81ab9859b51fecinditypedef struct tf_info {
7aec1d6e253b21f9e9b7ef68b4d81ab9859b51fecindi /* UUID ? */
7aec1d6e253b21f9e9b7ef68b4d81ab9859b51fecindi uint_t tf_flags; /* behavior modifiers (see values below) */
7aec1d6e253b21f9e9b7ef68b4d81ab9859b51fecindi tf_rdata_t *tf_rd; /* data for forming topology nodes */
4557a2a1868181b517f5dfe61ba6eeba58edf4c0robj#define TF_LIVE 0x1 /* Parsing should create topology nodes */
4557a2a1868181b517f5dfe61ba6eeba58edf4c0robj#define TF_BIN 0x2 /* Parsing should create intermediate binary */
4557a2a1868181b517f5dfe61ba6eeba58edf4c0robj#define TF_PROPMAP 0x4 /* XML file loaded from a propmap element */
7aec1d6e253b21f9e9b7ef68b4d81ab9859b51fecindi * We store properties using nvlists as an intermediate form. The
7aec1d6e253b21f9e9b7ef68b4d81ab9859b51fecindi * following defines are names for fields in this intermediate form.
0eb822a1c0c2bea495647510b75f77f0e57633ebcindi * Valid .xml element and attribute names
0eb822a1c0c2bea495647510b75f77f0e57633ebcindiextern tf_idata_t *tf_idata_lookup(tf_idata_t *, topo_instance_t);
7aec1d6e253b21f9e9b7ef68b4d81ab9859b51fecindiextern tf_idata_t *tf_idata_new(topo_mod_t *, topo_instance_t, tnode_t *);
7aec1d6e253b21f9e9b7ef68b4d81ab9859b51fecindiextern tf_info_t *topo_xml_read(topo_mod_t *, const char *, const char *);
0eb822a1c0c2bea495647510b75f77f0e57633ebcindiextern tf_info_t *tf_info_new(topo_mod_t *, xmlDocPtr, xmlChar *);
7aec1d6e253b21f9e9b7ef68b4d81ab9859b51fecindiextern void topo_xml_cleanup(topo_mod_t *, tf_info_t *);
7aec1d6e253b21f9e9b7ef68b4d81ab9859b51fecindiextern int topo_xml_range_process(topo_mod_t *, xmlNodePtr, tf_rdata_t *);
7aec1d6e253b21f9e9b7ef68b4d81ab9859b51fecindiextern int topo_xml_enum(topo_mod_t *, tf_info_t *, tnode_t *);
0eb822a1c0c2bea495647510b75f77f0e57633ebcindiextern int tf_idata_insert(tf_idata_t **, tf_idata_t *);
7aec1d6e253b21f9e9b7ef68b4d81ab9859b51fecindiextern int xmlattr_to_int(topo_mod_t *, xmlNodePtr, const char *, uint64_t *);
0eb822a1c0c2bea495647510b75f77f0e57633ebcindiextern int xmlattr_to_stab(topo_mod_t *, xmlNodePtr, const char *,
7aec1d6e253b21f9e9b7ef68b4d81ab9859b51fecindi#endif /* _TOPO_PARSE_H */