aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/scsi/arcmsr
diff options
context:
space:
mode:
authorZhang Rui <rui.zhang@intel.com>2007-06-09 01:57:22 -0400
committerGreg Kroah-Hartman <gregkh@suse.de>2007-07-11 19:09:09 -0400
commit91a6902958f052358899f58683d44e36228d85c2 (patch)
treea713792cf3bb09bdbd2ac6906aa44b3da3e49250 /drivers/scsi/arcmsr
parent51225039f3cf9d250596d1344494b293274b9169 (diff)
sysfs: add parameter "struct bin_attribute *" in .read/.write methods for sysfs binary attributes
Well, first of all, I don't want to change so many files either. What I do: Adding a new parameter "struct bin_attribute *" in the .read/.write methods for the sysfs binary attributes. In fact, only the four lines change in fs/sysfs/bin.c and include/linux/sysfs.h do the real work. But I have to update all the files that use binary attributes to make them compatible with the new .read and .write methods. I'm not sure if I missed any. :( Why I do this: For a sysfs attribute, we can get a pointer pointing to the struct attribute in the .show/.store method, while we can't do this for the binary attributes. I don't know why this is different, but this does make it not so handy to use the binary attributes as the regular ones. So I think this patch is reasonable. :) Who benefits from it: The patch that exposes ACPI tables in sysfs requires such an improvement. All the table binary attributes share the same .read method. Parameter "struct bin_attribute *" is used to get the table signature and instance number which are used to distinguish different ACPI table binary attributes. Without this parameter, we need to offer different .read methods for different ACPI table binary attributes. This is impossible as there are various ACPI tables on different platforms, and we don't know what they are until they are loaded. Signed-off-by: Zhang Rui <rui.zhang@intel.com> Signed-off-by: Greg Kroah-Hartman <gregkh@suse.de>
Diffstat (limited to 'drivers/scsi/arcmsr')
-rw-r--r--drivers/scsi/arcmsr/arcmsr_attr.c15
1 files changed, 9 insertions, 6 deletions
diff --git a/drivers/scsi/arcmsr/arcmsr_attr.c b/drivers/scsi/arcmsr/arcmsr_attr.c
index 8908228bc134..06c0dce3b839 100644
--- a/drivers/scsi/arcmsr/arcmsr_attr.c
+++ b/drivers/scsi/arcmsr/arcmsr_attr.c
@@ -59,8 +59,9 @@
59struct class_device_attribute *arcmsr_host_attrs[]; 59struct class_device_attribute *arcmsr_host_attrs[];
60 60
61static ssize_t 61static ssize_t
62arcmsr_sysfs_iop_message_read(struct kobject *kobj, char *buf, loff_t off, 62arcmsr_sysfs_iop_message_read(struct kobject *kobj,
63 size_t count) 63 struct bin_attribute *bin_attr,
64 char *buf, loff_t off, size_t count)
64{ 65{
65 struct class_device *cdev = container_of(kobj,struct class_device,kobj); 66 struct class_device *cdev = container_of(kobj,struct class_device,kobj);
66 struct Scsi_Host *host = class_to_shost(cdev); 67 struct Scsi_Host *host = class_to_shost(cdev);
@@ -105,8 +106,9 @@ arcmsr_sysfs_iop_message_read(struct kobject *kobj, char *buf, loff_t off,
105} 106}
106 107
107static ssize_t 108static ssize_t
108arcmsr_sysfs_iop_message_write(struct kobject *kobj, char *buf, loff_t off, 109arcmsr_sysfs_iop_message_write(struct kobject *kobj,
109 size_t count) 110 struct bin_attribute *bin_attr,
111 char *buf, loff_t off, size_t count)
110{ 112{
111 struct class_device *cdev = container_of(kobj,struct class_device,kobj); 113 struct class_device *cdev = container_of(kobj,struct class_device,kobj);
112 struct Scsi_Host *host = class_to_shost(cdev); 114 struct Scsi_Host *host = class_to_shost(cdev);
@@ -152,8 +154,9 @@ arcmsr_sysfs_iop_message_write(struct kobject *kobj, char *buf, loff_t off,
152} 154}
153 155
154static ssize_t 156static ssize_t
155arcmsr_sysfs_iop_message_clear(struct kobject *kobj, char *buf, loff_t off, 157arcmsr_sysfs_iop_message_clear(struct kobject *kobj,
156 size_t count) 158 struct bin_attribute *bin_attr,
159 char *buf, loff_t off, size_t count)
157{ 160{
158 struct class_device *cdev = container_of(kobj,struct class_device,kobj); 161 struct class_device *cdev = container_of(kobj,struct class_device,kobj);
159 struct Scsi_Host *host = class_to_shost(cdev); 162 struct Scsi_Host *host = class_to_shost(cdev);