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 ssize_t
fmd_fmri_nvl2str(nvlist_t * nvl,char * buf,size_t buflen)290Sstevel@tonic-gate fmd_fmri_nvl2str(nvlist_t *nvl, char *buf, size_t buflen)
300Sstevel@tonic-gate {
310Sstevel@tonic-gate uint8_t version;
320Sstevel@tonic-gate ssize_t size;
330Sstevel@tonic-gate char *c;
340Sstevel@tonic-gate
350Sstevel@tonic-gate if (nvlist_lookup_uint8(nvl, FM_VERSION, &version) != 0 ||
360Sstevel@tonic-gate version > FM_LEGACY_SCHEME_VERSION ||
370Sstevel@tonic-gate nvlist_lookup_string(nvl, FM_FMRI_LEGACY_HC, &c) != 0)
380Sstevel@tonic-gate return (fmd_fmri_set_errno(EINVAL));
390Sstevel@tonic-gate
400Sstevel@tonic-gate c = fmd_fmri_strescape(c);
410Sstevel@tonic-gate size = snprintf(buf, buflen, "legacy-hc:///component=%s", c);
420Sstevel@tonic-gate fmd_fmri_strfree(c);
430Sstevel@tonic-gate
440Sstevel@tonic-gate return (size);
450Sstevel@tonic-gate }
467197Sstephh
477197Sstephh /*ARGSUSED*/
487197Sstephh int
fmd_fmri_present(nvlist_t * nvl)497197Sstephh fmd_fmri_present(nvlist_t *nvl)
507197Sstephh {
517197Sstephh return (1);
527197Sstephh }
537197Sstephh
547197Sstephh /*ARGSUSED*/
557197Sstephh int
fmd_fmri_replaced(nvlist_t * nvl)56*11416SStephen.Hanson@Sun.COM fmd_fmri_replaced(nvlist_t *nvl)
57*11416SStephen.Hanson@Sun.COM {
58*11416SStephen.Hanson@Sun.COM return (FMD_OBJ_STATE_UNKNOWN);
59*11416SStephen.Hanson@Sun.COM }
60*11416SStephen.Hanson@Sun.COM
61*11416SStephen.Hanson@Sun.COM /*ARGSUSED*/
62*11416SStephen.Hanson@Sun.COM int
fmd_fmri_unusable(nvlist_t * nvl)637197Sstephh fmd_fmri_unusable(nvlist_t *nvl)
647197Sstephh {
657197Sstephh return (0);
667197Sstephh }
67