27 #define VLIB_GROW_UNITS 8
28 #define VLIB_GROW_PORTS 4
29 #define VLIB_GROW_ADAPTERS 2
34 #define min(a, b) (((a) < (b)) ? (a) : (b))
53 HBA_STATUS getAdapterConfig(
void);
83 *((uint64_t *)(&hba->wwn)) = wwn;
93 *wwn = *((uint64_t *)hba->wwn);
static uint32_t vlib_FCID_to_hbaFCID(uint32_t fcid)
Convert a FC DID to a FC-HBA PortFcId.
Definition: vlib_aux.h:101
struct vlib_adapter * getAdapterByHandle(HBA_HANDLE handle, HBA_STATUS *status)
Get an adapter by its handle.
Definition: vlib_aux.c:143
struct vlib_port * getPortByIndex(const struct vlib_adapter *adapter, const uint32_t index)
Get a port by its index.
Definition: vlib_aux.c:230
int addAdapterToRepos(struct vlib_adapter *adapter)
Add an adapter to the repository.
Definition: vlib_aux.c:472
#define VLIB_MUTEX_LOCK(mutex)
To lock a mutex, this macro is used, which checks for errors.
Definition: vlib.h:571
Primary data structure used in the library.
Definition: vlib.h:484
void doCloseAdapter(struct vlib_adapter *adapter)
Close an adapter in the repository.
Definition: vlib_aux.c:644
unsigned int isInvalid
Adapter invalid or not.
Definition: vlib.h:475
struct vlib_unit * getUnitByIndex(const struct vlib_port *port, const uint32_t index)
Get an unit by its index.
Definition: vlib_aux.c:276
static void markRepositoryInvalid(void)
Mark repositroy of library as invalid. This is appropriate if a loss of events is detected...
Definition: vlib_aux.h:138
struct vlib_unit * getUnitByFcLun(const struct vlib_port *port, uint64_t fcLun)
Get an unit by its fclun.
Definition: vlib_aux.c:295
unsigned int isValid
Repositoy valid or not This flag is set for instance if a loss of events is detected.
Definition: vlib.h:487
size_t used
number of used elements in the array
Definition: vlib.h:427
char * getAttachedWLUN(struct vlib_adapter *adapter, struct vlib_port *port)
Try to attach the report luns wlun and return its name as in "/dev".
Definition: vlib_aux.c:893
HBA_HANDLE openAdapterByIndex(HBA_UINT32 index)
Open an adapter by index.
Definition: vlib_aux.c:614
struct block adapters
List of adapters In fact this is the anchor of the library's repository.
Definition: vlib.h:494
int updateAdapter(struct vlib_adapter *adapter)
Update information about ports and units of an adapter.
Definition: vlib_aux.c:512
HBA_PORTSTATE vlibCharToIntPortState(char *portState)
Map the result of a port state string from sysfs to an int.
Definition: vlib_aux.c:713
char * getSgDevFromPort(struct vlib_port *port)
Get the first sg device from an adapter.
Definition: vlib_aux.c:869
void detachWLUN(struct vlib_adapter *adapter, struct vlib_port *port)
Try to detach lun 0.
Definition: vlib_aux.c:923
struct vlib_adapter * getAdapterByDevid(devid_t devid)
Get an adapter by its devid.
Definition: vlib_aux.c:176
static uint32_t vlib_hbaFCID_to_FCID(uint32_t fcid)
Convert a FC-HBA PortFcId to a FC DID.
Definition: vlib_aux.h:111
int addUnitToRepos(struct vlib_port *port, struct vlib_unit *unit)
Add a unit to the repository.
Definition: vlib_aux.c:351
pthread_mutex_t mutex
Protects this structure.
Definition: vlib.h:499
Central header file for the library.
int findIndexByName(char *name)
Find an adapter index by name.
Definition: vlib_aux.c:582
int addPortToRepos(struct vlib_adapter *adapter, struct vlib_port *port)
Add a port from to the repository.
Definition: vlib_aux.c:409
Represenation of an adapter in the library.
Definition: vlib.h:474
struct vlib_port * getPortByWWPN(const struct vlib_adapter *adapter, const wwn_t wwpn)
Get a port by its WWPN.
Definition: vlib_aux.c:249
struct vlib_adapter * getAdapterByHostNo(unsigned short host)
Get an adapter by SCSI Host number as in sysfs.
Definition: vlib_aux.c:202
HBA_PORTTYPE vlibCharToIntPortType(char *portType)
Map the result of a port type string from sysfs to an int.
Definition: vlib_aux.c:688
HBA_COS vlibCharToIntCOS(char *s)
Map the result of a class of service string to an int.
Definition: vlib_aux.c:841
static void invalidateAllAdapters(void)
Mark all adapters in repository as invalid.
Definition: vlib_aux.h:122
struct vlib_adapter * getAdapterByIndex(uint32_t index)
Get an adapter by its index.
Definition: vlib_aux.c:118
void closeAllAdapters(void)
Close all adapters in the repository.
Definition: vlib_aux.c:669
static void vlib_wwn_to_HBA_WWN(uint64_t wwn, HBA_WWN *hba)
Convert uint64_t to HBA_WWN – hide ill-favoured type cast.
Definition: vlib_aux.h:81
HBA_PORTSPEED vlibCharToIntPortSpeed(char *pS)
Map the result of a port speed string to the HBA_PORTSPEED int.
Definition: vlib_aux.c:778
int revalidateAdapters(void)
Revalidate adapters in the repository.
Definition: vlib_aux.c:546
Representation of a FC port in the library.
Definition: vlib.h:443
#define VLIB_MUTEX_UNLOCK(mutex)
To unlock a mutex, this macro is used, which checks for errors.
Definition: vlib.h:594
static void vlib_HBA_WWN_to_wwn(HBA_WWN *hba, uint64_t *wwn)
Convert HBA_WWN to uint64_t – hide ill-favoured type cast.
Definition: vlib_aux.h:91
Represenation of an FCP unit in the library.
Definition: vlib.h:432