faulty.c revision 7c478bd95313f5f23a4c958a745db2134aa03244
/*
* CDDL HEADER START
*
* The contents of this file are subject to the terms of the
* Common Development and Distribution License, Version 1.0 only
* (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 2004 Sun Microsystems, Inc. All rights reserved.
* Use is subject to license terms.
*/
#pragma ident "%Z%%M% %I% %E% SMI"
#include <strings.h>
#include <fmadm.h>
static const char *
{
default:
return ("ok");
case FMD_ADM_RSRC_FAULTY:
return ("degraded");
case FMD_ADM_RSRC_UNUSABLE:
return ("unknown");
return ("faulted");
}
}
static const char faulty_line[] = "-------- "
"----------------------------------------------------------------------";
/*ARGSUSED*/
static int
{
(void) printf("%s\n%8s %s\n%8s %s\n",
}
return (0);
}
/*ARGSUSED*/
static int
{
(void) printf("%s\n%8s %s\n%8s %s\n",
}
return (0);
}
int
{
int c, opt_a = 0;
switch (c) {
case 'a':
opt_a++;
break;
case 'i':
func = faulty_uuid;
break;
default:
return (FMADM_EXIT_USAGE);
}
}
return (FMADM_EXIT_USAGE);
if (func == faulty_fmri)
else
die("failed to retrieve resource data");
return (FMADM_EXIT_SUCCESS);
}
int
{
int i, status = FMADM_EXIT_SUCCESS;
return (FMADM_EXIT_USAGE);
for (i = 1; i < argc; i++) {
} else
}
return (status);
}
int
{
int err;
return (FMADM_EXIT_USAGE);
return (FMADM_EXIT_USAGE);
/*
* For now, we assume that if the input string contains a colon, it is
* an FMRI and if it does not it is a UUID. If things get more complex
* in the future with multiple UUID formats, an FMRI parser can be
* added here to differentiate the input argument appropriately.
*/
else
if (err != 0)
return (FMADM_EXIT_SUCCESS);
}