/*
* 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 2009 Sun Microsystems, Inc. All rights reserved.
* Use is subject to license terms.
*/
#include <unistd.h>
#include <FCHBA.h>
#include <Exceptions.h>
#include <Trace.h>
#include <iostream>
#include <iomanip>
#include <cerrno>
#include <cstring>
#include <fcntl.h>
#include <unistd.h>
#include <stropts.h>
#include <FCHBAPort.h>
#include <HBAList.h>
using namespace std;
// Add first port
try {
name += "-";
// Grab any other ports on this adapter
int fd;
// construct fcio struct
// open the fcsm node so we can send the ioctl to
errno = 0;
-1) {
throw BusyException();
throw TryAgainException();
throw NotSupportedException();
throw UnavailableException();
} else {
throw IOError("Unable to open FCSM driver");
}
}
errno = 0;
// Interpret the fcio error code
"ADAPTER_LIST failed: "
"Errno: \"%s\"",
throw BusyException();
throw TryAgainException();
throw NotSupportedException();
throw UnavailableException();
} else {
throw IOError("Unable to build HBA list");
}
}
}
} catch (BusyException &e) {
throw e;
} catch (TryAgainException &e) {
throw e;
} catch (UnavailableException &e) {
throw e;
} catch (HBAException &e) {
"Unable to construct HBA.");
throw e;
}
}
return (name);
}
int fd;
errno = 0;
// Why did we fail?
throw BusyException();
throw TryAgainException();
throw NotSupportedException();
} else {
}
}
errno = 0;
throw BusyException();
throw TryAgainException();
throw NotSupportedException();
} else {
throw IOError("Unable to fetch adapter attributes");
}
}
/* Now copy over the payload */
return (attributes);
}
int fd;
errno = 0;
throw BusyException();
throw TryAgainException();
throw NotSupportedException();
} else {
}
}
errno = 0;
throw BusyException();
throw TryAgainException();
throw NotSupportedException();
} else {
throw IOError("Unable to reinitialize the link");
}
} else {
return (fcio.fcio_errno);
}
}
int fd;
errno = 0;
// Why did we fail?
throw BusyException();
throw TryAgainException();
throw NotSupportedException();
} else {
}
}
errno = 0;
throw BusyException();
throw TryAgainException();
throw NotSupportedException();
} else {
throw IOError("Unable to fetch adapter attributes");
}
}
/* Now copy over the payload */
return (attributes);
}
int fd;
bool retry = false;
int bufSize;
/* Before we do anything, let's see if FCSM is on the system */
errno = 0;
"The %s driver is not present. Unable to issue "
"CT commands. Please install the %s package.",
throw NotSupportedException();
} else {
"Can not stat the %s driver for reason \"%s\" "
"Unable to issue CT commands.",
throw IOError("Unable to stat FCSM driver");
}
}
/* construct fcio struct */
/* open the fcsm node so we can send the ioctl to */
errno = 0;
throw BusyException();
throw TryAgainException();
throw NotSupportedException();
throw UnavailableException();
} else {
throw IOError("Unable to open FCSM driver");
}
}
do {
retry = false;
errno = 0;
/* Interpret the fcio error code */
"ADAPTER_LIST failed: "
"Errno: \"%s\"",
delete (pathList);
throw BusyException();
throw TryAgainException();
throw NotSupportedException();
throw UnavailableException();
} else {
throw IOError("Unable to build HBA list");
}
}
"Buffer too small for number of HBAs. Retrying.");
retry = true;
delete (pathList);
}
} while (retry);
try {
i++;
} catch (BusyException &e) {
sleep(1);
if (times++ > EXCPT_RETRY_COUNT) {
i++;
times = 0;
}
continue;
} catch (TryAgainException &e) {
sleep(1);
if (times++ > EXCPT_RETRY_COUNT) {
i++;
times = 0;
}
continue;
} catch (UnavailableException &e) {
sleep(1);
if (times++ > EXCPT_RETRY_COUNT) {
i++;
times = 0;
}
continue;
} catch (HBAException &e) {
i++;
times = 0;
"Ignoring partial failure while loading an HBA");
}
}
delete(pathList);
throw InternalError(
"Exceeds max number of adapters that VSL supports.");
}
delete (pathList);
}