#include "vlib.h"
Go to the source code of this file.
Functions | |
struct vlib_adapter * | getAdapterByIndex (uint32_t) |
Get an adapter by its index. | |
struct vlib_adapter * | getAdapterByHandle (HBA_HANDLE, HBA_STATUS *) |
Get an adapter by its handle. | |
struct vlib_adapter * | getAdapterByDevid (devid_t) |
Get an adapter by its devid. | |
struct vlib_port * | getPortByIndex (const struct vlib_adapter *, const uint32_t) |
Get a port by its index. | |
struct vlib_port * | getPortByWWPN (const struct vlib_adapter *, const wwn_t) |
Get a port by its WWPN. | |
struct vlib_unit * | getUnitByIndex (const struct vlib_port *, const uint32_t) |
Get an unit by its index. | |
struct vlib_unit * | getUnitByFcLun (const struct vlib_port *, uint64_t) |
Get an unit by its fclun. | |
int | addAdapterToRepos (struct vlib_adapter *) |
Add an adapter from an event to the repository. | |
int | addPortToRepos (struct vlib_adapter *, struct vlib_port *) |
Add a port from to the repository. | |
int | addUnitToRepos (struct vlib_port *, struct vlib_unit *) |
Add a unit to the repository. | |
int | findIndexByName (char *) |
Find an adapter index by name. | |
HBA_HANDLE | openAdapterByIndex (HBA_UINT32) |
Open an adapter by index. | |
char * | getSgDevFromPort (struct vlib_port *) |
Get the first sg device from an adapter. | |
char * | getAttachedWLUN (struct vlib_adapter *, struct vlib_port *) |
Try to attach the report luns wlun and return its name as in "/dev". | |
void | detachWLUN (struct vlib_adapter *, struct vlib_port *) |
Try to detach lun 0. | |
int | revalidateAdapters (void) |
Revalidate adapters in the repository. | |
int | updateAdapter (struct vlib_adapter *adapter) |
Update information about ports and units of an adapter. | |
void | doCloseAdapter (struct vlib_adapter *) |
Close an adapter in the repository. | |
void | closeAllAdapters (void) |
Close all adapters in the repository. | |
HBA_PORTTYPE | vlibCharToIntPortType (char *) |
Map the result of a port type string from sysfs to an int. | |
HBA_PORTSTATE | vlibCharToIntPortState (char *) |
Map the result of a port state string from sysfs to an int. | |
HBA_PORTSPEED | vlibCharToIntPortSpeed (char *) |
Map the result of a port speed string to the HBA_PORTSPEED int. | |
HBA_COS | vlibCharToIntCOS (char *) |
Map the result of a class of service string to an int. | |
static void | vlib_wwn_to_HBA_WWN (uint64_t wwn, HBA_WWN *hba) |
Convert uint64_t to HBA_WWN -- hide ill-favoured type cast. | |
static void | vlib_HBA_WWN_to_wwn (HBA_WWN *hba, uint64_t *wwn) |
Convert HBA_WWN to uint64_t -- hide ill-favoured type cast. | |
static uint32_t | vlib_FCID_to_hbaFCID (uint32_t fcid) |
Convert a FC DID to a FC-HBA PortFcId. | |
static uint32_t | vlib_hbaFCID_to_FCID (uint32_t fcid) |
Convert a FC-HBA PortFcId to a FC DID. | |
static void | invalidateAllAdapters (void) |
Mark all adapters in repository as invalid. | |
static void | markRepositoryInvalid (void) |
Mark repositroy of library as invalid. This is appropriate if a loss of events is detected. |
int addAdapterToRepos | ( | struct vlib_adapter * | adapter | ) |
Add an adapter from an event to the repository.
*event | adapter add event |
References block_addItem(), vlib_adapter_ident::bus_dev_name, vlib_adapter_ident::class_dev_name, vlib_adapter_ident::devid, getAdapterFromRepos(), vlib_adapter::handle, vlib_adapter::ident, vlib_adapter::isInvalid, VLIB_INVALID_HANDLE, vlib_adapter_ident::wwnn, and vlib_adapter_ident::wwpn.
Referenced by addAdapterByBusDev().
int addPortToRepos | ( | struct vlib_adapter * | adapter, | |
struct vlib_port * | port | |||
) |
Add a port from to the repository.
*adapter | to which the port data should be added, if NULL is passed the adapter should be identified by the data in the event | |
*port | port to be added |
References block_addItem(), vlib_port::channel, vlib_port::did, getPortFromRepos(), vlib_port::host, vlib_port::isInvalid, vlib_port::name, vlib_adapter::ports, vlib_port::target, vlib_port::wwnn, and vlib_port::wwpn.
Referenced by addPortByName().
Add a unit to the repository.
*port | to which the unit data should be added, if NULL is passed the port should be identified by the data in the event | |
*unit | unit to be aded |
References block_addItem(), getUnitFromRepos(), vlib_unit::isInvalid, and vlib_port::units.
Referenced by sysfs_getUnitsFromPort().
void closeAllAdapters | ( | void | ) |
Close all adapters in the repository.
References block_free(), doCloseAdapter(), and getAdapterByIndex().
Referenced by HBA_FreeLibrary().
void detachWLUN | ( | struct vlib_adapter * | adapter, | |
struct vlib_port * | port | |||
) |
Try to detach lun 0.
adapter* | Pointer to an adapter | |
port* | Pointer to a port |
References vlib_adapter_ident::bus_dev_name, vlib_unit::channel, getUnitByIndex(), vlib_unit::host, vlib_adapter::ident, REPORTLUNS_WLUN, revalidateUnits(), vlib_unit::target, and vlib_port::wwpn.
Referenced by HBA_SendReportLUNs().
void doCloseAdapter | ( | struct vlib_adapter * | adapter | ) |
Close an adapter in the repository.
*adapter | pointer to the adapter to be closed |
References block_free(), getPortByIndex(), vlib_adapter::handle, vlib_adapter::ports, vlib_port::units, block::used, and VLIB_INVALID_HANDLE.
Referenced by closeAllAdapters(), HBA_CloseAdapter(), and revalidateAdapters().
int findIndexByName | ( | char * | name | ) |
Find an adapter index by name.
name | the name of the adapter |
References getAdapterByIndex(), vlib_adapter::isInvalid, VLIB_ADAPTERNAME_LEN, and VLIB_ADAPTERNAME_PREFIX.
Referenced by HBA_OpenAdapter().
struct vlib_adapter* getAdapterByDevid | ( | devid_t | devid | ) | [read] |
Get an adapter by its devid.
devid | of the adapter |
References vlib_adapter_ident::devid, getAdapterByIndex(), and vlib_adapter::ident.
struct vlib_adapter* getAdapterByHandle | ( | HBA_HANDLE | handle, | |
HBA_STATUS * | status | |||
) | [read] |
Get an adapter by its handle.
handle | of the adapter | |
*status | pointer to return error status code |
References getAdapterByIndex(), vlib_adapter::isInvalid, and VLIB_INVALID_HANDLE.
Referenced by HBA_CloseAdapter(), HBA_GetAdapterAttributes(), HBA_GetAdapterPortAttributes(), HBA_GetDiscoveredPortAttributes(), HBA_GetFcpTargetMapping(), HBA_GetFcpTargetMappingV2(), HBA_GetPortStatistics(), HBA_RefreshInformation(), HBA_SendReportLUNs(), and HBA_SendScsiInquiry().
struct vlib_adapter* getAdapterByIndex | ( | uint32_t | index | ) | [read] |
Get an adapter by its index.
index | of the adapter |
Referenced by closeAllAdapters(), findIndexByName(), getAdapterByDevid(), getAdapterByHandle(), getAdapterFromRepos(), HBA_GetAdapterName(), invalidateAllAdapters(), openAdapterByIndex(), and revalidateAdapters().
char* getAttachedWLUN | ( | struct vlib_adapter * | adapter, | |
struct vlib_port * | port | |||
) |
Try to attach the report luns wlun and return its name as in "/dev".
adapter* | Pointer to an adapter | |
port* | Pointer to a port |
References vlib_adapter_ident::bus_dev_name, getSgDevFromPort(), vlib_adapter::ident, REPORTLUNS_WLUN, and vlib_port::wwpn.
Referenced by HBA_SendReportLUNs().
struct vlib_port* getPortByIndex | ( | const struct vlib_adapter * | adapter, | |
const uint32_t | index | |||
) | [read] |
Get a port by its index.
*adapter | to which the port belongs | |
index | of the port |
References block::data, vlib_adapter::ports, and block::used.
Referenced by doCloseAdapter(), getPortByWWPN(), getPortFromRepos(), HBA_GetDiscoveredPortAttributes(), HBA_GetFcpTargetMapping(), and updateAdapter().
struct vlib_port* getPortByWWPN | ( | const struct vlib_adapter * | adapter, | |
const wwn_t | wwpn | |||
) | [read] |
Get a port by its WWPN.
*adapter | to which the port belongs | |
wwpn | of the port |
References getPortByIndex(), vlib_adapter::ports, block::used, and vlib_port::wwpn.
Referenced by HBA_SendReportLUNs(), and HBA_SendScsiInquiry().
char* getSgDevFromPort | ( | struct vlib_port * | port | ) |
Get the first sg device from an adapter.
port* | Pointer to a port |
References getUnitByIndex(), revalidateUnits(), and vlib_unit::sg_dev.
Referenced by getAttachedWLUN(), and HBA_SendReportLUNs().
Get an unit by its fclun.
*port | to which the unit belongs | |
index | of the unit |
References vlib_unit::fcLun, getUnitByIndex(), vlib_port::units, and block::used.
Referenced by HBA_SendScsiInquiry().
Get an unit by its index.
*port | to which the unit belongs | |
index | of the unit |
References block::data, vlib_port::units, and block::used.
Referenced by detachWLUN(), getSgDevFromPort(), getUnitByFcLun(), getUnitFromRepos(), and HBA_GetFcpTargetMapping().
static void invalidateAllAdapters | ( | void | ) | [inline, static] |
Mark all adapters in repository as invalid.
References getAdapterByIndex(), and vlib_adapter::isInvalid.
static void markRepositoryInvalid | ( | void | ) | [inline, static] |
Mark repositroy of library as invalid. This is appropriate if a loss of events is detected.
References VLIB_MUTEX_LOCK, and VLIB_MUTEX_UNLOCK.
HBA_HANDLE openAdapterByIndex | ( | HBA_UINT32 | index | ) |
Open an adapter by index.
index | of the adapter |
References getAdapterByIndex(), vlib_adapter::handle, and VLIB_INVALID_HANDLE.
Referenced by HBA_OpenAdapter().
int revalidateAdapters | ( | void | ) |
Revalidate adapters in the repository.
References block::allocated, doCloseAdapter(), getAdapterByIndex(), vlib_adapter::isInvalid, vlib_adapter::ports, and updateAdapter().
Referenced by sysfs_createAndReadConfigAdapter().
int updateAdapter | ( | struct vlib_adapter * | adapter | ) |
Update information about ports and units of an adapter.
*adapter | to be updated |
References getPortByIndex(), vlib_adapter::isInvalid, vlib_adapter::ports, sysfs_createAndReadConfigPorts(), sysfs_getUnitsFromPort(), and block::used.
Referenced by HBA_RefreshInformation(), and revalidateAdapters().
static uint32_t vlib_FCID_to_hbaFCID | ( | uint32_t | fcid | ) | [inline, static] |
Convert a FC DID to a FC-HBA PortFcId.
fcid | a FC DID (uses 3 least significant bytes) |
Referenced by getPortAttributes(), and HBA_GetFcpTargetMapping().
static void vlib_HBA_WWN_to_wwn | ( | HBA_WWN * | hba, | |
uint64_t * | wwn | |||
) | [inline, static] |
Convert HBA_WWN to uint64_t -- hide ill-favoured type cast.
*hba | pointer WWN of type HBA_WWN (to be converted) | |
*wwn | pointer to return WWN as uint64_t |
Referenced by HBA_GetFcpTargetMappingV2(), HBA_SendReportLUNs(), and HBA_SendScsiInquiry().
static uint32_t vlib_hbaFCID_to_FCID | ( | uint32_t | fcid | ) | [inline, static] |
Convert a FC-HBA PortFcId to a FC DID.
fcid | PortFcId as specified in FC-HBA (uses 3 most significant bytes) |
static void vlib_wwn_to_HBA_WWN | ( | uint64_t | wwn, | |
HBA_WWN * | hba | |||
) | [inline, static] |
Convert uint64_t to HBA_WWN -- hide ill-favoured type cast.
wwn | WWN stored as uint64_t (to be converted) | |
*hba | pointer to return WWN of type HBA_WWN |
Referenced by getPortAttributes(), HBA_GetFcpTargetMapping(), and sysfs_getAdapterAttributes().
HBA_COS vlibCharToIntCOS | ( | char * | s | ) |
Map the result of a class of service string to an int.
char* | containing the class of service string |
References vlibCOStoFlag().
Referenced by getPortAttributes().
HBA_PORTSPEED vlibCharToIntPortSpeed | ( | char * | pS | ) |
Map the result of a port speed string to the HBA_PORTSPEED int.
char* | containing the port speed string |
References vlibIntToSymbolPortSpeed().
Referenced by getPortAttributes().
HBA_PORTSTATE vlibCharToIntPortState | ( | char * | portState | ) |
Map the result of a port state string from sysfs to an int.
char* | containing the port state |
Referenced by getPortAttributes().
HBA_PORTTYPE vlibCharToIntPortType | ( | char * | portType | ) |
Map the result of a port type string from sysfs to an int.
char* | containing the port type |
Referenced by getPortAttributes().