17aec1d6cindi/* 27aec1d6cindi * CDDL HEADER START 37aec1d6cindi * 47aec1d6cindi * The contents of this file are subject to the terms of the 57aec1d6cindi * Common Development and Distribution License (the "License"). 67aec1d6cindi * 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/* 22e5dcf7bRobert Johnston * Copyright 2009 Sun Microsystems, Inc. All rights reserved. 237aec1d6cindi * Use is subject to license terms. 247aec1d6cindi */ 257aec1d6cindi 267aec1d6cindi#include <strings.h> 277aec1d6cindi#include <assert.h> 287aec1d6cindi#include <fm/libtopo.h> 297aec1d6cindi#include <topo_prop.h> 307aec1d6cindi#include <topo_string.h> 317aec1d6cindi#include <topo_alloc.h> 327aec1d6cindi#include <topo_error.h> 33c40d734cindi#include <topo_method.h> 34c40d734cindi 35c40d734cindi/* 36c40d734cindi * Topology nodes are permitted to contain property information. 37c40d734cindi * Property information is organized according to property grouping. 38c40d734cindi * Each property group defines a name, a stability level for that name, 39c40d734cindi * a stability level for all underlying property data (name, type, values), 40c40d734cindi * a version for the property group definition and and a list of uniquely 41c40d734cindi * defined properties. Property group versions are incremented when one of 42c40d734cindi * the following changes occurs: 43c40d734cindi * - a property name changes 44c40d734cindi * - a property type changes 45c40d734cindi * - a property definition is removed from the group 46c40d734cindi * Compatible changes such as new property definitions in the group do 47c40d734cindi * not require version changes. 48c40d734cindi * 49c40d734cindi * Each property defines a unique (within the group) name, a type and 50c40d734cindi * a value. Properties may be statically defined as int32, uint32, int64, 51c40d734cindi * uint64, fmri, string or arrays of each type. Properties may also be 52c40d734cindi * dynamically exported via module registered methods. For example, a module 53c40d734cindi * may register a method to export an ASRU property that is dynamically 54c40d734cindi * contructed when a call to topo_node_fmri() is invoked for a particular 55c40d734cindi * topology node. 56c40d734cindi * 57c40d734cindi * Static properties are persistently attached to topology nodes during 58c40d734cindi * enumeration by an enumeration module or as part of XML statements in a 59c40d734cindi * toplogy map file using the topo_prop_set* family of routines. Similarly, 60c40d734cindi * property methods are registered during enumeration or as part of 61c40d734cindi * statements in topololgy map files. Set-up of property methods is performed 62c40d734cindi * by calling topo_prop_method_register(). 63c40d734cindi * 64c40d734cindi * All properties, whether statically persisted in a snapshot or dynamically 65c40d734cindi * obtained, may be read via the topo_prop_get* family of interfaces. 66c40d734cindi * Callers wishing to receive all property groups and properties for a given 67c40d734cindi * node may use topo_prop_getall(). This routine returns a nested nvlist 68c40d734cindi * of all groupings and property (name, type, value) sets. Groupings 69c40d734cindi * are defined by TOPO_PROP_GROUP (name, data stability, name stability and 70c40d734cindi * version) and a nested nvlist of properties (TOPO_PROP_VAL). Each property 71c40d734cindi * value is defined by its name, type and value. 72c40d734cindi */ 73c40d734cindistatic void topo_propval_destroy(topo_propval_t *); 747aec1d6cindi 757aec1d6cindistatic topo_pgroup_t * 76