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]
22 * Copyright 2008 Sun Microsystems, Inc. All rights reserved.
23 * Use is subject to license terms.
38 MP_GetTargetPortGroupProperties(MP_OID oid
,
39 MP_TARGET_PORT_GROUP_PROPERTIES
*pProps
)
41 MP_STATUS mpStatus
= MP_STATUS_SUCCESS
;
44 log(LOG_INFO
, "MP_GetTargetPortGroupProperties()", " - enter");
47 mpStatus
= getTargetPortGroupProperties(oid
, pProps
);
50 log(LOG_INFO
, "MP_GetTargetPortGroupProperties()", " - exit");
57 getTargetPortGroupProperties(MP_OID oid
,
58 MP_TARGET_PORT_GROUP_PROPERTIES
*pProps
)
60 mp_iocdata_t mp_ioctl
;
61 mp_tpg_prop_t tpgProps
;
65 MP_STATUS mpStatus
= MP_STATUS_SUCCESS
;
68 log(LOG_INFO
, "getTargetPortGroupProperties()", " - enter");
70 if (g_scsi_vhci_fd
< 0) {
71 log(LOG_INFO
, "getTargetPortGroupProperties()",
72 "invalid driver file handle");
73 log(LOG_INFO
, "getTargetPortGroupProperties",
75 return (MP_STATUS_FAILED
);
78 log(LOG_INFO
, "getTargetPortGroupProperties()",
79 "oid.objectSequenceNumber = %llx",
80 oid
.objectSequenceNumber
);
82 (void) memset(pProps
, 0, sizeof (MP_TARGET_PORT_GROUP_PROPERTIES
));
83 (void) memset(&tpgProps
, 0, sizeof (mp_tpg_prop_t
));
84 (void) memset(&mp_ioctl
, 0, sizeof (mp_iocdata_t
));
86 mp_ioctl
.mp_cmd
= MP_GET_TPG_PROP
;
87 mp_ioctl
.mp_ibuf
= (caddr_t
)&oid
.objectSequenceNumber
;
88 mp_ioctl
.mp_ilen
= sizeof (oid
.objectSequenceNumber
);
89 mp_ioctl
.mp_obuf
= (caddr_t
)&tpgProps
;
90 mp_ioctl
.mp_olen
= sizeof (mp_tpg_prop_t
);
91 mp_ioctl
.mp_xfer
= MP_XFER_READ
;
93 ioctlStatus
= ioctl(g_scsi_vhci_fd
, MP_CMD
, &mp_ioctl
);
95 log(LOG_INFO
, "getTargetPortGroupProperties()",
96 " IOCTL call returned: %d", ioctlStatus
);
98 if (ioctlStatus
< 0) {
102 if (ioctlStatus
!= 0) {
103 log(LOG_INFO
, "getTargetPortGroupProperties()",
104 "IOCTL call failed. IOCTL error is: %d",
106 log(LOG_INFO
, "getTargetPortGroupProperties()",
107 "IOCTL call failed. IOCTL error is: %s",
108 strerror(ioctlStatus
));
109 log(LOG_INFO
, "getTargetPortGroupProperties()",
110 "IOCTL call failed. mp_ioctl.mp_errno: %x",
113 if (ENOTSUP
== ioctlStatus
) {
114 mpStatus
= MP_STATUS_UNSUPPORTED
;
115 } else if (0 == mp_ioctl
.mp_errno
) {
116 mpStatus
= MP_STATUS_FAILED
;
118 mpStatus
= getStatus4ErrorCode(mp_ioctl
.mp_errno
);
121 log(LOG_INFO
, "getTargetPortGroupProperties()",
127 pProps
->accessState
= tpgProps
.accessState
;
128 pProps
->explicitFailover
= tpgProps
.explicitFailover
;
129 pProps
->preferredLuPath
= tpgProps
.preferredLuPath
;
130 pProps
->supportsLuAssignment
= tpgProps
.supportsLuAssignment
;
131 pProps
->tpgID
= tpgProps
.tpgId
;
134 log(LOG_INFO
, "getTargetPortGroupProperties()", " - exit");
136 return (MP_STATUS_SUCCESS
);