Commit 5a0cd4a7 authored by James Bottomley's avatar James Bottomley

SCSI: Add basic infrastructure for transport host statistics

From: 	James.Smart@Emulex.Com

This patch adds the basic hooks to the scsi subsystem to 
support transport-specific statistics to be added to a host. 
Its basic nature follows the way in which net devices showed 
their statistics.
Signed-off-by: default avatarJames Bottomley <James.Bottomley@SteelEye.com>
parent f562acb8
...@@ -82,8 +82,12 @@ void scsi_remove_host(struct Scsi_Host *shost) ...@@ -82,8 +82,12 @@ void scsi_remove_host(struct Scsi_Host *shost)
if (shost->transportt->host_destroy) if (shost->transportt->host_destroy)
shost->transportt->host_destroy(shost); shost->transportt->host_destroy(shost);
class_device_unregister(&shost->shost_classdev); class_device_unregister(&shost->shost_classdev);
if (shost->transport_classdev.class) if (shost->transport_classdev.class) {
class_device_unregister(&shost->transport_classdev); if (shost->transportt->host_statistics)
sysfs_remove_group(&shost->transport_classdev.kobj,
shost->transportt->host_statistics);
class_device_unregister(&shost->transport_classdev);
}
device_del(&shost->shost_gendev); device_del(&shost->shost_gendev);
} }
EXPORT_SYMBOL(scsi_remove_host); EXPORT_SYMBOL(scsi_remove_host);
......
...@@ -716,6 +716,14 @@ int scsi_sysfs_add_host(struct Scsi_Host *shost) ...@@ -716,6 +716,14 @@ int scsi_sysfs_add_host(struct Scsi_Host *shost)
if (error) if (error)
return error; return error;
} }
if (shost->transportt->host_statistics) {
error = sysfs_create_group(
&shost->transport_classdev.kobj,
shost->transportt->host_statistics);
if (error)
return error;
}
} }
return 0; return 0;
......
...@@ -33,6 +33,7 @@ struct scsi_transport_template { ...@@ -33,6 +33,7 @@ struct scsi_transport_template {
struct class *device_class; struct class *device_class;
struct class *target_class; struct class *target_class;
struct class *host_class; struct class *host_class;
struct attribute_group *host_statistics;
/* Constructor functions */ /* Constructor functions */
int (*device_setup)(struct scsi_device *); int (*device_setup)(struct scsi_device *);
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment