/*
* CDDL HEADER START
*
* The contents of this file are subject to the terms of the
* Common Development and Distribution License (the "License").
* You may not use this file except in compliance with the License.
*
* You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE
* See the License for the specific language governing permissions
* and limitations under the License.
*
* When distributing Covered Code, include this CDDL HEADER in each
* file and include the License file at usr/src/OPENSOLARIS.LICENSE.
* If applicable, add the following below this CDDL HEADER, with the
* fields enclosed by brackets "[]" replaced with your own identifying
* information: Portions Copyright [yyyy] [name of copyright owner]
*
* CDDL HEADER END
*/
/*
* Copyright 2008 Sun Microsystems, Inc. All rights reserved.
* Use is subject to license terms.
*/
#include <syslog.h>
#include <errno.h>
#include <unistd.h>
#include <stropts.h>
#include "mp_utils.h"
#include <libdevinfo.h>
#include <fcntl.h>
{
int instNum = 0;
int majorNum = 0;
int oidInstNum = 0;
int oidMajorNum = 0;
int found = 0;
if (DI_NODE_NIL == root_node) {
" - di_init() failed");
return (MP_STATUS_FAILED);
}
while (DI_NODE_NIL != vh_node) {
while (DI_NODE_NIL != ph_node) {
if ((majorNum == oidMajorNum) &&
(instNum == oidInstNum)) {
"doDevInfoStuffForIntPort()",
"got a match");
found = 1;
break;
}
}
}
if (found) {
break;
}
}
if (!found) {
"doDevInfoStuffForIntPort()",
" - no match found, error exit");
return (MP_STATUS_OBJECT_NOT_FOUND);
}
if (DI_PATH_NIL == path) {
" - path is DI_PATH_NIL");
}
while (DI_PATH_NIL != path) {
if (DI_NODE_NIL == sv_node) {
" - sv_node is DI_NODE_NIL");
} else {
(void) di_devfs_path_free(pathName);
if (status < 0) {
"doDevInfoStuffForIntPort()",
" - stat() call failed: %d", status);
"doDevInfoStuffForIntPort()",
" - errno: [%d].", errno);
"doDevInfoStuffForIntPort()",
" - strerror(errno): [%s].",
"doDevInfoStuffForIntPort()",
" - error exit.");
return (MP_STATUS_FAILED);
}
}
}
return (MP_STATUS_SUCCESS);
}
{
int match = 0;
int count = 0;
int ioctlStatus = 0;
"oid.objectSequenceNumber = %llx",
"mp_ioctl.mp_cmd (MP_GET_TARGET_PORT_PROP) : %d",
" IOCTL call returned: %d", ioctlStatus);
if (ioctlStatus < 0) {
ioctlStatus = errno;
}
if (ioctlStatus != 0) {
"IOCTL call failed. IOCTL error is: %d",
"IOCTL call failed. IOCTL error is: %s",
"IOCTL call failed. mp_ioctl.mp_errno: %x",
if (ENOTSUP == ioctlStatus) {
} else {
mpStatus =
}
" - error exit");
return (mpStatus);
}
if (DI_NODE_NIL == root_node) {
" - di_init() failed");
return (MP_STATUS_FAILED);
}
if (DI_NODE_NIL == sv_node) {
" - di_drv_first_node() failed");
return (MP_STATUS_FAILED);
}
while (DI_NODE_NIL != child_node) {
match = 0;
while (DI_PATH_NIL != path) {
"target-port",
&targetPort);
if (NULL != targetPort) {
if (0 == memcmp(targetPort,
count)) {
match = 1;
break;
}
}
}
if (match) {
" - got a match");
(void) di_devfs_path_free(pathName);
if (status < 0) {
"doDevInfoStuffForTargetPort()",
" - stat() call failed: %d", status);
"doDevInfoStuffForTargetPort()",
" - errno: [%d].", errno);
"doDevInfoStuffForTargetPort()",
" - strerror(errno): [%s].",
"doDevInfoStuffForTargetPort()",
" - error exit.");
return (MP_STATUS_FAILED);
}
}
}
return (MP_STATUS_SUCCESS);
}
{
int numOBJ = 0;
int i = 0;
int ioctlStatus = 0;
" set default request to MP_GET_PATH_LIST_FOR_MP_LU");
"oid.objectSequenceNumber = %llx",
if (g_scsi_vhci_fd < 0) {
"invalid driver file handle");
return (MP_STATUS_FAILED);
}
" set request to MP_GET_PATH_LIST_FOR_INIT_PORT");
if (MP_STATUS_SUCCESS != mpStatus) {
return (mpStatus);
}
" set request to MP_GET_PATH_LIST_FOR_TARGET_PORT");
if (MP_STATUS_SUCCESS != mpStatus) {
return (mpStatus);
}
}
"no memory for objList(1)");
" - error exit");
return (MP_STATUS_INSUFFICIENT_MEMORY);
}
"mp_ioctl.mp_xfer: %d (MP_XFER_READ)",
"ioctl call returned ioctlStatus: %d",
if (ioctlStatus < 0) {
ioctlStatus = errno;
}
"IOCTL call failed. IOCTL error is: %d",
"IOCTL call failed. IOCTL error is: %s",
"IOCTL call failed. mp_ioctl.mp_errno: %x",
if (ENOTSUP == ioctlStatus) {
} else {
}
" - error exit");
return (mpStatus);
}
" - mp_ioctl.mp_alen : %d",
" - sizeof (uint64_t): %d",
sizeof (uint64_t));
"Length of list: %d", numOBJ);
if (numOBJ < 1) {
"driver returned empty list.");
"MP_GetAssociatedPathOidList()",
"no memory for MP_OID_LIST");
"MP_GetAssociatedPathOidList()",
" - error exit");
return (MP_STATUS_INSUFFICIENT_MEMORY);
}
return (MP_STATUS_SUCCESS);
}
"buffer size too small, need : %d",
"no memory for objList(2)");
" - error exit");
return (MP_STATUS_INSUFFICIENT_MEMORY);
}
"mp_ioctl.mp_xfer: %d (MP_XFER_READ)",
"ioctl call returned ioctlStatus: %d",
if (ioctlStatus < 0) {
ioctlStatus = errno;
}
if (ioctlStatus != 0) {
"IOCTL call failed. IOCTL error is: %d",
"IOCTL call failed. IOCTL error is: %s",
"IOCTL call failed. mp_ioctl.mp_errno: %x",
if (ENOTSUP == ioctlStatus) {
} else {
mpStatus =
}
" - error exit");
return (mpStatus);
}
}
"no memory for *ppList");
" - error exit");
return (MP_STATUS_INSUFFICIENT_MEMORY);
}
"(*ppList)->oidCount = %d",
for (i = 0; i < numOBJ; i++) {
"(*ppList)->oids[%d].objectType = %d",
"(*ppList)->oids[%d].ownerId = %d",
"(*ppList)->oids[%d].objectSequenceNumber = %llx",
}
return (MP_STATUS_SUCCESS);
}