topo_fmri.c revision 3cb1d85271919d3a09b22d2e6955363b1bb8d2f8
/*
* 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 2007 Sun Microsystems, Inc. All rights reserved.
* Use is subject to license terms.
*/
#pragma ident "%Z%%M% %I% %E% SMI"
#include <string.h>
#include <limits.h>
#include <fm/topo_mod.h>
#include <topo_alloc.h>
#include <topo_error.h>
#include <topo_method.h>
#include <topo_subr.h>
#include <topo_string.h>
/*ARGSUSED*/
static int
{
topo_strerror(err));
return (-1);
}
/*ARGSUSED*/
static nvlist_t *
{
topo_strerror(err));
return (NULL);
}
int
{
TOPO_METH_NVL2STR, out));
TOPO_METH_NVL2STR, out));
TOPO_METH_NVL2STR, out));
TOPO_METH_NVL2STR, out));
return (0);
}
int
int *err)
{
TOPO_METH_STR2NVL, in));
*f = '\0'; /* strip trailing FMRI path */
TOPO_METH_STR2NVL, in));
in));
in));
TOPO_METH_STR2NVL, in));
return (0);
}
/* ARGSUSED */
static int
{
int err;
return (present);
}
return (present);
}
int
{
int ret = 0;
char *scheme;
return (ret);
TOPO_METH_PRESENT, out));
TOPO_METH_PRESENT, out));
return (present);
}
return (present);
}
int
{
int rc;
char *scheme;
out));
out));
out));
return (rc);
}
int
{
int rc;
char *scheme;
return (rc);
}
int
{
char *scheme;
TOPO_METH_EXPAND, out));
TOPO_METH_EXPAND, out));
return (0);
}
struct prop_lookup {
int pl_err;
const char *pl_group;
const char *pl_name;
};
static int
{
int rc;
return (TOPO_WALK_ERR);
if (rc == 0)
return (TOPO_WALK_NEXT);
if (rc < 0)
return (TOPO_WALK_ERR);
/*
* Special case for dynamically created ASRU and FRU
*/
return (TOPO_WALK_ERR);
}
return (0);
return (TOPO_WALK_ERR);
}
return (0);
}
}
case TOPO_TYPE_STRING:
{
char *str;
return (TOPO_WALK_ERR);
!= 0) {
return (TOPO_WALK_ERR);
}
return (TOPO_WALK_TERMINATE);
}
default:
return (TOPO_WALK_ERR);
}
}
static int
{
int rc;
char *scheme;
struct prop_lookup pl;
"fmri_prop", NULL));
if (rc == TOPO_WALK_ERR) {
}
/*
* Walk terminated without finding resource or property
*/
NULL));
return (0);
}
int
{
return (0);
}
int
{
return (0);
}
int
{
char *str;
NULL));
}
nvl));
"topo_fmri_label", nvl));
return (0);
}
int
{
int rc;
return (0);
NULL));
in));
return (rc);
}
struct topo_invoke {
int tl_ret;
void *tl_pdata;
};
static int
{
int rc;
return (TOPO_WALK_ERR);
if (rc == 0)
return (TOPO_WALK_NEXT);
else if (rc == -1)
return (TOPO_WALK_ERR);
return (TOPO_WALK_TERMINATE);
}
int
{
int err;
char *scheme;
struct topo_invoke tl;
"topo_fmri_invoke", NULL));
if (err == TOPO_WALK_ERR) {
return (-1);
}
return (0);
}
/*
* topo_fmri_create
*
* If possible, creates an FMRI of the requested version in the
* requested scheme. Args are passed as part of the inputs to the
* fmri-create method of the scheme.
*/
nvlist_t *
{
TOPO_METH_FMRI, NULL));
TOPO_METH_FMRI, NULL));
TOPO_METH_FMRI, ins));
}
TOPO_METH_FMRI, ins));
}
if (topo_method_invoke(rnode,
}
return (out);
}