diff options
Diffstat (limited to 'drivers/scsi/scsi_transport_fc.c')
-rw-r--r-- | drivers/scsi/scsi_transport_fc.c | 34 |
1 files changed, 30 insertions, 4 deletions
diff --git a/drivers/scsi/scsi_transport_fc.c b/drivers/scsi/scsi_transport_fc.c index b03aa85108e..79d31ca2b74 100644 --- a/drivers/scsi/scsi_transport_fc.c +++ b/drivers/scsi/scsi_transport_fc.c | |||
@@ -301,8 +301,6 @@ static int fc_host_setup(struct transport_container *tc, struct device *dev, | |||
301 | fc_host->supported_classes = FC_COS_UNSPECIFIED; | 301 | fc_host->supported_classes = FC_COS_UNSPECIFIED; |
302 | memset(fc_host->supported_fc4s, 0, | 302 | memset(fc_host->supported_fc4s, 0, |
303 | sizeof(fc_host->supported_fc4s)); | 303 | sizeof(fc_host->supported_fc4s)); |
304 | memset(fc_host->symbolic_name, 0, | ||
305 | sizeof(fc_host->symbolic_name)); | ||
306 | fc_host->supported_speeds = FC_PORTSPEED_UNKNOWN; | 304 | fc_host->supported_speeds = FC_PORTSPEED_UNKNOWN; |
307 | fc_host->maxframe_size = -1; | 305 | fc_host->maxframe_size = -1; |
308 | memset(fc_host->serial_number, 0, | 306 | memset(fc_host->serial_number, 0, |
@@ -315,6 +313,8 @@ static int fc_host_setup(struct transport_container *tc, struct device *dev, | |||
315 | sizeof(fc_host->active_fc4s)); | 313 | sizeof(fc_host->active_fc4s)); |
316 | fc_host->speed = FC_PORTSPEED_UNKNOWN; | 314 | fc_host->speed = FC_PORTSPEED_UNKNOWN; |
317 | fc_host->fabric_name = -1; | 315 | fc_host->fabric_name = -1; |
316 | memset(fc_host->symbolic_name, 0, sizeof(fc_host->symbolic_name)); | ||
317 | memset(fc_host->system_hostname, 0, sizeof(fc_host->system_hostname)); | ||
318 | 318 | ||
319 | fc_host->tgtid_bind_type = FC_TGTID_BIND_BY_WWPN; | 319 | fc_host->tgtid_bind_type = FC_TGTID_BIND_BY_WWPN; |
320 | 320 | ||
@@ -688,6 +688,25 @@ store_fc_host_##field(struct class_device *cdev, const char *buf, \ | |||
688 | return count; \ | 688 | return count; \ |
689 | } | 689 | } |
690 | 690 | ||
691 | #define fc_host_store_str_function(field, slen) \ | ||
692 | static ssize_t \ | ||
693 | store_fc_host_##field(struct class_device *cdev, const char *buf, \ | ||
694 | size_t count) \ | ||
695 | { \ | ||
696 | struct Scsi_Host *shost = transport_class_to_shost(cdev); \ | ||
697 | struct fc_internal *i = to_fc_internal(shost->transportt); \ | ||
698 | unsigned int cnt=count; \ | ||
699 | \ | ||
700 | /* count may include a LF at end of string */ \ | ||
701 | if (buf[cnt-1] == '\n') \ | ||
702 | cnt--; \ | ||
703 | if (cnt > ((slen) - 1)) \ | ||
704 | return -EINVAL; \ | ||
705 | memcpy(fc_host_##field(shost), buf, cnt); \ | ||
706 | i->f->set_host_##field(shost); \ | ||
707 | return count; \ | ||
708 | } | ||
709 | |||
691 | #define fc_host_rd_attr(field, format_string, sz) \ | 710 | #define fc_host_rd_attr(field, format_string, sz) \ |
692 | fc_host_show_function(field, format_string, sz, ) \ | 711 | fc_host_show_function(field, format_string, sz, ) \ |
693 | static FC_CLASS_DEVICE_ATTR(host, field, S_IRUGO, \ | 712 | static FC_CLASS_DEVICE_ATTR(host, field, S_IRUGO, \ |
@@ -815,7 +834,6 @@ fc_private_host_rd_attr_cast(node_name, "0x%llx\n", 20, unsigned long long); | |||
815 | fc_private_host_rd_attr_cast(port_name, "0x%llx\n", 20, unsigned long long); | 834 | fc_private_host_rd_attr_cast(port_name, "0x%llx\n", 20, unsigned long long); |
816 | fc_private_host_rd_attr_cast(permanent_port_name, "0x%llx\n", 20, | 835 | fc_private_host_rd_attr_cast(permanent_port_name, "0x%llx\n", 20, |
817 | unsigned long long); | 836 | unsigned long long); |
818 | fc_private_host_rd_attr(symbolic_name, "%s\n", (FC_SYMBOLIC_NAME_SIZE +1)); | ||
819 | fc_private_host_rd_attr(maxframe_size, "%u bytes\n", 20); | 837 | fc_private_host_rd_attr(maxframe_size, "%u bytes\n", 20); |
820 | fc_private_host_rd_attr(serial_number, "%s\n", (FC_SERIAL_NUMBER_SIZE +1)); | 838 | fc_private_host_rd_attr(serial_number, "%s\n", (FC_SERIAL_NUMBER_SIZE +1)); |
821 | 839 | ||
@@ -858,6 +876,13 @@ fc_host_rd_attr(port_id, "0x%06x\n", 20); | |||
858 | fc_host_rd_enum_attr(port_type, FC_PORTTYPE_MAX_NAMELEN); | 876 | fc_host_rd_enum_attr(port_type, FC_PORTTYPE_MAX_NAMELEN); |
859 | fc_host_rd_enum_attr(port_state, FC_PORTSTATE_MAX_NAMELEN); | 877 | fc_host_rd_enum_attr(port_state, FC_PORTSTATE_MAX_NAMELEN); |
860 | fc_host_rd_attr_cast(fabric_name, "0x%llx\n", 20, unsigned long long); | 878 | fc_host_rd_attr_cast(fabric_name, "0x%llx\n", 20, unsigned long long); |
879 | fc_host_rd_attr(symbolic_name, "%s\n", FC_SYMBOLIC_NAME_SIZE + 1); | ||
880 | |||
881 | fc_private_host_show_function(system_hostname, "%s\n", | ||
882 | FC_SYMBOLIC_NAME_SIZE + 1, ) | ||
883 | fc_host_store_str_function(system_hostname, FC_SYMBOLIC_NAME_SIZE) | ||
884 | static FC_CLASS_DEVICE_ATTR(host, system_hostname, S_IRUGO | S_IWUSR, | ||
885 | show_fc_host_system_hostname, store_fc_host_system_hostname); | ||
861 | 886 | ||
862 | 887 | ||
863 | /* Private Host Attributes */ | 888 | /* Private Host Attributes */ |
@@ -1223,7 +1248,6 @@ fc_attach_transport(struct fc_function_template *ft) | |||
1223 | SETUP_HOST_ATTRIBUTE_RD(permanent_port_name); | 1248 | SETUP_HOST_ATTRIBUTE_RD(permanent_port_name); |
1224 | SETUP_HOST_ATTRIBUTE_RD(supported_classes); | 1249 | SETUP_HOST_ATTRIBUTE_RD(supported_classes); |
1225 | SETUP_HOST_ATTRIBUTE_RD(supported_fc4s); | 1250 | SETUP_HOST_ATTRIBUTE_RD(supported_fc4s); |
1226 | SETUP_HOST_ATTRIBUTE_RD(symbolic_name); | ||
1227 | SETUP_HOST_ATTRIBUTE_RD(supported_speeds); | 1251 | SETUP_HOST_ATTRIBUTE_RD(supported_speeds); |
1228 | SETUP_HOST_ATTRIBUTE_RD(maxframe_size); | 1252 | SETUP_HOST_ATTRIBUTE_RD(maxframe_size); |
1229 | SETUP_HOST_ATTRIBUTE_RD(serial_number); | 1253 | SETUP_HOST_ATTRIBUTE_RD(serial_number); |
@@ -1234,6 +1258,8 @@ fc_attach_transport(struct fc_function_template *ft) | |||
1234 | SETUP_HOST_ATTRIBUTE_RD(active_fc4s); | 1258 | SETUP_HOST_ATTRIBUTE_RD(active_fc4s); |
1235 | SETUP_HOST_ATTRIBUTE_RD(speed); | 1259 | SETUP_HOST_ATTRIBUTE_RD(speed); |
1236 | SETUP_HOST_ATTRIBUTE_RD(fabric_name); | 1260 | SETUP_HOST_ATTRIBUTE_RD(fabric_name); |
1261 | SETUP_HOST_ATTRIBUTE_RD(symbolic_name); | ||
1262 | SETUP_HOST_ATTRIBUTE_RW(system_hostname); | ||
1237 | 1263 | ||
1238 | /* Transport-managed attributes */ | 1264 | /* Transport-managed attributes */ |
1239 | SETUP_PRIVATE_HOST_ATTRIBUTE_RW(tgtid_bind_type); | 1265 | SETUP_PRIVATE_HOST_ATTRIBUTE_RW(tgtid_bind_type); |