summaryrefslogtreecommitdiff
path: root/drivers/s390/scsi/zfcp_sysfs_adapter.c
diff options
context:
space:
mode:
authorSwen Schillig <swen@vnet.ibm.com>2008-06-10 20:21:00 +0400
committerJames Bottomley <James.Bottomley@HansenPartnership.com>2008-07-12 17:22:26 +0400
commitcc8c282963bd258a5bf49d3aa52675a4ae6d31f6 (patch)
treed0f353c918158b203c71603d9afdf4b71c126f63 /drivers/s390/scsi/zfcp_sysfs_adapter.c
parent85a82392fe6fe7620d8fe0eb694f926cefe62e1f (diff)
downloadlinux-cc8c282963bd258a5bf49d3aa52675a4ae6d31f6.tar.xz
[SCSI] zfcp: Automatically attach remote ports
Automatically attach the remote ports in zfcp when the adapter is set online. This is done by querying all available ports from the FC namesever. The scan for remote ports is also triggered by RSCNs and can be triggered manually with the sysfs attribute 'port_rescan'. Signed-off-by: Swen Schillig <swen@vnet.ibm.com> Signed-off-by: Christof Schmitt <christof.schmitt@de.ibm.com> Signed-off-by: James Bottomley <James.Bottomley@HansenPartnership.com>
Diffstat (limited to 'drivers/s390/scsi/zfcp_sysfs_adapter.c')
-rw-r--r--drivers/s390/scsi/zfcp_sysfs_adapter.c25
1 files changed, 25 insertions, 0 deletions
diff --git a/drivers/s390/scsi/zfcp_sysfs_adapter.c b/drivers/s390/scsi/zfcp_sysfs_adapter.c
index 1f2a8c21b731..a4cae60f69d4 100644
--- a/drivers/s390/scsi/zfcp_sysfs_adapter.c
+++ b/drivers/s390/scsi/zfcp_sysfs_adapter.c
@@ -85,6 +85,30 @@ zfcp_sysfs_port_add_store(struct device *dev, struct device_attribute *attr, con
static DEVICE_ATTR(port_add, S_IWUSR, NULL, zfcp_sysfs_port_add_store);
/**
+ * zfcp_sysfs_port_rescan - trigger manual port rescan
+ * @dev: pointer to belonging device
+ * @attr: pointer to struct device_attribute
+ * @buf: pointer to input buffer
+ * @count: number of bytes in buffer
+ */
+static ssize_t zfcp_sysfs_port_rescan_store(struct device *dev,
+ struct device_attribute *attr,
+ const char *buf, size_t count)
+{
+ struct zfcp_adapter *adapter;
+ int ret;
+
+ adapter = dev_get_drvdata(dev);
+ if (atomic_test_mask(ZFCP_STATUS_COMMON_REMOVE, &adapter->status))
+ return -EBUSY;
+
+ ret = zfcp_scan_ports(adapter);
+
+ return ret ? ret : (ssize_t) count;
+}
+static DEVICE_ATTR(port_rescan, S_IWUSR, NULL, zfcp_sysfs_port_rescan_store);
+
+/**
* zfcp_sysfs_port_remove_store - remove a port from sysfs tree
* @dev: pointer to belonging device
* @buf: pointer to input buffer
@@ -214,6 +238,7 @@ static struct attribute *zfcp_adapter_attrs[] = {
&dev_attr_in_recovery.attr,
&dev_attr_port_remove.attr,
&dev_attr_port_add.attr,
+ &dev_attr_port_rescan.attr,
&dev_attr_peer_wwnn.attr,
&dev_attr_peer_wwpn.attr,
&dev_attr_peer_d_id.attr,