xref: /onnv-gate/usr/src/cmd/fm/schemes/fmd/scheme.c (revision 11416:c13e2db06244)
10Sstevel@tonic-gate /*
20Sstevel@tonic-gate  * CDDL HEADER START
30Sstevel@tonic-gate  *
40Sstevel@tonic-gate  * The contents of this file are subject to the terms of the
57197Sstephh  * Common Development and Distribution License (the "License").
67197Sstephh  * You may not use this file except in compliance with the License.
70Sstevel@tonic-gate  *
80Sstevel@tonic-gate  * You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE
90Sstevel@tonic-gate  * or http://www.opensolaris.org/os/licensing.
100Sstevel@tonic-gate  * See the License for the specific language governing permissions
110Sstevel@tonic-gate  * and limitations under the License.
120Sstevel@tonic-gate  *
130Sstevel@tonic-gate  * When distributing Covered Code, include this CDDL HEADER in each
140Sstevel@tonic-gate  * file and include the License file at usr/src/OPENSOLARIS.LICENSE.
150Sstevel@tonic-gate  * If applicable, add the following below this CDDL HEADER, with the
160Sstevel@tonic-gate  * fields enclosed by brackets "[]" replaced with your own identifying
170Sstevel@tonic-gate  * information: Portions Copyright [yyyy] [name of copyright owner]
180Sstevel@tonic-gate  *
190Sstevel@tonic-gate  * CDDL HEADER END
200Sstevel@tonic-gate  */
210Sstevel@tonic-gate /*
22*11416SStephen.Hanson@Sun.COM  * Copyright 2010 Sun Microsystems, Inc.  All rights reserved.
230Sstevel@tonic-gate  * Use is subject to license terms.
240Sstevel@tonic-gate  */
250Sstevel@tonic-gate 
260Sstevel@tonic-gate #include <fm/fmd_fmri.h>
270Sstevel@tonic-gate 
280Sstevel@tonic-gate /*
290Sstevel@tonic-gate  * This routine should be kept in sync with the built-in version provided
300Sstevel@tonic-gate  * as part of fmd(1M) itself -- see usr/src/cmd/fm/fmd/common/fmd_scheme.c
310Sstevel@tonic-gate  */
320Sstevel@tonic-gate ssize_t
fmd_fmri_nvl2str(nvlist_t * nvl,char * buf,size_t buflen)330Sstevel@tonic-gate fmd_fmri_nvl2str(nvlist_t *nvl, char *buf, size_t buflen)
340Sstevel@tonic-gate {
350Sstevel@tonic-gate 	char *name;
360Sstevel@tonic-gate 
370Sstevel@tonic-gate 	if (nvlist_lookup_string(nvl, FM_FMRI_FMD_NAME, &name) != 0)
380Sstevel@tonic-gate 		return (fmd_fmri_set_errno(EINVAL));
390Sstevel@tonic-gate 
400Sstevel@tonic-gate 	return (snprintf(buf, buflen,
410Sstevel@tonic-gate 	    "%s:///module/%s", FM_FMRI_SCHEME_FMD, name));
420Sstevel@tonic-gate }
437197Sstephh 
447197Sstephh /*ARGSUSED*/
457197Sstephh int
fmd_fmri_present(nvlist_t * nvl)467197Sstephh fmd_fmri_present(nvlist_t *nvl)
477197Sstephh {
487197Sstephh 	return (1);
497197Sstephh }
507197Sstephh 
517197Sstephh /*ARGSUSED*/
527197Sstephh int
fmd_fmri_replaced(nvlist_t * nvl)53*11416SStephen.Hanson@Sun.COM fmd_fmri_replaced(nvlist_t *nvl)
54*11416SStephen.Hanson@Sun.COM {
55*11416SStephen.Hanson@Sun.COM 	return (FMD_OBJ_STATE_UNKNOWN);
56*11416SStephen.Hanson@Sun.COM }
57*11416SStephen.Hanson@Sun.COM 
58*11416SStephen.Hanson@Sun.COM /*ARGSUSED*/
59*11416SStephen.Hanson@Sun.COM int
fmd_fmri_unusable(nvlist_t * nvl)607197Sstephh fmd_fmri_unusable(nvlist_t *nvl)
617197Sstephh {
627197Sstephh 	return (0);
637197Sstephh }
64