4 * The contents of this file are subject to the terms of the
5 * Common Development and Distribution License (the "License").
6 * You may not use this file except in compliance with the License.
8 * You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE
9 * or http://www.opensolaris.org/os/licensing.
10 * See the License for the specific language governing permissions
11 * and limitations under the License.
13 * When distributing Covered Code, include this CDDL HEADER in each
14 * file and include the License file at usr/src/OPENSOLARIS.LICENSE.
15 * If applicable, add the following below this CDDL HEADER, with the
16 * fields enclosed by brackets "[]" replaced with your own identifying
17 * information: Portions Copyright [yyyy] [name of copyright owner]
23 * Copyright 2008 Sun Microsystems, Inc. All rights reserved.
24 * Use is subject to license terms.
27 #pragma ident "%Z%%M% %I% %E% SMI"
29 #include <scsi/libses.h>
30 #include <scsi/libses_plugin.h>
32 #include "libses_impl.h"
36 libses_parse_node(ses_plugin_t
*sp
, ses_node_t
*np
)
45 props
= ses_node_props(np
);
47 if (nvlist_lookup_uint64(props
, SES_PROP_ELEMENT_TYPE
,
49 (name
= ses_element_type_name(type
)) != NULL
) {
51 * Add a standard human-readable name for the element type.
53 SES_NV_ADD(string
, nverr
, props
,
54 LIBSES_PROP_ELEMENT_TYPE_NAME
, name
);
57 if (ses_node_type(np
) != SES_NODE_ENCLOSURE
)
61 * The only thing we do for all targets is fill in the default chassis
62 * number from the enclosure logical ID.
64 if (nvlist_lookup_nvlist(props
, SES_EN_PROP_LID
, &lid
) != 0)
67 VERIFY(nvlist_lookup_uint64(lid
, SPC3_NAA_INT
, &id
) == 0);
69 (void) snprintf(csn
, sizeof (csn
), "%llx", id
);
70 SES_NV_ADD(string
, nverr
, props
, LIBSES_EN_PROP_CSN
, csn
);
76 _ses_init(ses_plugin_t
*sp
)
78 ses_plugin_config_t config
= {
79 .spc_node_parse
= libses_parse_node
82 return (ses_plugin_register(sp
, LIBSES_PLUGIN_VERSION
,
87 * libses must be loaded after ses2.