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 2009 Sun Microsystems, Inc. All rights reserved.
24 * Use is subject to license terms.
27 #
pragma D depends_on library net
.d
28 #
pragma D depends_on library scsi
.d
29 #
pragma D depends_on
module genunix
30 #
pragma D depends_on
module fct
33 * FC port information.
35 typedef struct fc_port_info
{
36 string fcp_node_wwn
; /* node WWN */
37 string fcp_sym_node_name
; /* node symbolic name */
38 string fcp_sym_port_name
; /* port symbolic name */
39 uint32_t fcp_port_hard_address
; /* port hard address */
43 * FC transfer info (somewhat analogous to iscsiinfo_t)
44 * Represents data transfer details.
46 typedef struct fc_xferinfo
{
49 uint16_t fcx_flags
; /* db_flags as defined in sys/stmf.h */
53 * conninfo translators
57 * Translator for conninfo, translating from the local port.
59 #
pragma D binding
"1.5" translator
60 translator conninfo_t
< fct_local_port_t
*P
> {
61 ci_local
= P
->port_pwwn_str
[0] ?
62 P
->port_pwwn_str
: "<unknown>";
63 ci_remote
= "<unknown>";
68 * Translator for conninfo, translating from the local port implementation.
70 #
pragma D binding
"1.5" translator
71 translator conninfo_t
< fct_i_local_port_t
*P
> {
72 ci_local
= P
->iport_port
->port_pwwn_str
[0] ?
73 P
->iport_port
->port_pwwn_str
: "<unknown>";
74 ci_remote
= "<unknown>";
79 * Translator for conninfo, translating from fct cmd struct.
81 #
pragma D binding
"1.5" translator
82 translator conninfo_t
< fct_cmd_t
*C
> {
83 ci_local
= (C
->cmd_port ?
84 (C
->cmd_port
->port_pwwn_str
[0] ?
85 C
->cmd_port
->port_pwwn_str
: "<unknown>") :
88 ci_remote
= (C
->cmd_rp ?
89 (C
->cmd_rp
->rp_pwwn_str
[0] ?
90 C
->cmd_rp
->rp_pwwn_str
: "<unknown>") :
98 * fc_port_info_t translators.
102 * Translator for fc_port_info_t, translating from the local port.
104 #
pragma D binding
"1.5" translator
105 translator fc_port_info_t
< fct_local_port_t
*P
> {
107 fcp_node_wwn
= P
->port_nwwn_str
[0] ?
108 P
->port_nwwn_str
: "<unknown>";
110 /* node symbolic name */
111 fcp_sym_node_name
= P
->port_sym_node_name ?
112 P
->port_sym_node_name
: `utsname.nodename;
114 /* port symbolic name */
115 fcp_sym_port_name = P->port_sym_port_name ?
116 P->port_sym_port_name : "<unknown>";
118 /* port hard address */
119 fcp_port_hard_address = P->port_hard_address;
124 * Translator for fc_port_info_t, translating from the local port impl.
126 #pragma D binding "1.5" translator
127 translator fc_port_info_t < fct_i_local_port_t *P > {
130 fcp_node_wwn = (P->iport_port ?
131 (P->iport_port->port_nwwn_str[0] ?
132 P->iport_port->port_nwwn_str :
134 "<bad iport_port ptr>");
138 (P->iport_port->port_sym_node_name ?
139 P->iport_port->port_sym_node_name : "<unknown>") :
140 "<bad iport_port ptr>");
144 (P->iport_port->port_sym_port_name ?
145 P->iport_port->port_sym_port_name : "<unknown>") :
146 "<bad iport_port ptr>");
148 fcp_port_hard_address =
150 P->iport_port->port_hard_address : 0);
154 * Translator for fc_port_info, translating from the remote port impl
156 #pragma D binding "1.5" translator
157 translator fc_port_info_t < fct_i_remote_port_t *P > {
160 fcp_node_wwn = P->irp_rp ?
161 (P->irp_rp->rp_nwwn_str[0] ?
162 P->irp_rp->rp_nwwn_str : "<unknown>") :
165 /* node symbolic name */
166 fcp_sym_node_name = P->irp_snn ? P->irp_snn : "<unknown>";
168 /* port symbolic name */
169 fcp_sym_port_name = P->irp_spn ? P->irp_spn : "<unknown>";
171 /* port hard address */
172 fcp_port_hard_address = P->irp_rp ? P->irp_rp->rp_id : 0;
176 * Translator for fc_xferinfo, translating from stmf_data_buf_t.
178 #pragma D binding "1.5" translator
179 translator fc_xferinfo_t < stmf_data_buf_t *B > {
180 fcx_len = B->db_data_size;
181 fcx_offset = B->db_relative_offset;
182 fcx_flags = B->db_flags;