/*
* 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 "FCHBANPIVPort.h"
#include <Exceptions.h>
#include <Trace.h>
#include <sun_fc.h>
#include <iostream>
#include <iomanip>
#include <fcntl.h>
#include <unistd.h>
#include <stropts.h>
#include <dirent.h>
#include <errno.h>
using namespace std;
try {
} catch (...) {
path = "/devices";
path += ":fc";
}
}
return (attributes);
}
try {
int times = 0;
(void) sleep(2);
if (times++ > 20) {
break;
}
}
if (fcio->fcio_errno) {
throw IOError("IOCTL transport failure");
}
} catch (...) {
switch (fcio->fcio_errno) {
case FC_BADWWN:
throw IllegalWWNException();
case FC_BADPORT:
throw IllegalWWNException();
case FC_OUTOFBOUNDS:
throw IllegalIndexException();
case FC_PBUSY:
case FC_FBUSY:
case FC_TRAN_BUSY:
case FC_STATEC_BUSY:
case FC_DEVICE_BUSY:
throw BusyException();
case FC_SUCCESS:
default:
throw;
}
}
}
/*
* Interpret the error code in the fcio_t structure
*
* message must be at least MAX_FCIO_MSG_LEN in length.
*/
void
return;
}
switch (fcio_errno) {
case (uint32_t)FC_FAILURE:
fcioErrorString = "general failure";
break;
case (uint32_t)FC_FAILURE_SILENT:
fcioErrorString = "general failure but fail silently";
break;
case FC_SUCCESS:
fcioErrorString = "successful completion";
break;
case FC_CAP_ERROR:
fcioErrorString = "FCA capability error";
break;
case FC_CAP_FOUND:
fcioErrorString = "FCA capability unsettable";
break;
case FC_CAP_SETTABLE:
fcioErrorString = "FCA capability settable";
break;
case FC_UNBOUND:
fcioErrorString = "unbound stuff";
break;
case FC_NOMEM:
fcioErrorString = "allocation error";
break;
case FC_BADPACKET:
fcioErrorString = "invalid packet specified/supplied";
break;
case FC_OFFLINE:
fcioErrorString = "I/O resource unavailable";
break;
case FC_OLDPORT:
fcioErrorString = "operation on non-loop port";
break;
case FC_NO_MAP:
fcioErrorString = "requested map unavailable";
break;
case FC_TRANSPORT_ERROR:
fcioErrorString = "unable to transport I/O";
break;
case FC_ELS_FREJECT:
fcioErrorString = "ELS rejected by a Fabric";
break;
case FC_ELS_PREJECT:
fcioErrorString = "ELS rejected by an N_port";
break;
case FC_ELS_BAD:
fcioErrorString = "ELS rejected by FCA/fctl";
break;
case FC_ELS_MALFORMED:
fcioErrorString = "poorly formed ELS request";
break;
case FC_TOOMANY:
fcioErrorString = "resource request too large";
break;
case FC_UB_BADTOKEN:
fcioErrorString = "invalid unsolicited buffer token";
break;
case FC_UB_ERROR:
fcioErrorString = "invalid unsol buf request";
break;
case FC_UB_BUSY:
fcioErrorString = "buffer already in use";
break;
case FC_BADULP:
fcioErrorString = "Unknown ulp";
break;
case FC_BADTYPE:
fcioErrorString = "ULP not registered to handle this FC4 type";
break;
case FC_UNCLAIMED:
fcioErrorString = "request or data not claimed";
break;
case FC_ULP_SAMEMODULE:
fcioErrorString = "module already in use";
break;
case FC_ULP_SAMETYPE:
fcioErrorString = "FC4 module already in use";
break;
case FC_ABORTED:
fcioErrorString = "request aborted";
break;
case FC_ABORT_FAILED:
fcioErrorString = "abort request failed";
break;
case FC_BADEXCHANGE:
fcioErrorString = "exchange doesn\325t exist";
break;
case FC_BADWWN:
fcioErrorString = "WWN not recognized";
break;
case FC_BADDEV:
fcioErrorString = "device unrecognized";
break;
case FC_BADCMD:
fcioErrorString = "invalid command issued";
break;
case FC_BADOBJECT:
fcioErrorString = "invalid object requested";
break;
case FC_BADPORT:
fcioErrorString = "invalid port specified";
break;
case FC_NOTTHISPORT:
fcioErrorString = "resource not at this port";
break;
case FC_PREJECT:
fcioErrorString = "reject at remote N_Port";
break;
case FC_FREJECT:
fcioErrorString = "reject at remote Fabric";
break;
case FC_PBUSY:
fcioErrorString = "remote N_Port busy";
break;
case FC_FBUSY:
fcioErrorString = "remote Fabric busy";
break;
case FC_ALREADY:
fcioErrorString = "already logged in";
break;
case FC_LOGINREQ:
fcioErrorString = "login required";
break;
case FC_RESETFAIL:
fcioErrorString = "reset failed";
break;
case FC_INVALID_REQUEST:
fcioErrorString = "request is invalid";
break;
case FC_OUTOFBOUNDS:
fcioErrorString = "port number is out of bounds";
break;
case FC_TRAN_BUSY:
fcioErrorString = "command transport busy";
break;
case FC_STATEC_BUSY:
fcioErrorString = "port driver currently busy";
break;
case FC_DEVICE_BUSY:
fcioErrorString = "transport working on this device";
break;
case FC_DEVICE_NOT_TGT:
fcioErrorString = "device is not a SCSI target";
break;
default:
return;
}
}