dev.c revision 25c6ff4b77fcddf4097ce78a8277275ca603b46c
/*
* 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 2008 Sun Microsystems, Inc. All rights reserved.
* Use is subject to license terms.
*/
#pragma ident "%Z%%M% %I% %E% SMI"
#include <limits.h>
#include <strings.h>
#include <string.h>
#include <unistd.h>
#include <stdio.h>
#include <alloca.h>
#include <devid.h>
#include <libnvpair.h>
#include <fm/topo_mod.h>
#include <fm/fmd_fmri.h>
#include <topo_method.h>
#include <topo_subr.h>
#include <dev.h>
topo_instance_t, void *, void *);
static const topo_method_t dev_methods[] = {
{ NULL }
};
static const topo_modops_t dev_ops =
{ dev_enum, dev_release };
static const topo_modinfo_t dev_info =
int
{
if (getenv("TOPOHCDEBUG"))
if (version != DEV_VERSION)
return (-1);
}
return (0);
}
void
{
}
/*ARGSUSED*/
static int
{
return (0);
}
static void
{
}
static ssize_t
{
int more_auth = 0;
int err;
return (-1);
/* Get authority, if present */
return (-1);
/* Get devid, if present */
return (-1);
/* There must be a device path present */
return (-1);
(void) nvlist_lookup_string(anvl,
(void) nvlist_lookup_string(anvl,
(void) nvlist_lookup_string(anvl,
(void) nvlist_lookup_string(anvl,
(void) nvlist_lookup_string(anvl,
more_auth++;
more_auth++;
more_auth++;
more_auth++;
more_auth++;
}
/* dev:// */
/* authority, if any */
NULL);
/* device-id part, topo_fmristr_build does nothing if devid is NULL */
/* device-path part */
return (size);
}
/*ARGSUSED*/
static int
{
if (version > TOPO_METH_NVL2STR_VERSION)
}
}
return (0);
}
/*ARGSUSED*/
static int
{
char *devpath;
char *str;
int err;
if (version > TOPO_METH_STR2NVL_VERSION)
/* We're expecting a string version of a dev scheme FMRI */
char *n;
int len;
if (n == NULL)
devpath = n + 1;
}
/* the device-path should start with a slash */
if (*devpath != '/')
if (err != 0) {
}
return (0);
}
/*ARGSUSED*/
static int
{
int len;
if (version > TOPO_METH_PRESENT_VERSION)
/*
* stat() the device node in devfs. This will tell us if the device is
* present or not. Don't stat the minor, just the whole device.
* If the device is present and there is a devid, it must also match.
* so di_init that one node. No need for DINFOFORCE.
*/
present = 1;
present = 0;
else {
present = 0;
else
present = 1;
}
} else {
present = 0;
present = 0;
else {
present = 0;
else {
present = 0;
else
present = 1;
}
}
}
nvlist_free(*out);
}
return (0);
}
/*ARGSUSED*/
static int
{
int len;
/*
* stat() the device node in devfs. This will tell us if the device is
* present or not. Don't stat the minor, just the whole device.
* If the device is present and there is a devid, it must also match.
* so di_init that one node. No need for DINFOFORCE.
*/
else {
else
}
} else {
else {
else {
else
}
}
}
nvlist_free(*out);
}
return (0);
}
/*ARGSUSED*/
static int
{
unusable = 1;
} else {
unusable = 1;
else
unusable = 0;
}
nvlist_free(*out);
}
return (0);
}
/*ARGSUSED*/
static int
{
} else {
else if (state & DI_DEVICE_DEGRADED)
else
}
service_state) != 0) {
nvlist_free(*out);
}
return (0);
}
static nvlist_t *
{
int e;
return (NULL);
}
if (e == 0)
return (out);
return (NULL);
}
/*ARGSUSED*/
static int
{
if (version > TOPO_METH_FMRI_VERSION)
}
return (-1);
return (0);
}