xref: /onnv-gate/usr/src/cmd/fm/schemes/legacy-hc/scheme.c (revision 7197:6062b005c7ea)
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
5*7197Sstephh  * Common Development and Distribution License (the "License").
6*7197Sstephh  * 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*7197Sstephh  * Copyright 2008 Sun Microsystems, Inc.  All rights reserved.
230Sstevel@tonic-gate  * Use is subject to license terms.
240Sstevel@tonic-gate  */
250Sstevel@tonic-gate 
260Sstevel@tonic-gate #pragma ident	"%Z%%M%	%I%	%E% SMI"
270Sstevel@tonic-gate 
280Sstevel@tonic-gate #include <fm/fmd_fmri.h>
290Sstevel@tonic-gate 
300Sstevel@tonic-gate ssize_t
310Sstevel@tonic-gate fmd_fmri_nvl2str(nvlist_t *nvl, char *buf, size_t buflen)
320Sstevel@tonic-gate {
330Sstevel@tonic-gate 	uint8_t version;
340Sstevel@tonic-gate 	ssize_t size;
350Sstevel@tonic-gate 	char *c;
360Sstevel@tonic-gate 
370Sstevel@tonic-gate 	if (nvlist_lookup_uint8(nvl, FM_VERSION, &version) != 0 ||
380Sstevel@tonic-gate 	    version > FM_LEGACY_SCHEME_VERSION ||
390Sstevel@tonic-gate 	    nvlist_lookup_string(nvl, FM_FMRI_LEGACY_HC, &c) != 0)
400Sstevel@tonic-gate 		return (fmd_fmri_set_errno(EINVAL));
410Sstevel@tonic-gate 
420Sstevel@tonic-gate 	c = fmd_fmri_strescape(c);
430Sstevel@tonic-gate 	size = snprintf(buf, buflen, "legacy-hc:///component=%s", c);
440Sstevel@tonic-gate 	fmd_fmri_strfree(c);
450Sstevel@tonic-gate 
460Sstevel@tonic-gate 	return (size);
470Sstevel@tonic-gate }
48*7197Sstephh 
49*7197Sstephh /*ARGSUSED*/
50*7197Sstephh int
51*7197Sstephh fmd_fmri_present(nvlist_t *nvl)
52*7197Sstephh {
53*7197Sstephh 	return (1);
54*7197Sstephh }
55*7197Sstephh 
56*7197Sstephh /*ARGSUSED*/
57*7197Sstephh int
58*7197Sstephh fmd_fmri_unusable(nvlist_t *nvl)
59*7197Sstephh {
60*7197Sstephh 	return (0);
61*7197Sstephh }
62