disk_transport.c revision 24db46411fd54f70c35b94bb952eb7ba040e43b4
/*
* 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"
/*
* Disk error transport module
*
* This transport module is responsible for translating between disk errors
* and FMA ereports. It is a read-only transport module, and checks for the
* following failures:
*
* - overtemp
* - predictive failure
* - self-test failure
*
* These failures are detected via the TOPO_METH_DISK_STATUS method, which
* leverages libdiskstatus to do the actual analysis. This transport module is
* in charge of the following tasks:
*
* - discovering available devices
* - periodically checking devices
*/
#include <ctype.h>
#include <fm/libdiskstatus.h>
#include <fm/topo_mod.h>
#include <limits.h>
#include <string.h>
static struct dt_stat {
} dt_stats = {
};
typedef struct disk_monitor {
char *dm_sim_search;
char *dm_sim_file;
static void
{
int e = 0;
if (e == 0) {
} else {
}
} else {
}
}
/*
* Check a single topo node for failure. This simply invokes the disk status
* method, and generates any ereports as necessary.
*/
static int
{
char *protocol;
int err;
char *fmristr;
topo_strerror(err));
return (TOPO_WALK_ERR);
}
return (TOPO_WALK_ERR);
}
if (dmp->dm_sim_search) {
}
/*
* Try to invoke the method. If this fails (most likely because the
* method is not supported), then ignore this node.
*/
return (TOPO_WALK_NEXT);
}
/*
* Add any faults.
*/
continue;
if (!fault ||
&details) != 0)
continue;
}
}
return (TOPO_WALK_NEXT);
}
/*
* Periodic timeout. Iterates over all hc:// topo nodes, calling
* dt_analyze_disk() for each one.
*/
/*ARGSUSED*/
static void
{
int err;
topo_strerror(err));
return;
}
return;
}
}
/*
* Called when the topology may have changed. We want to examine all disks in
* case a new one has been inserted, but we don't want to overwhelm the system
* in the event of a flurry of topology changes, as most likely only a small
* number of disks are changing. To avoid this, we set the timer for a small
* but non-trivial interval (by default 1 minute), and ignore intervening
* changes during this period. This still gives us a reasonable response time
* to newly inserted devices without overwhelming the system if lots of hotplug
* activity is going on.
*/
/*ARGSUSED*/
static void
{
if (dmp->dm_timer_istopo)
return;
}
static const fmd_prop_t fmd_props[] = {
};
static const fmd_hdl_ops_t fmd_ops = {
NULL, /* fmdo_recv */
dt_timeout, /* fmdo_timeout */
NULL, /* fmdo_close */
NULL, /* fmdo_stats */
NULL, /* fmdo_gc */
NULL, /* fmdo_send */
dt_topo_change, /* fmdo_topo_change */
};
static const fmd_hdl_info_t fmd_info = {
};
void
{
char *simulate;
return;
sizeof (dt_stats) / sizeof (fmd_stat_t),
(fmd_stat_t *)&dt_stats);
/*
* Determine if we have the simulate property set. This property allows
* the developer to substitute a faulty device based off all or part of
* an FMRI string. For example, one could do:
*
*
* When the transport module encounters an FMRI containing the given
* string, then it will open the simulator file instead of the
* corresponding device. This can be any file, but is intended to be a
* libdiskstatus simulator shared object, capable of faking up SCSI
* responses.
*
* The property consists of two strings, an FMRI fragment and an
* absolute path, separated by whitespace.
*/
if (simulate[0] != '\0') {
const char *sep;
break;
}
if (*sep != '\0') {
}
break;
}
if (*sep != '\0') {
} else if (dmp->dm_sim_search) {
}
}
/*
* Call our initial timer routine. This will do an initial check of all
* the disks, and then start the periodic timeout.
*/
}
void
{
if (dmp) {
}
}