Print this page
3217 cfgadm should spell "adaptors" correctly
Reviewed by: Alexander Eremin <alexander.r.eremin@gmail.com>
Reviewed by: David Hoeppner <0xffea@gmail.com>
Reviewed by: Gary Mills <gary_mills@fastmail.fm>
Reviewed by: Eric Schrock <Eric.Schrock@delphix.com>
*** 135,145 ****
{ERR_HBA_LOAD_LIBRARY, 0, 1,
"HBA load library failed"},
{ERR_MATCHING_HBA_PORT, 0, 1,
"No match HBA port found"},
{ERR_NO_ADAPTER_FOUND, 0, 1,
! "No Fibre Channel adpaters found"},
/* Errors with arguments */
{ERRARG_OPT_INVAL, 1, 1, "invalid option: "},
{ERRARG_HWCMD_INVAL, 1, 1, "invalid command: "},
{ERRARG_DEVINFO, 1, 1, "libdevinfo failed on path: "},
--- 135,145 ----
{ERR_HBA_LOAD_LIBRARY, 0, 1,
"HBA load library failed"},
{ERR_MATCHING_HBA_PORT, 0, 1,
"No match HBA port found"},
{ERR_NO_ADAPTER_FOUND, 0, 1,
! "No Fibre Channel adapters found"},
/* Errors with arguments */
{ERRARG_OPT_INVAL, 1, 1, "invalid option: "},
{ERRARG_HWCMD_INVAL, 1, 1, "invalid command: "},
{ERRARG_DEVINFO, 1, 1, "libdevinfo failed on path: "},
*** 1284,1358 ****
}
/* Loop over all HBA Ports */
for (portIndex = 0;
portIndex < hbaAttrs.NumberOfPorts; portIndex++) {
! if ((status = getAdapterPortAttrs(handle, portIndex,
&portAttrs)) != HBA_STATUS_OK) {
/* Need to refresh adapter */
! if (status == HBA_STATUS_ERROR_STALE_DATA) {
HBA_RefreshInformation(handle);
break;
} else {
continue;
}
}
/*
! * check to see if OSDeviceName is a /dev/cfg link
! * or the physical path
*/
! if (strncmp(portAttrs.OSDeviceName, CFGA_DEV_DIR,
strlen(CFGA_DEV_DIR)) != 0) {
! tmpPtr = strstr(portAttrs.OSDeviceName, MINOR_SEP);
! if (tmpPtr != NULL) {
! if (strncmp(portPath,
portAttrs.OSDeviceName,
strlen(portAttrs.OSDeviceName) -
strlen(tmpPtr)) == 0) {
if (matchingHandle)
! *matchingHandle = handle;
if (matchingPortIndex)
! *matchingPortIndex = portIndex;
if (matchingPortAttrs)
! *matchingPortAttrs = portAttrs;
return (FPCFGA_OK);
}
- }
} else {
/*
! * strip off the /dev/cfg/ portion of the
! * OSDeviceName
! * make sure that the OSDeviceName is at least
* strlen("/dev/cfg") + 1 + 1 long.
* first 1 is for the / after /dev/cfg
! * second 1 is to make sure there is somthing
! * after
*/
if (strlen(portAttrs.OSDeviceName) <
(strlen(CFGA_DEV_DIR) + 1 + 1))
continue;
cfg_ptr = portAttrs.OSDeviceName +
strlen(CFGA_DEV_DIR) + 1;
if (logical_apid == NULL) {
! /* get the /dev/cfg link from the portPath */
! if (make_xport_logid(portPath, &logical_apid,
&l_errno) != FPCFGA_OK) {
! cfga_err(errstring, l_errno,
ERR_LIST, 0);
HBA_FreeLibrary();
! return (FPCFGA_LIB_ERR);
}
}
/* compare logical ap_id */
! if (strcmp(logical_apid, cfg_ptr) == 0) {
if (matchingHandle)
! *matchingHandle = handle;
if (matchingPortIndex)
! *matchingPortIndex = portIndex;
if (matchingPortAttrs)
! *matchingPortAttrs = portAttrs;
S_FREE(logical_apid);
return (FPCFGA_OK);
}
}
}
--- 1284,1374 ----
}
/* Loop over all HBA Ports */
for (portIndex = 0;
portIndex < hbaAttrs.NumberOfPorts; portIndex++) {
! if ((status = getAdapterPortAttrs(handle,
! portIndex,
&portAttrs)) != HBA_STATUS_OK) {
/* Need to refresh adapter */
! if (status ==
! HBA_STATUS_ERROR_STALE_DATA) {
HBA_RefreshInformation(handle);
break;
} else {
continue;
}
}
/*
! * check to see if OSDeviceName is a /dev/cfg
! * link or the physical path
*/
! if (strncmp(portAttrs.OSDeviceName,
! CFGA_DEV_DIR,
strlen(CFGA_DEV_DIR)) != 0) {
! tmpPtr = strstr(portAttrs.OSDeviceName,
! MINOR_SEP);
! if ((tmpPtr != NULL) &&
! strncmp(portPath,
portAttrs.OSDeviceName,
strlen(portAttrs.OSDeviceName) -
strlen(tmpPtr)) == 0) {
if (matchingHandle)
! *matchingHandle =
! handle;
if (matchingPortIndex)
! *matchingPortIndex =
! portIndex;
if (matchingPortAttrs)
! *matchingPortAttrs =
! portAttrs;
return (FPCFGA_OK);
}
} else {
/*
! * strip off the /dev/cfg/ portion of
! * the OSDeviceName make sure that the
! * OSDeviceName is at least
* strlen("/dev/cfg") + 1 + 1 long.
* first 1 is for the / after /dev/cfg
! * second 1 is to make sure there is
! * somthing after
*/
if (strlen(portAttrs.OSDeviceName) <
(strlen(CFGA_DEV_DIR) + 1 + 1))
continue;
cfg_ptr = portAttrs.OSDeviceName +
strlen(CFGA_DEV_DIR) + 1;
if (logical_apid == NULL) {
! /*
! * get the /dev/cfg link from
! * the portPath
! */
! if (make_xport_logid(portPath,
! &logical_apid,
&l_errno) != FPCFGA_OK) {
! cfga_err(errstring,
! l_errno,
ERR_LIST, 0);
HBA_FreeLibrary();
! return
! (FPCFGA_LIB_ERR);
}
}
/* compare logical ap_id */
! if (strcmp(logical_apid,
! cfg_ptr) == 0) {
if (matchingHandle)
! *matchingHandle =
! handle;
if (matchingPortIndex)
! *matchingPortIndex =
! portIndex;
if (matchingPortAttrs)
! *matchingPortAttrs =
! portAttrs;
S_FREE(logical_apid);
return (FPCFGA_OK);
}
}
}
*** 1363,1372 ****
HBA_CloseAdapter(handle);
}
free(logical_apid);
! /* Got here. No mathcing adatper port found. */
cfga_err(errstring, 0, ERR_MATCHING_HBA_PORT, 0);
HBA_FreeLibrary();
return (FPCFGA_LIB_ERR);
}
--- 1379,1388 ----
HBA_CloseAdapter(handle);
}
free(logical_apid);
! /* Got here. No matching adapter port found. */
cfga_err(errstring, 0, ERR_MATCHING_HBA_PORT, 0);
HBA_FreeLibrary();
return (FPCFGA_LIB_ERR);
}