/*
* 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
*/
/*
*/
#include <ctype.h>
#include <stdio.h>
#include <strings.h>
#include <time.h>
#include <topo_parse.h>
#include <topo_prop.h>
#include <topo_tree.h>
#include <topo_subr.h>
/* 2 bytes for "0x" + 16 bytes for the hex value + 1 for sign + null */
void
{
}
void
{
}
}
void
{
}
}
void
{
}
/*
* Special character escape sequences.
*/
static struct {
char c;
char *esc;
} c2esc[] = {
{ '&', "&" },
{ '<', "<" },
{ '>', ">" },
{ '"', """ },
{ '\'', "'" }
};
static int
{
return (-1);
/*
* Parse the string for special characters that must be
* escaped, and calculate the length of the new string.
*/
/*
* If the character is non-printable, replace it with '-'.
*/
"%s: [%d]: non-printable char\n", __func__, i);
oldstrp[i] = '-';
newlen++;
continue;
}
for (j = 0; j < nent; j++) {
break;
}
if (j < nent) {
"%s: [%d]: special char=%c, newlen=%d\n",
} else {
newlen++;
}
}
/*
* If no special characters were found just return,
* else allocate a new string.
*/
return (0);
return (-1);
/*
* Replace any special characters with their escape sequences.
*/
for (j = 0; j < nent; j++) {
break;
}
if (j < nent) {
"%s: [%d]: special char=%c, newstr=%s\n",
} else {
}
}
return (0);
}
static void
{
int err;
case TOPO_TYPE_INT32: {
&err) == 0) {
} else
return;
break;
}
case TOPO_TYPE_UINT32: {
} else
return;
break;
}
case TOPO_TYPE_INT64: {
&err) == 0) {
(longlong_t)val);
} else
return;
break;
}
case TOPO_TYPE_UINT64: {
(u_longlong_t)val);
} else
return;
break;
}
case TOPO_TYPE_STRING: {
return;
return;
break;
}
case TOPO_TYPE_FMRI: {
&err) == 0) {
== 0) {
} else {
return;
}
} else
return;
break;
}
case TOPO_TYPE_UINT32_ARRAY: {
return;
/*
* This does not generating proper XML arrays.
* Note that if we fix this then we must also fix the
* fabric translator module which parses the existing
* uint32_array property "assigned-addresses".
*/
if (nelem > 0) {
return;
}
for (i = 1; i < nelem; i++) {
}
}
break;
}
default:
return;
}
}
static void
{
}
}
static void
{
return;
}
static void
{
}
}
static int
{
/*
* Some enumerators create empty ranges: make sure there
* are real nodes before creating this range
*/
++create;
}
if (!create)
continue;
if (dependent) {
dependent = 0;
ret = 1;
}
}
}
return (ret);
}
static void
{
&sys_mfg);
&sys_name);
&sys_pn);
&sys_sn);
&sc_mfg);
&sc_name);
&sc_pn);
&sc_sn);
&ch_mfg);
&ch_name);
&ch_pn);
&ch_sn);
"scheme=%s, uuid=%s, timestamp=%s=%s\n"
"system-mfg=%s, system-name=%s, system-part=%s, system-serial=%s\n"
"sys-comp-mfg=%s, sys-comp-name=%s, sys-comp-part=%s "
"sys-comp-serial=%s\nchassis-mfg=%s, chassis-name=%s "
"chassis-part=%s, chassis-serial=%s\n",
}
int
{
return (0);
}
}
return (-1);
}