aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/scsi/ipr.c
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/ipr.c
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/ipr.c')
-rw-r--r--drivers/scsi/ipr.c18
1 files changed, 12 insertions, 6 deletions
diff --git a/drivers/scsi/ipr.c b/drivers/scsi/ipr.c
index fa6ff295e56..4a3083ea59d 100644
--- a/drivers/scsi/ipr.c
+++ b/drivers/scsi/ipr.c
@@ -2465,6 +2465,7 @@ restart:
2465/** 2465/**
2466 * ipr_read_trace - Dump the adapter trace 2466 * ipr_read_trace - Dump the adapter trace
2467 * @kobj: kobject struct 2467 * @kobj: kobject struct
2468 * @bin_attr: bin_attribute struct
2468 * @buf: buffer 2469 * @buf: buffer
2469 * @off: offset 2470 * @off: offset
2470 * @count: buffer size 2471 * @count: buffer size
@@ -2472,8 +2473,9 @@ restart:
2472 * Return value: 2473 * Return value:
2473 * number of bytes printed to buffer 2474 * number of bytes printed to buffer
2474 **/ 2475 **/
2475static ssize_t ipr_read_trace(struct kobject *kobj, char *buf, 2476static ssize_t ipr_read_trace(struct kobject *kobj,
2476 loff_t off, size_t count) 2477 struct bin_attribute *bin_attr,
2478 char *buf, loff_t off, size_t count)
2477{ 2479{
2478 struct class_device *cdev = container_of(kobj,struct class_device,kobj); 2480 struct class_device *cdev = container_of(kobj,struct class_device,kobj);
2479 struct Scsi_Host *shost = class_to_shost(cdev); 2481 struct Scsi_Host *shost = class_to_shost(cdev);
@@ -3166,6 +3168,7 @@ static struct class_device_attribute *ipr_ioa_attrs[] = {
3166/** 3168/**
3167 * ipr_read_dump - Dump the adapter 3169 * ipr_read_dump - Dump the adapter
3168 * @kobj: kobject struct 3170 * @kobj: kobject struct
3171 * @bin_attr: bin_attribute struct
3169 * @buf: buffer 3172 * @buf: buffer
3170 * @off: offset 3173 * @off: offset
3171 * @count: buffer size 3174 * @count: buffer size
@@ -3173,8 +3176,9 @@ static struct class_device_attribute *ipr_ioa_attrs[] = {
3173 * Return value: 3176 * Return value:
3174 * number of bytes printed to buffer 3177 * number of bytes printed to buffer
3175 **/ 3178 **/
3176static ssize_t ipr_read_dump(struct kobject *kobj, char *buf, 3179static ssize_t ipr_read_dump(struct kobject *kobj,
3177 loff_t off, size_t count) 3180 struct bin_attribute *bin_attr,
3181 char *buf, loff_t off, size_t count)
3178{ 3182{
3179 struct class_device *cdev = container_of(kobj,struct class_device,kobj); 3183 struct class_device *cdev = container_of(kobj,struct class_device,kobj);
3180 struct Scsi_Host *shost = class_to_shost(cdev); 3184 struct Scsi_Host *shost = class_to_shost(cdev);
@@ -3327,6 +3331,7 @@ static int ipr_free_dump(struct ipr_ioa_cfg *ioa_cfg)
3327/** 3331/**
3328 * ipr_write_dump - Setup dump state of adapter 3332 * ipr_write_dump - Setup dump state of adapter
3329 * @kobj: kobject struct 3333 * @kobj: kobject struct
3334 * @bin_attr: bin_attribute struct
3330 * @buf: buffer 3335 * @buf: buffer
3331 * @off: offset 3336 * @off: offset
3332 * @count: buffer size 3337 * @count: buffer size
@@ -3334,8 +3339,9 @@ static int ipr_free_dump(struct ipr_ioa_cfg *ioa_cfg)
3334 * Return value: 3339 * Return value:
3335 * number of bytes printed to buffer 3340 * number of bytes printed to buffer
3336 **/ 3341 **/
3337static ssize_t ipr_write_dump(struct kobject *kobj, char *buf, 3342static ssize_t ipr_write_dump(struct kobject *kobj,
3338 loff_t off, size_t count) 3343 struct bin_attribute *bin_attr,
3344 char *buf, loff_t off, size_t count)
3339{ 3345{
3340 struct class_device *cdev = container_of(kobj,struct class_device,kobj); 3346 struct class_device *cdev = container_of(kobj,struct class_device,kobj);
3341 struct Scsi_Host *shost = class_to_shost(cdev); 3347 struct Scsi_Host *shost = class_to_shost(cdev);