ZFCP HBA API Library 1
vlib_sysfs.h File Reference

All calls that need the sysfs. More...

Go to the source code of this file.

Functions

HBA_STATUS sysfs_createAndReadConfigPorts (struct vlib_adapter *)
 Read and store all discovered ports of an adapter.
HBA_STATUS sysfs_createAndReadConfigAdapter ()
 Read all adapters from /sys/bus/ccw/drivers/zfcp and add them to the repository.
HBA_STATUS sysfs_getDiscoveredPortAttributes (HBA_PORTATTRIBUTES **, struct vlib_port *)
 Retrieve adapter attributes.
HBA_STATUS sysfs_getAdapterPortAttributes (HBA_PORTATTRIBUTES **, struct vlib_adapter *)
 Retrieve adapter attributes.
HBA_STATUS sysfs_getAdapterAttributes (HBA_ADAPTERATTRIBUTES **, struct vlib_adapter *)
 Retrieve adapter attributes.
HBA_STATUS sysfs_getPortStatistics (HBA_PORTSTATISTICS **, struct vlib_adapter *)
 Retrieve adapter port statistics.
int sysfs_getUnitsFromPort (struct vlib_port *)
 Get unit configuration information for a port.
static HBA_STATUS revalidateRepository (void)
 Check status of the repository, and possibly revalidate it.
static int revalidatePorts (struct vlib_adapter *adapter)
 Revalidate ports of an adapter in the repository.
static int revalidateUnits (struct vlib_port *port)
 Revalidate units of an adapter and port in the repository.

Detailed Description

All calls that need the sysfs.

Function Documentation

◆ revalidatePorts()

int revalidatePorts ( struct vlib_adapter * adapter)
inlinestatic

Revalidate ports of an adapter in the repository.

Parameters
*adapterfor which ports should be revalidated
Returns
  • -1 on error
  • 0 on success
Locks:
vlib_data.mutex must be held

This function might trigger the creation of port configuration information for an adapter.

References block::allocated, vlib_adapter::ports, and sysfs_createAndReadConfigPorts().

Referenced by HBA_GetAdapterPortAttributes(), and HBA_GetFcpTargetMapping().

◆ revalidateRepository()

HBA_STATUS revalidateRepository ( void )
inlinestatic

Check status of the repository, and possibly revalidate it.

Returns
  • HBA_STATUS_ERROR_NOT_LOADED if not loaded
  • HBA_STATUS_ERROR on revalidation error
  • HBA_STATUS_OK on success
Locks:
vlib_data.mutex must be held

Function getAdapterConfig() is called if the repository is not valid, thus revalidating it.

References vlib_data::isLoaded, vlib_data::isValid, and sysfs_createAndReadConfigAdapter().

Referenced by _HBA_SendReadCapacity(), HBA_GetAdapterAttributes(), HBA_GetAdapterName(), HBA_GetAdapterPortAttributes(), HBA_GetDiscoveredPortAttributes(), HBA_GetEventBuffer(), HBA_GetFcpTargetMapping(), HBA_GetNumberOfAdapters(), HBA_GetPortStatistics(), HBA_GetRNIDMgmtInfo(), HBA_OpenAdapter(), HBA_RefreshAdapterConfiguration(), HBA_SendCTPassThru(), and HBA_SendRNID().

◆ revalidateUnits()

int revalidateUnits ( struct vlib_port * port)
inlinestatic

Revalidate units of an adapter and port in the repository.

Parameters
*adapterto which the port belongs
*portfor which the units should be revalidated
Returns
  • -1 on error
  • 0 on success
Locks:
vlib_data.mutex must be held

This function might trigger the creation of unit configuration information for an adapter and port.

References block::allocated, sysfs_getUnitsFromPort(), and vlib_port::units.

Referenced by detachWLUN(), getSgDevFromPort(), and HBA_GetFcpTargetMapping().

◆ sysfs_createAndReadConfigAdapter()

HBA_STATUS sysfs_createAndReadConfigAdapter ( )

Read all adapters from /sys/bus/ccw/drivers/zfcp and add them to the repository.

Returns
  • HBA_STATUS_ERROR if any other internal error occurs
    • HBA_STATUS_OK on success.
Locks:
vlib_data.mutex must be held

References addAdapterByDevPath(), vlib_data::isValid, and revalidateAdapters().

Referenced by HBA_LoadLibrary(), and revalidateRepository().

◆ sysfs_createAndReadConfigPorts()

HBA_STATUS sysfs_createAndReadConfigPorts ( struct vlib_adapter * adapter)

Read and store all discovered ports of an adapter.

Parameters
*adapterpointer to the adapter in which we are interested
Returns
  • HBA_STATUS_ERROR if any other internal error occurs
    • HBA_STATUS_OK on success.
Locks:
vlib_data.mutex must be held

References addPortByName(), vlib_adapter_ident::devid, vlib_adapter_ident::host, vlib_adapter::ident, and vlib_adapter_ident::sysfsPath.

Referenced by revalidatePorts(), and updateAdapter().

◆ sysfs_getAdapterAttributes()

HBA_STATUS sysfs_getAdapterAttributes ( HBA_ADAPTERATTRIBUTES ** pAttrs,
struct vlib_adapter * adapter )

Retrieve adapter attributes.

Parameters
**pAdapterattributes,HBA_ADAPTERATTRIBUTESto be filled
*adapterto work with
Returns
  • HBA_STATUS_ERROR if any other internal error occurs
    • HBA_STATUS_OK on success.

This function reads attributes from sysfs to fill in the required information.

References vlib_adapter_ident::bus_dev_name, vlib_adapter_ident::host, vlib_adapter::ident, vlib_adapter_ident::sysfsPath, vlib_wwn_to_HBA_WWN(), and vlib_adapter_ident::wwnn.

Referenced by HBA_GetAdapterAttributes().

◆ sysfs_getAdapterPortAttributes()

HBA_STATUS sysfs_getAdapterPortAttributes ( HBA_PORTATTRIBUTES ** pAttrs,
struct vlib_adapter * adapter )

Retrieve adapter attributes.

Parameters
**pPortattributes,HBA_ADAPTERATTRIBUTESto be filled
*adapterto work with
Returns
  • HBA_STATUS_ERROR if any other internal error occurs
    • HBA_STATUS_OK on success.

This function reads attributes from sysfs to fill in the required information.

References addPortByName(), vlib_adapter_ident::devid, getPortAttributes(), vlib_adapter_ident::host, vlib_adapter::ident, and vlib_adapter_ident::sysfsPath.

Referenced by HBA_GetAdapterPortAttributes().

◆ sysfs_getDiscoveredPortAttributes()

HBA_STATUS sysfs_getDiscoveredPortAttributes ( HBA_PORTATTRIBUTES ** pAttrs,
struct vlib_port * port )

Retrieve adapter attributes.

Parameters
**pPortattributes,HBA_ADAPTERATTRIBUTESto be filled
*adapterto work with
Returns
  • HBA_STATUS_ERROR if any other internal error occurs
    • HBA_STATUS_OK on success.

This function reads attributes from sysfs to fill in the required information.

References getPortAttributes(), and vlib_port::name.

Referenced by HBA_GetDiscoveredPortAttributes().

◆ sysfs_getPortStatistics()

HBA_STATUS sysfs_getPortStatistics ( HBA_PORTSTATISTICS ** pS,
struct vlib_adapter * adapter )

Retrieve adapter port statistics.

Parameters
**pPortstatistics,HBA_PORTSTATISTICSto be filled
*adapterto work with
Returns
  • HBA_STATUS_ERROR if any other internal error occurs
    • HBA_STATUS_OK on success.

This function reads attributes from sysfs to fill in the required information.

References vlib_adapter_ident::host, and vlib_adapter::ident.

Referenced by HBA_GetPortStatistics().

◆ sysfs_getUnitsFromPort()

int sysfs_getUnitsFromPort ( struct vlib_port * port)

Get unit configuration information for a port.

Parameters
*portfor which unit configuration is received
Returns
  • -1 on error
  • 0 on success.
Locks:
vlib_data.mutex must be held

This function creates and reads private configuration events for all configured units of an port. It enlarges the array where unit data is stored and processes the generated configuration events.

References addUnitToRepos(), vlib_unit::channel, vlib_unit::fcLun, getAdapterByHostNo(), vlib_adapter_ident::host, vlib_port::host, vlib_unit::host, vlib_adapter::ident, vlib_unit::lun, vlib_port::name, vlib_unit::sg_dev, vlib_adapter_ident::sysfsPath, and vlib_unit::target.

Referenced by revalidateUnits(), and updateAdapter().