ac88567a7a5bb7f01cf22cf366bc9d6203e24d7aHyon Kim/*
ac88567a7a5bb7f01cf22cf366bc9d6203e24d7aHyon Kim * CDDL HEADER START
ac88567a7a5bb7f01cf22cf366bc9d6203e24d7aHyon Kim *
ac88567a7a5bb7f01cf22cf366bc9d6203e24d7aHyon Kim * The contents of this file are subject to the terms of the
ac88567a7a5bb7f01cf22cf366bc9d6203e24d7aHyon Kim * Common Development and Distribution License (the "License").
ac88567a7a5bb7f01cf22cf366bc9d6203e24d7aHyon Kim * You may not use this file except in compliance with the License.
ac88567a7a5bb7f01cf22cf366bc9d6203e24d7aHyon Kim *
ac88567a7a5bb7f01cf22cf366bc9d6203e24d7aHyon Kim * You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE
ac88567a7a5bb7f01cf22cf366bc9d6203e24d7aHyon Kim * or http://www.opensolaris.org/os/licensing.
ac88567a7a5bb7f01cf22cf366bc9d6203e24d7aHyon Kim * See the License for the specific language governing permissions
ac88567a7a5bb7f01cf22cf366bc9d6203e24d7aHyon Kim * and limitations under the License.
ac88567a7a5bb7f01cf22cf366bc9d6203e24d7aHyon Kim *
ac88567a7a5bb7f01cf22cf366bc9d6203e24d7aHyon Kim * When distributing Covered Code, include this CDDL HEADER in each
ac88567a7a5bb7f01cf22cf366bc9d6203e24d7aHyon Kim * file and include the License file at usr/src/OPENSOLARIS.LICENSE.
ac88567a7a5bb7f01cf22cf366bc9d6203e24d7aHyon Kim * If applicable, add the following below this CDDL HEADER, with the
ac88567a7a5bb7f01cf22cf366bc9d6203e24d7aHyon Kim * fields enclosed by brackets "[]" replaced with your own identifying
ac88567a7a5bb7f01cf22cf366bc9d6203e24d7aHyon Kim * information: Portions Copyright [yyyy] [name of copyright owner]
ac88567a7a5bb7f01cf22cf366bc9d6203e24d7aHyon Kim *
ac88567a7a5bb7f01cf22cf366bc9d6203e24d7aHyon Kim * CDDL HEADER END
ac88567a7a5bb7f01cf22cf366bc9d6203e24d7aHyon Kim */
ac88567a7a5bb7f01cf22cf366bc9d6203e24d7aHyon Kim
ac88567a7a5bb7f01cf22cf366bc9d6203e24d7aHyon Kim/*
ac88567a7a5bb7f01cf22cf366bc9d6203e24d7aHyon Kim * Copyright (c) 2010, Oracle and/or its affiliates. All rights reserved.
ac88567a7a5bb7f01cf22cf366bc9d6203e24d7aHyon Kim */
ac88567a7a5bb7f01cf22cf366bc9d6203e24d7aHyon Kim
ac88567a7a5bb7f01cf22cf366bc9d6203e24d7aHyon Kim#include <sys/types.h>
ac88567a7a5bb7f01cf22cf366bc9d6203e24d7aHyon Kim#include <stddef.h>
ac88567a7a5bb7f01cf22cf366bc9d6203e24d7aHyon Kim#include <stdio.h>
ac88567a7a5bb7f01cf22cf366bc9d6203e24d7aHyon Kim#include <string.h>
ac88567a7a5bb7f01cf22cf366bc9d6203e24d7aHyon Kim#include <libnvpair.h>
ac88567a7a5bb7f01cf22cf366bc9d6203e24d7aHyon Kim
ac88567a7a5bb7f01cf22cf366bc9d6203e24d7aHyon Kim#include <scsi/libses.h>
ac88567a7a5bb7f01cf22cf366bc9d6203e24d7aHyon Kim#include <scsi/libses_plugin.h>
ac88567a7a5bb7f01cf22cf366bc9d6203e24d7aHyon Kim#include <scsi/plugins/ses/vendor/sun.h>
ac88567a7a5bb7f01cf22cf366bc9d6203e24d7aHyon Kim#include <scsi/plugins/ses/vendor/sun_impl.h>
ac88567a7a5bb7f01cf22cf366bc9d6203e24d7aHyon Kim
ac88567a7a5bb7f01cf22cf366bc9d6203e24d7aHyon Kimint
ac88567a7a5bb7f01cf22cf366bc9d6203e24d7aHyon Kimsun_fill_element_node(ses_plugin_t *sp, ses_node_t *np)
ac88567a7a5bb7f01cf22cf366bc9d6203e24d7aHyon Kim{
ac88567a7a5bb7f01cf22cf366bc9d6203e24d7aHyon Kim ses_snap_t *snap = ses_node_snapshot(np);
ac88567a7a5bb7f01cf22cf366bc9d6203e24d7aHyon Kim nvlist_t *props = ses_node_props(np);
ac88567a7a5bb7f01cf22cf366bc9d6203e24d7aHyon Kim sun_fru_descr_impl_t *sfdip;
ac88567a7a5bb7f01cf22cf366bc9d6203e24d7aHyon Kim size_t len;
ac88567a7a5bb7f01cf22cf366bc9d6203e24d7aHyon Kim int err;
ac88567a7a5bb7f01cf22cf366bc9d6203e24d7aHyon Kim
ac88567a7a5bb7f01cf22cf366bc9d6203e24d7aHyon Kim if ((sfdip = ses_plugin_page_lookup(sp, snap,
ac88567a7a5bb7f01cf22cf366bc9d6203e24d7aHyon Kim SUN_DIAGPAGE_FRUID, np, &len)) != NULL) {
ac88567a7a5bb7f01cf22cf366bc9d6203e24d7aHyon Kim if ((err = sun_fruid_parse_common(sfdip, props)) != 0)
ac88567a7a5bb7f01cf22cf366bc9d6203e24d7aHyon Kim return (err);
ac88567a7a5bb7f01cf22cf366bc9d6203e24d7aHyon Kim }
ac88567a7a5bb7f01cf22cf366bc9d6203e24d7aHyon Kim
ac88567a7a5bb7f01cf22cf366bc9d6203e24d7aHyon Kim return (0);
ac88567a7a5bb7f01cf22cf366bc9d6203e24d7aHyon Kim}