Linux Kernel  3.7.1
 All Data Structures Namespaces Files Functions Variables Typedefs Enumerations Enumerator Macros Groups Pages
Macros | Functions | Variables
zfcp_sysfs.c File Reference
#include <linux/slab.h>
#include "zfcp_ext.h"

Go to the source code of this file.

Macros

#define KMSG_COMPONENT   "zfcp"
 
#define pr_fmt(fmt)   KMSG_COMPONENT ": " fmt
 
#define ZFCP_DEV_ATTR(_feat, _name, _mode, _show, _store)
 
#define ZFCP_DEFINE_ATTR(_feat_def, _feat, _name, _format, _value)
 
#define ZFCP_DEFINE_A_ATTR(_name, _format, _value)
 
#define ZFCP_DEFINE_LATENCY_ATTR(_name)
 
#define ZFCP_DEFINE_SCSI_ATTR(_name, _format, _value)
 
#define ZFCP_SHOST_ATTR(_name, _format, _arg...)
 

Functions

 ZFCP_DEFINE_A_ATTR (status,"0x%08x\n", atomic_read(&adapter->status))
 
 ZFCP_DEFINE_A_ATTR (peer_wwnn,"0x%016llx\n",(unsigned long long) adapter->peer_wwnn)
 
 ZFCP_DEFINE_A_ATTR (peer_wwpn,"0x%016llx\n",(unsigned long long) adapter->peer_wwpn)
 
 ZFCP_DEFINE_A_ATTR (peer_d_id,"0x%06x\n", adapter->peer_d_id)
 
 ZFCP_DEFINE_A_ATTR (card_version,"0x%04x\n", adapter->hydra_version)
 
 ZFCP_DEFINE_A_ATTR (lic_version,"0x%08x\n", adapter->fsf_lic_version)
 
 ZFCP_DEFINE_A_ATTR (hardware_version,"0x%08x\n", adapter->hardware_version)
 
 ZFCP_DEFINE_A_ATTR (in_recovery,"%d\n",(atomic_read(&adapter->status)&ZFCP_STATUS_COMMON_ERP_INUSE)!=0)
 
 ZFCP_DEFINE_ATTR (zfcp_port, port, status,"0x%08x\n", atomic_read(&port->status))
 
 ZFCP_DEFINE_ATTR (zfcp_port, port, in_recovery,"%d\n",(atomic_read(&port->status)&ZFCP_STATUS_COMMON_ERP_INUSE)!=0)
 
 ZFCP_DEFINE_ATTR (zfcp_port, port, access_denied,"%d\n",(atomic_read(&port->status)&ZFCP_STATUS_COMMON_ACCESS_DENIED)!=0)
 
 ZFCP_DEFINE_ATTR (zfcp_unit, unit, status,"0x%08x\n", zfcp_unit_sdev_status(unit))
 
 ZFCP_DEFINE_ATTR (zfcp_unit, unit, in_recovery,"%d\n",(zfcp_unit_sdev_status(unit)&ZFCP_STATUS_COMMON_ERP_INUSE)!=0)
 
 ZFCP_DEFINE_ATTR (zfcp_unit, unit, access_denied,"%d\n",(zfcp_unit_sdev_status(unit)&ZFCP_STATUS_COMMON_ACCESS_DENIED)!=0)
 
 ZFCP_DEFINE_ATTR (zfcp_unit, unit, access_shared,"%d\n",(zfcp_unit_sdev_status(unit)&ZFCP_STATUS_LUN_SHARED)!=0)
 
 ZFCP_DEFINE_ATTR (zfcp_unit, unit, access_readonly,"%d\n",(zfcp_unit_sdev_status(unit)&ZFCP_STATUS_LUN_READONLY)!=0)
 
 DEFINE_MUTEX (zfcp_sysfs_port_units_mutex)
 
 ZFCP_DEFINE_LATENCY_ATTR (read)
 
 ZFCP_DEFINE_LATENCY_ATTR (write)
 
 ZFCP_DEFINE_LATENCY_ATTR (cmd)
 
 ZFCP_DEFINE_SCSI_ATTR (hba_id,"%s\n", dev_name(&port->adapter->ccw_device->dev))
 
 ZFCP_DEFINE_SCSI_ATTR (wwpn,"0x%016llx\n",(unsigned long long) port->wwpn)
 
 ZFCP_SHOST_ATTR (requests,"%llu %llu %llu\n",(unsigned long long) stat_info.input_req,(unsigned long long) stat_info.output_req,(unsigned long long) stat_info.control_req)
 
 ZFCP_SHOST_ATTR (megabytes,"%llu %llu\n",(unsigned long long) stat_info.input_mb,(unsigned long long) stat_info.output_mb)
 
 ZFCP_SHOST_ATTR (seconds_active,"%llu\n",(unsigned long long) stat_info.seconds_act)
 

Variables

struct attribute_group zfcp_sysfs_adapter_attrs
 
struct attribute_group zfcp_sysfs_port_attrs
 
struct attribute_group zfcp_sysfs_unit_attrs
 
struct device_attributezfcp_sysfs_sdev_attrs []
 
struct device_attributezfcp_sysfs_shost_attrs []
 

Macro Definition Documentation

#define KMSG_COMPONENT   "zfcp"

Definition at line 9 of file zfcp_sysfs.c.

#define pr_fmt (   fmt)    KMSG_COMPONENT ": " fmt

Definition at line 10 of file zfcp_sysfs.c.

#define ZFCP_DEFINE_A_ATTR (   _name,
  _format,
  _value 
)
Value:
static ssize_t zfcp_sysfs_adapter_##_name##_show(struct device *dev, \
struct device_attribute *at,\
char *buf) \
{ \
int i; \
if (!adapter) \
return -ENODEV; \
\
i = sprintf(buf, _format, _value); \
zfcp_ccw_adapter_put(adapter); \
return i; \
} \
static ZFCP_DEV_ATTR(adapter, _name, S_IRUGO, \
zfcp_sysfs_adapter_##_name##_show, NULL);

Definition at line 30 of file zfcp_sysfs.c.

#define ZFCP_DEFINE_ATTR (   _feat_def,
  _feat,
  _name,
  _format,
  _value 
)
Value:
static ssize_t zfcp_sysfs_##_feat##_##_name##_show(struct device *dev, \
struct device_attribute *at,\
char *buf) \
{ \
struct _feat_def *_feat = container_of(dev, struct _feat_def, dev); \
\
return sprintf(buf, _format, _value); \
} \
static ZFCP_DEV_ATTR(_feat, _name, S_IRUGO, \
zfcp_sysfs_##_feat##_##_name##_show, NULL);

Definition at line 18 of file zfcp_sysfs.c.

#define ZFCP_DEFINE_LATENCY_ATTR (   _name)

Definition at line 365 of file zfcp_sysfs.c.

#define ZFCP_DEFINE_SCSI_ATTR (   _name,
  _format,
  _value 
)
Value:
static ssize_t zfcp_sysfs_scsi_##_name##_show(struct device *dev, \
char *buf) \
{ \
struct zfcp_scsi_dev *zfcp_sdev = sdev_to_zfcp(sdev); \
struct zfcp_port *port = zfcp_sdev->port; \
\
return sprintf(buf, _format, _value); \
} \
static DEVICE_ATTR(_name, S_IRUGO, zfcp_sysfs_scsi_##_name##_show, NULL);

Definition at line 426 of file zfcp_sysfs.c.

#define ZFCP_DEV_ATTR (   _feat,
  _name,
  _mode,
  _show,
  _store 
)
Value:
struct device_attribute dev_attr_##_feat##_##_name = __ATTR(_name, _mode,\
_show, _store)

Definition at line 15 of file zfcp_sysfs.c.

#define ZFCP_SHOST_ATTR (   _name,
  _format,
  _arg... 
)
Value:
static ssize_t zfcp_sysfs_adapter_##_name##_show(struct device *dev, \
char *buf) \
{ \
int retval; \
\
retval = zfcp_sysfs_adapter_ex_config(dev, &stat_info); \
if (retval) \
return retval; \
\
return sprintf(buf, _format, ## _arg); \
} \
static DEVICE_ATTR(_name, S_IRUGO, zfcp_sysfs_adapter_##_name##_show, NULL);

Definition at line 515 of file zfcp_sysfs.c.

Function Documentation

DEFINE_MUTEX ( zfcp_sysfs_port_units_mutex  )
ZFCP_DEFINE_A_ATTR ( status  ,
"0x%08x\n"  ,
atomic_read &->  status 
)
ZFCP_DEFINE_A_ATTR ( peer_wwnn  ,
"0x%016llx\n"  ,
(unsigned long long) adapter->  peer_wwnn 
)
ZFCP_DEFINE_A_ATTR ( peer_wwpn  ,
"0x%016llx\n"  ,
(unsigned long long) adapter->  peer_wwpn 
)
ZFCP_DEFINE_A_ATTR ( peer_d_id  ,
"0x%06x\n"  ,
adapter->  peer_d_id 
)
ZFCP_DEFINE_A_ATTR ( card_version  ,
"0x%04x\n"  ,
adapter->  hydra_version 
)
ZFCP_DEFINE_A_ATTR ( lic_version  ,
"0x%08x\n"  ,
adapter->  fsf_lic_version 
)
ZFCP_DEFINE_A_ATTR ( hardware_version  ,
"0x%08x\n"  ,
adapter->  hardware_version 
)
ZFCP_DEFINE_A_ATTR ( in_recovery  ,
"%d\n"  ,
(atomic_read(&adapter->status)&ZFCP_STATUS_COMMON_ERP_INUSE)!  = 0 
)
ZFCP_DEFINE_ATTR ( zfcp_port  ,
port  ,
status  ,
"0x%08x\n"  ,
atomic_read &->  status 
)
ZFCP_DEFINE_ATTR ( zfcp_port  ,
port  ,
in_recovery  ,
"%d\n"  ,
(atomic_read(&port->status)&ZFCP_STATUS_COMMON_ERP_INUSE)!  = 0 
)
ZFCP_DEFINE_ATTR ( zfcp_port  ,
port  ,
access_denied  ,
"%d\n"  ,
(atomic_read(&port->status)&ZFCP_STATUS_COMMON_ACCESS_DENIED)!  = 0 
)
ZFCP_DEFINE_ATTR ( zfcp_unit  ,
unit  ,
status  ,
"0x%08x\n"  ,
zfcp_unit_sdev_status(unit  
)
ZFCP_DEFINE_ATTR ( zfcp_unit  ,
unit  ,
in_recovery  ,
"%d\n"  ,
(zfcp_unit_sdev_status(unit)&ZFCP_STATUS_COMMON_ERP_INUSE)!  = 0 
)
ZFCP_DEFINE_ATTR ( zfcp_unit  ,
unit  ,
access_denied  ,
"%d\n"  ,
(zfcp_unit_sdev_status(unit)&ZFCP_STATUS_COMMON_ACCESS_DENIED)!  = 0 
)
ZFCP_DEFINE_ATTR ( zfcp_unit  ,
unit  ,
access_shared  ,
"%d\n"  ,
(zfcp_unit_sdev_status(unit)&ZFCP_STATUS_LUN_SHARED)!  = 0 
)
ZFCP_DEFINE_ATTR ( zfcp_unit  ,
unit  ,
access_readonly  ,
"%d\n"  ,
(zfcp_unit_sdev_status(unit)&ZFCP_STATUS_LUN_READONLY)!  = 0 
)
ZFCP_DEFINE_LATENCY_ATTR ( read  )
ZFCP_DEFINE_LATENCY_ATTR ( write  )
ZFCP_DEFINE_LATENCY_ATTR ( cmd  )
ZFCP_DEFINE_SCSI_ATTR ( hba_id  ,
"%s\n"  ,
dev_name &->->->  dev 
)
ZFCP_DEFINE_SCSI_ATTR ( wwpn  ,
"0x%016llx\n"  ,
(unsigned long long) port->  wwpn 
)
ZFCP_SHOST_ATTR ( requests  ,
"%llu %llu %llu\n ,
(unsigned long long) stat_info.  input_req,
(unsigned long long) stat_info.  output_req,
(unsigned long long) stat_info.  control_req 
)
ZFCP_SHOST_ATTR ( megabytes  ,
"%llu %llu\n ,
(unsigned long long) stat_info.  input_mb,
(unsigned long long) stat_info.  output_mb 
)
ZFCP_SHOST_ATTR ( seconds_active  ,
"%llu\n"  ,
(unsigned long long) stat_info.  seconds_act 
)

Variable Documentation

struct attribute_group zfcp_sysfs_adapter_attrs
Initial value:
= {
.attrs = zfcp_adapter_attrs,
}

Definition at line 294 of file zfcp_sysfs.c.

struct attribute_group zfcp_sysfs_port_attrs
Initial value:
= {
.attrs = zfcp_port_attrs,
}

zfcp_sysfs_port_attrs - sysfs attributes for all other ports

Definition at line 347 of file zfcp_sysfs.c.

struct device_attribute* zfcp_sysfs_sdev_attrs[]
Initial value:
= {
&dev_attr_fcp_lun,
&dev_attr_wwpn,
&dev_attr_hba_id,
&dev_attr_read_latency,
&dev_attr_write_latency,
&dev_attr_cmd_latency,
}

Definition at line 454 of file zfcp_sysfs.c.

struct device_attribute* zfcp_sysfs_shost_attrs[]
Initial value:
= {
&dev_attr_utilization,
&dev_attr_requests,
&dev_attr_megabytes,
&dev_attr_seconds_active,
&dev_attr_queue_full,
}

Definition at line 561 of file zfcp_sysfs.c.

struct attribute_group zfcp_sysfs_unit_attrs
Initial value:
= {
.attrs = zfcp_unit_attrs,
}

Definition at line 361 of file zfcp_sysfs.c.