[openib-general] SRP [PATCH 3/4] restore target

Ishai Rabinovitz ishai at mellanox.co.il
Mon Jun 5 08:35:17 PDT 2006


Add support to restore_target from sysfs.
Signed-off-by: Ishai Rabinovitz <ishai at mellanox.co.il>

Index: last_stable/drivers/infiniband/ulp/srp/ib_srp.c
===================================================================
--- last_stable.orig/drivers/infiniband/ulp/srp/ib_srp.c	2006-06-04 10:01:50.000000000 +0300
+++ last_stable/drivers/infiniband/ulp/srp/ib_srp.c	2006-06-04 10:02:27.000000000 +0300
@@ -1551,16 +1551,21 @@ static ssize_t show_zero_req_lim(struct 
 static ssize_t srp_remove_target(struct class_device *cdev,
 				 const char *buf, size_t count);
 
-static CLASS_DEVICE_ATTR(remove_target, S_IWUSR, NULL, srp_remove_target);
-static CLASS_DEVICE_ATTR(id_ext,	S_IRUGO, show_id_ext,		NULL);
-static CLASS_DEVICE_ATTR(ioc_guid,	S_IRUGO, show_ioc_guid,		NULL);
-static CLASS_DEVICE_ATTR(service_id,	S_IRUGO, show_service_id,	NULL);
-static CLASS_DEVICE_ATTR(pkey,		S_IRUGO, show_pkey,		NULL);
-static CLASS_DEVICE_ATTR(dgid,		S_IRUGO, show_dgid,		NULL);
-static CLASS_DEVICE_ATTR(zero_req_lim,	S_IRUGO, show_zero_req_lim,	NULL);
+static ssize_t srp_restore_target(struct class_device *cdev,
+				  const char *buf, size_t count);
+
+static CLASS_DEVICE_ATTR(remove_target,  S_IWUSR, NULL, srp_remove_target);
+static CLASS_DEVICE_ATTR(restore_target, S_IWUSR, NULL, srp_restore_target);
+static CLASS_DEVICE_ATTR(id_ext,	 S_IRUGO, show_id_ext,		NULL);
+static CLASS_DEVICE_ATTR(ioc_guid,	 S_IRUGO, show_ioc_guid,	NULL);
+static CLASS_DEVICE_ATTR(service_id,	 S_IRUGO, show_service_id,	NULL);
+static CLASS_DEVICE_ATTR(pkey,		 S_IRUGO, show_pkey,		NULL);
+static CLASS_DEVICE_ATTR(dgid,		 S_IRUGO, show_dgid,		NULL);
+static CLASS_DEVICE_ATTR(zero_req_lim,	 S_IRUGO, show_zero_req_lim,	NULL);
 
 static struct class_device_attribute *srp_host_attrs[] = {
 	&class_device_attr_remove_target,
+	&class_device_attr_restore_target,
 	&class_device_attr_id_ext,
 	&class_device_attr_ioc_guid,
 	&class_device_attr_service_id,
@@ -1861,6 +1866,17 @@ static ssize_t srp_remove_target(struct 
 	return count;
 }
 
+static ssize_t srp_restore_target(struct class_device *cdev,
+				 const char *buf, size_t count)
+{
+	int ret = _srp_restore_target(host_to_target(class_to_shost(cdev)));
+
+	if (ret)
+		return ret;
+
+	return count;
+}
+
 static ssize_t show_ibdev(struct class_device *class_dev, char *buf)
 {
 	struct srp_host *host =
-- 
Ishai Rabinovitz



More information about the general mailing list