platform.c revision b0daa853ddd4c48b6374b8ac0dca46629b225c39
49ef7e0638c8b771d8a136eae78b1c0f99acc8e0Garrett D'Amore * CDDL HEADER START
49ef7e0638c8b771d8a136eae78b1c0f99acc8e0Garrett D'Amore * The contents of this file are subject to the terms of the
49ef7e0638c8b771d8a136eae78b1c0f99acc8e0Garrett D'Amore * Common Development and Distribution License (the "License").
49ef7e0638c8b771d8a136eae78b1c0f99acc8e0Garrett D'Amore * You may not use this file except in compliance with the License.
49ef7e0638c8b771d8a136eae78b1c0f99acc8e0Garrett D'Amore * You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE
49ef7e0638c8b771d8a136eae78b1c0f99acc8e0Garrett D'Amore * or http://www.opensolaris.org/os/licensing.
49ef7e0638c8b771d8a136eae78b1c0f99acc8e0Garrett D'Amore * See the License for the specific language governing permissions
49ef7e0638c8b771d8a136eae78b1c0f99acc8e0Garrett D'Amore * and limitations under the License.
49ef7e0638c8b771d8a136eae78b1c0f99acc8e0Garrett D'Amore * When distributing Covered Code, include this CDDL HEADER in each
49ef7e0638c8b771d8a136eae78b1c0f99acc8e0Garrett D'Amore * file and include the License file at usr/src/OPENSOLARIS.LICENSE.
49ef7e0638c8b771d8a136eae78b1c0f99acc8e0Garrett D'Amore * If applicable, add the following below this CDDL HEADER, with the
49ef7e0638c8b771d8a136eae78b1c0f99acc8e0Garrett D'Amore * fields enclosed by brackets "[]" replaced with your own identifying
49ef7e0638c8b771d8a136eae78b1c0f99acc8e0Garrett D'Amore * information: Portions Copyright [yyyy] [name of copyright owner]
49ef7e0638c8b771d8a136eae78b1c0f99acc8e0Garrett D'Amore * CDDL HEADER END
49ef7e0638c8b771d8a136eae78b1c0f99acc8e0Garrett D'Amore * Copyright 2009 Sun Microsystems, Inc. All rights reserved.
49ef7e0638c8b771d8a136eae78b1c0f99acc8e0Garrett D'Amore * Use is subject to license terms.
49ef7e0638c8b771d8a136eae78b1c0f99acc8e0Garrett D'Amore * platform.c -- interfaces to the platform's configuration information
49ef7e0638c8b771d8a136eae78b1c0f99acc8e0Garrett D'Amore * this platform.c allows eft to run on Solaris systems.
49ef7e0638c8b771d8a136eae78b1c0f99acc8e0Garrett D'Amoreextern fmd_hdl_t *Hdl; /* handle from eft.c */
49ef7e0638c8b771d8a136eae78b1c0f99acc8e0Garrett D'Amore * Lastcfg points to the last configuration snapshot we made.
49ef7e0638c8b771d8a136eae78b1c0f99acc8e0Garrett D'Amorestatic const char *lastcomp;
topo_use_free(void *p)
static char *Root;
static char *Mach;
static char *Plat;
platform_init(void)
platform_fini(void)
* this is an internal platform.c helper routine
static struct node *
const char *sname;
char *ename;
char *eid;
return (NULL);
for (e = 0; e < hc_nprs; e++) {
return (pathtree);
struct node *
char *scheme;
char *path;
char *devid;
return (NULL);
return (NULL);
return (NULL);
return (NULL);
return (NULL);
in_getpath = 0;
return (NULL);
switch (type) {
case DT_DEV:
case DT_DEVID:
case DT_CPU:
in_getpath = 0;
return (ret);
int i, err;
return (NULL);
return (NULL);
for (i = 0; i < nhc; ++i) {
if (err) {
return (NULL);
return (NULL);
return (tmpbuf);
boolean_t bool;
case DATA_TYPE_STRING:
case DATA_TYPE_NVLIST:
case DATA_TYPE_UINT64:
case DATA_TYPE_BOOLEAN_VALUE:
case DATA_TYPE_INT32:
case DATA_TYPE_INT64:
case DATA_TYPE_UINT32:
return (TOPO_WALK_NEXT);
return (TOPO_WALK_ERR);
return (TOPO_WALK_NEXT);
&propn);
pv_nvp);
return (TOPO_WALK_NEXT);
sizeof (size_t));
cfglen);
sizeof (cfglen));
if (cfglen != 0) {
struct cfgdata *
platform_config_snapshot(void)
int err;
return (Lastcfg);
return (Lastcfg);
const char *fmristr;
return (NULL);
return (NULL);
return (fmristr);
const char *fmristr;
char *serial;
int err;
serial);
static char *nullav;
dirname[i]);
if (nodups != 0) {
(void *)snm,
dirname[i],
snm);
(void *)snm,
(void *)snm,
NULL);
slots * sizeof (char *));
if (nfiles == 0)
return (&nullav);
return (files);
char **flist;
return (flist);
int rt = 0;
} else if (pid) {
return (rt);
switch (np->t) {
case T_QUOTE:
case T_LIST:
case T_FUNC:
case T_GLOBID:
case T_ASSIGN:
case T_CONDIF:
case T_CONDELSE:
case T_EQ:
case T_NE:
case T_LT:
case T_LE:
case T_GT:
case T_GE:
case T_BITAND:
case T_BITOR:
case T_BITXOR:
case T_BITNOT:
case T_LSHIFT:
case T_RSHIFT:
case T_AND:
case T_OR:
case T_NOT:
case T_ADD:
case T_SUB:
case T_MUL:
case T_DIV:
case T_MOD: {
0, &value))
switch (value.t) {
case UINT64:
case STRING:
case NODEPTR :
case T_NUM:
case T_TIMEVAL:
case T_NAME:
case T_EVENT:
char **files;
sizeof (char *) * *argvlen);
(*argc)++;
int i, ret;
argc = 0;
argvlen = 0;
argc == 0)
int exec_bit_set = 0;
if (exec_bit_set == 0)
argv[0]);
envc = 0;
envplen = 0;
for (i = 0; i < envc; i++)
if (envp)
if (ret) {
char *ptr;
for (i = 0; i < argc; i++)
return (ret);
platform_get_eft_files(void)
f = flist;
while (*f != NULL) {
FREE(*f);
endname--;
indexptr++;
indexend--;
int not_array = 0;
unsigned int index = 0;
propstr);
int ier;
if (ier == 0) {
if (ier) {
lastnameptr = w;
if (not_array)
case DATA_TYPE_BOOLEAN:
case DATA_TYPE_BOOLEAN_VALUE: {
case DATA_TYPE_BYTE: {
case DATA_TYPE_STRING: {
char *val;
case DATA_TYPE_INT8: {
case DATA_TYPE_UINT8: {
case DATA_TYPE_INT16: {
case DATA_TYPE_UINT16: {
case DATA_TYPE_INT32: {
case DATA_TYPE_UINT32: {
case DATA_TYPE_INT64: {
case DATA_TYPE_UINT64: {
case DATA_TYPE_BOOLEAN_ARRAY: {
goto invalid;
case DATA_TYPE_BYTE_ARRAY: {
goto invalid;
case DATA_TYPE_STRING_ARRAY: {
char **val;
goto invalid;
case DATA_TYPE_INT8_ARRAY: {
goto invalid;
case DATA_TYPE_UINT8_ARRAY: {
goto invalid;
case DATA_TYPE_INT16_ARRAY: {
goto invalid;
case DATA_TYPE_UINT16_ARRAY: {
goto invalid;
case DATA_TYPE_INT32_ARRAY: {
goto invalid;
case DATA_TYPE_UINT32_ARRAY: {
goto invalid;
case DATA_TYPE_INT64_ARRAY: {
goto invalid;
case DATA_TYPE_UINT64_ARRAY: {
goto invalid;
propstr);
struct evalue *
char *nvpname;
*nvals = 0;
return (NULL);
case DATA_TYPE_NVLIST: {
&scheme) == 0) {
retvals->v =
return (retvals);
return (NULL);
case DATA_TYPE_NVLIST_ARRAY: {
int hccount;
return (NULL);
hccount = 0;
for (i = 0; i < nel; i++) {
&scheme) == 0 &&
hccount++;
if (hccount == 0)
return (NULL);
hccount = 0;
for (i = 0; i < nel; i++) {
&scheme) == 0 &&
hccount++;
return (retvals);
case DATA_TYPE_BOOLEAN:
case DATA_TYPE_BOOLEAN_VALUE: {
return (retvals);
case DATA_TYPE_BYTE: {
return (retvals);
case DATA_TYPE_STRING: {
char *val;
return (retvals);
case DATA_TYPE_INT8: {
return (retvals);
case DATA_TYPE_UINT8: {
return (retvals);
case DATA_TYPE_INT16: {
return (retvals);
case DATA_TYPE_UINT16: {
return (retvals);
case DATA_TYPE_INT32: {
return (retvals);
case DATA_TYPE_UINT32: {
return (retvals);
case DATA_TYPE_INT64: {
return (retvals);
case DATA_TYPE_UINT64: {
return (retvals);
case DATA_TYPE_BOOLEAN_ARRAY: {
for (i = 0; i < nel; i++) {
return (retvals);
case DATA_TYPE_BYTE_ARRAY: {
for (i = 0; i < nel; i++) {
return (retvals);
case DATA_TYPE_STRING_ARRAY: {
char **val;
for (i = 0; i < nel; i++) {
return (retvals);
case DATA_TYPE_INT8_ARRAY: {
for (i = 0; i < nel; i++) {
return (retvals);
case DATA_TYPE_UINT8_ARRAY: {
for (i = 0; i < nel; i++) {
return (retvals);
case DATA_TYPE_INT16_ARRAY: {
for (i = 0; i < nel; i++) {
return (retvals);
case DATA_TYPE_UINT16_ARRAY: {
for (i = 0; i < nel; i++) {
return (retvals);
case DATA_TYPE_INT32_ARRAY: {
for (i = 0; i < nel; i++) {
return (retvals);
case DATA_TYPE_UINT32_ARRAY: {
for (i = 0; i < nel; i++) {
return (retvals);
case DATA_TYPE_INT64_ARRAY: {
for (i = 0; i < nel; i++) {
return (retvals);
case DATA_TYPE_UINT64_ARRAY: {
for (i = 0; i < nel; i++) {
return (retvals);
return (NULL);
const struct ipath *
char *scheme;
return (NULL);
return (NULL);
return (NULL);
return (ip);