/*-
* Copyright (c) 2001 The NetBSD Foundation, Inc.
* All rights reserved.
*
* This code is derived from software contributed to The NetBSD Foundation
* by Andrew Doran.
*
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions
* are met:
* 1. Redistributions of source code must retain the above copyright
* notice, this list of conditions and the following disclaimer.
* 2. Redistributions in binary form must reproduce the above copyright
* notice, this list of conditions and the following disclaimer in the
* documentation and/or other materials provided with the distribution.
*
* THIS SOFTWARE IS PROVIDED BY THE NETBSD FOUNDATION, INC. AND CONTRIBUTORS
* ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED
* TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
* PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE FOUNDATION OR CONTRIBUTORS
* BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
* CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
* SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
* INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
* CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
* ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
* POSSIBILITY OF SUCH DAMAGE.
*/
/*-
* Copyright (c) 1999 Michael Smith
* All rights reserved.
*
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions
* are met:
* 1. Redistributions of source code must retain the above copyright
* notice, this list of conditions and the following disclaimer.
* 2. Redistributions in binary form must reproduce the above copyright
* notice, this list of conditions and the following disclaimer in the
* documentation and/or other materials provided with the distribution.
*
* THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' AND
* ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
* IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
* ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE
* FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
* DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
* OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
* HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
* LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
* OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
* SUCH DAMAGE.
*
* from FreeBSD: command.c,v 1.2 2000/04/11 23:04:17 msmith Exp
*/
/*
* Status output
*/
static void
cmd_status0(struct mlx_disk *md)
{
int result;
result = md->hwunit;
if (ioctl(mlxfd, MLXD_STATUS, &result) < 0)
err(EXIT_FAILURE, "ioctl(MLXD_STATUS)");
switch(result) {
case MLX_SYSD_ONLINE:
printf("%s: online\n", md->name);
break;
case MLX_SYSD_CRITICAL:
printf("%s: critical\n", md->name);
if (!rstatus)
rstatus = 1;
break;
case MLX_SYSD_OFFLINE:
printf("%s: offline\n", md->name);
rstatus = 2;
break;
default:
printf("%s: unknown status 0x%02x\n", md->name, result);
break;
}
/* Rebuild/check in progress on this drive? */
if (rs.rs_drive == md->hwunit &&
rs.rs_code != MLX_REBUILDSTAT_IDLE) {
switch(rs.rs_code) {
case MLX_REBUILDSTAT_REBUILDCHECK:
printf(" [consistency check");
break;
case MLX_REBUILDSTAT_ADDCAPACITY:
printf(" [add capacity");
break;
case MLX_REBUILDSTAT_ADDCAPACITYINIT:
printf(" [add capacity init");
break;
for (i = 0; i < sizeof(mlx_ctlr_names) / sizeof(mlx_ctlr_names[0]); i++)
if (ci.ci_hardware_id == mlx_ctlr_names[i].hwid) {
model = mlx_ctlr_names[i].name;
break;
}
if (i == sizeof(mlx_ctlr_names) / sizeof(mlx_ctlr_names[0])) {
snprintf(buf, sizeof(buf), " model 0x%x", ci.ci_hardware_id);
model = buf;
}