vlib_sysfs.c File Reference

All calls that use the sysfs. More...

`#include "vlib.h"`

## Functions

static HBA_STATUS | addPortByName (struct vlib_adapter *adapter, char *name)
| add a port to the adapters repos
static HBA_STATUS | addAdapterByDevPath (char *dev_path)
| add an adapter to the adapters repos
static HBA_STATUS | getPortAttributes (HBA_PORTATTRIBUTES **pPortattributes, char *classpath)
| Retrieve adapter attributes.
HBA_STATUS | sysfs_createAndReadConfigPorts (struct vlib_adapter *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.
int | sysfs_getUnitsFromPort (struct vlib_port *port)
| Get unit configuration information for a port.
HBA_STATUS | sysfs_getDiscoveredPortAttributes (HBA_PORTATTRIBUTES **pAttrs, struct vlib_port *port)
| Retrieve adapter attributes.
HBA_STATUS | sysfs_getAdapterPortAttributes (HBA_PORTATTRIBUTES **pAttrs, struct vlib_adapter *adapter)
| Retrieve adapter attributes.
HBA_STATUS | sysfs_getAdapterAttributes (HBA_ADAPTERATTRIBUTES **pAttrs, struct vlib_adapter *adapter)
| Retrieve adapter attributes.
HBA_STATUS | sysfs_getPortStatistics (HBA_PORTSTATISTICS **pS, struct vlib_adapter *adapter)
| Retrieve adapter port statistics.

## Detailed Description

All calls that use the sysfs.

## Function Documentation

## addAdapterByDevPath()

static HBA_STATUS addAdapterByDevPath | ( | char * | dev_path | ) |

static

add an adapter to the adapters repos

Parameters

  *dev_path | the sysfs device as seen under /sys/devices/css0/x.x.xxx/x.x.xxxx

Returns
  - HBA_STATUS_ERROR if any other internal error occurs
    - HBA_STATUS_OK on success.

Locks:
  vlib_data.mutex must be held

References addAdapterToRepos(), vlib_adapter_ident::bus_dev_name, vlib_adapter_ident::class_dev_name, vlib_adapter_ident::devid, vlib_adapter_ident::did, vlib_adapter_ident::host, vlib_adapter::ident, vlib_adapter_ident::sysfsPath, vlib_adapter_ident::wwnn, and vlib_adapter_ident::wwpn.

Referenced by sysfs_createAndReadConfigAdapter().

## addPortByName()

static HBA_STATUS addPortByName | ( | struct vlib_adapter * | adapter,
|  | char * | name
| ) |  |

static

add a port to the adapters repos

Parameters

  *adapter | the adapter to which the add the port to
  *name | the unique name of the remote port as in fc_remote_ports

Returns
  - HBA_STATUS_ERROR if any other internal error occurs
    - HBA_STATUS_OK on success.

Locks:
  vlib_data.mutex must be held

References addPortToRepos(), vlib_port::channel, vlib_port::did, vlib_port::host, vlib_port::name, vlib_port::target, vlib_port::wwnn, and vlib_port::wwpn.

Referenced by sysfs_createAndReadConfigPorts(), and sysfs_getAdapterPortAttributes().

## getPortAttributes()

static HBA_STATUS getPortAttributes | ( | HBA_PORTATTRIBUTES ** | pPortattributes,
|  | char * | classpath
| ) |  |

static

Retrieve adapter attributes.

Parameters

  **pPortattributes,HBA_ADAPTERATTRIBUTES | to be filled
  *adapter | to 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_wwn_to_HBA_WWN(), vlibCharToIntCOS(), vlibCharToIntPortSpeed(), vlibCharToIntPortState(), and vlibCharToIntPortType().

Referenced by sysfs_getAdapterPortAttributes(), and sysfs_getDiscoveredPortAttributes().

## 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

  *adapter | pointer 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_ADAPTERATTRIBUTES | to be filled
  *adapter | to 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_ADAPTERATTRIBUTES | to be filled
  *adapter | to 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_ADAPTERATTRIBUTES | to be filled
  *adapter | to 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_PORTSTATISTICS | to be filled
  *adapter | to 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

  *port | for 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_unit::host, vlib_port::host, vlib_adapter_ident::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().