/*
* 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 "HBAPort.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 <dirent.h>
#include <libdevinfo.h>
using namespace std;
/**
* Standard definition for general topology lookup (See T11 FC-FS)
*/
/**
* @memo Construct a new deafult HBA Port
*/
}
/**
* @memo Compare two HBA ports for equality
* @return TRUE if both ports are the same
* @return FALSE if the ports are different
*
* @doc Comparison is based on Node WWN, Port WWN and path
*/
}
/**
* @memo Validate that the port is still present in the system
* @exception UnavailableException if the port is not present
*
* @doc If the port is still present on the system, the routine
* will return normally. If the port is not present
* an exception will be thrown.
*/
throw UnavailableException();
} else {
throw InternalError();
}
}
}
/*
* structure for di_devlink_walk
*/
typedef struct walk_devlink {
char *path;
char **linkpp;
/**
* @memo callback funtion for di_devlink_walk
* @postcondition Find matching /dev link for the given path argument.
* @param devlink element and callback function argument.
*
* @doc The input path is expected to not have "/devices".
*/
extern "C" int
/*
* When path is specified, it doesn't have minor
* name. Therefore, the ../.. prefixes needs to be stripped.
*/
// di_devlink_content contains /devices
// make it sure the device path has minor name
return (DI_WALK_CONTINUE);
}
return (DI_WALK_TERMINATE);
}
/**
* @memo Convert /devices paths to /dev sym-link paths.
* @postcondition The mapping buffer OSDeviceName paths will be
* converted to short names.
* @param mappings The target mappings data to convert to
* short names
*
* @doc If no link
* is found, the long path is left as is.
* Note: The NumberOfEntries field MUST not be greater than the size
* of the array passed in.
*/
// no need to check further, just return here.
return;
}
for (int j = 0; j < mappings->NumberOfEntries; j++) {
// search link for minor node
strlen("/devices");
} else {
}
} else {
minor_path = NULL;
"/devices") != NULL) {
strlen ("/devices");
strlen ("/devices");
} else {
}
}
(void *)&warg, get_devlink);
"%s", devlinkp);
} // else leave OSDeviceName alone.
}
}
/*
* Finds controller path for a give device path.
*
* Return vale: controller path.
*/
tmp += "to find controller number.";
delete (dir_buf);
}
continue;
}
cfg_path += "/";
delete (dir_buf);
return (cfg_path);
}
}
}
delete (dir_buf);
throw InternalError("Unable to find controller path");
}
lock();
// support hba with up to UCHAR_MAX number of ports.
unlock();
throw InternalError("HBA NPIV Port count exceeds max number of ports");
}
try {
unlock();
} catch (...) {
unlock();
throw;
}
}
lock();
try {
throw IllegalWWNException();
}
unlock();
return (port);
} catch (...) {
unlock();
throw;
}
}
lock();
try {
throw IllegalIndexException();
}
unlock();
return (tmp);
} catch (...) {
unlock();
throw;
}
}