diff options
author | Zhang Rui <rui.zhang@intel.com> | 2007-06-09 01:57:22 -0400 |
---|---|---|
committer | Greg Kroah-Hartman <gregkh@suse.de> | 2007-07-11 19:09:09 -0400 |
commit | 91a6902958f052358899f58683d44e36228d85c2 (patch) | |
tree | a713792cf3bb09bdbd2ac6906aa44b3da3e49250 /drivers/scsi/qla2xxx/qla_attr.c | |
parent | 51225039f3cf9d250596d1344494b293274b9169 (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/qla2xxx/qla_attr.c')
-rw-r--r-- | drivers/scsi/qla2xxx/qla_attr.c | 50 |
1 files changed, 30 insertions, 20 deletions
diff --git a/drivers/scsi/qla2xxx/qla_attr.c b/drivers/scsi/qla2xxx/qla_attr.c index 96587253bfa9..942db9de785e 100644 --- a/drivers/scsi/qla2xxx/qla_attr.c +++ b/drivers/scsi/qla2xxx/qla_attr.c | |||
@@ -11,8 +11,9 @@ | |||
11 | /* SYSFS attributes --------------------------------------------------------- */ | 11 | /* SYSFS attributes --------------------------------------------------------- */ |
12 | 12 | ||
13 | static ssize_t | 13 | static ssize_t |
14 | qla2x00_sysfs_read_fw_dump(struct kobject *kobj, char *buf, loff_t off, | 14 | qla2x00_sysfs_read_fw_dump(struct kobject *kobj, |
15 | size_t count) | 15 | struct bin_attribute *bin_attr, |
16 | char *buf, loff_t off, size_t count) | ||
16 | { | 17 | { |
17 | struct scsi_qla_host *ha = to_qla_host(dev_to_shost(container_of(kobj, | 18 | struct scsi_qla_host *ha = to_qla_host(dev_to_shost(container_of(kobj, |
18 | struct device, kobj))); | 19 | struct device, kobj))); |
@@ -31,8 +32,9 @@ qla2x00_sysfs_read_fw_dump(struct kobject *kobj, char *buf, loff_t off, | |||
31 | } | 32 | } |
32 | 33 | ||
33 | static ssize_t | 34 | static ssize_t |
34 | qla2x00_sysfs_write_fw_dump(struct kobject *kobj, char *buf, loff_t off, | 35 | qla2x00_sysfs_write_fw_dump(struct kobject *kobj, |
35 | size_t count) | 36 | struct bin_attribute *bin_attr, |
37 | char *buf, loff_t off, size_t count) | ||
36 | { | 38 | { |
37 | struct scsi_qla_host *ha = to_qla_host(dev_to_shost(container_of(kobj, | 39 | struct scsi_qla_host *ha = to_qla_host(dev_to_shost(container_of(kobj, |
38 | struct device, kobj))); | 40 | struct device, kobj))); |
@@ -80,8 +82,9 @@ static struct bin_attribute sysfs_fw_dump_attr = { | |||
80 | }; | 82 | }; |
81 | 83 | ||
82 | static ssize_t | 84 | static ssize_t |
83 | qla2x00_sysfs_read_nvram(struct kobject *kobj, char *buf, loff_t off, | 85 | qla2x00_sysfs_read_nvram(struct kobject *kobj, |
84 | size_t count) | 86 | struct bin_attribute *bin_attr, |
87 | char *buf, loff_t off, size_t count) | ||
85 | { | 88 | { |
86 | struct scsi_qla_host *ha = to_qla_host(dev_to_shost(container_of(kobj, | 89 | struct scsi_qla_host *ha = to_qla_host(dev_to_shost(container_of(kobj, |
87 | struct device, kobj))); | 90 | struct device, kobj))); |
@@ -100,8 +103,9 @@ qla2x00_sysfs_read_nvram(struct kobject *kobj, char *buf, loff_t off, | |||
100 | } | 103 | } |
101 | 104 | ||
102 | static ssize_t | 105 | static ssize_t |
103 | qla2x00_sysfs_write_nvram(struct kobject *kobj, char *buf, loff_t off, | 106 | qla2x00_sysfs_write_nvram(struct kobject *kobj, |
104 | size_t count) | 107 | struct bin_attribute *bin_attr, |
108 | char *buf, loff_t off, size_t count) | ||
105 | { | 109 | { |
106 | struct scsi_qla_host *ha = to_qla_host(dev_to_shost(container_of(kobj, | 110 | struct scsi_qla_host *ha = to_qla_host(dev_to_shost(container_of(kobj, |
107 | struct device, kobj))); | 111 | struct device, kobj))); |
@@ -155,8 +159,9 @@ static struct bin_attribute sysfs_nvram_attr = { | |||
155 | }; | 159 | }; |
156 | 160 | ||
157 | static ssize_t | 161 | static ssize_t |
158 | qla2x00_sysfs_read_optrom(struct kobject *kobj, char *buf, loff_t off, | 162 | qla2x00_sysfs_read_optrom(struct kobject *kobj, |
159 | size_t count) | 163 | struct bin_attribute *bin_attr, |
164 | char *buf, loff_t off, size_t count) | ||
160 | { | 165 | { |
161 | struct scsi_qla_host *ha = to_qla_host(dev_to_shost(container_of(kobj, | 166 | struct scsi_qla_host *ha = to_qla_host(dev_to_shost(container_of(kobj, |
162 | struct device, kobj))); | 167 | struct device, kobj))); |
@@ -174,8 +179,9 @@ qla2x00_sysfs_read_optrom(struct kobject *kobj, char *buf, loff_t off, | |||
174 | } | 179 | } |
175 | 180 | ||
176 | static ssize_t | 181 | static ssize_t |
177 | qla2x00_sysfs_write_optrom(struct kobject *kobj, char *buf, loff_t off, | 182 | qla2x00_sysfs_write_optrom(struct kobject *kobj, |
178 | size_t count) | 183 | struct bin_attribute *bin_attr, |
184 | char *buf, loff_t off, size_t count) | ||
179 | { | 185 | { |
180 | struct scsi_qla_host *ha = to_qla_host(dev_to_shost(container_of(kobj, | 186 | struct scsi_qla_host *ha = to_qla_host(dev_to_shost(container_of(kobj, |
181 | struct device, kobj))); | 187 | struct device, kobj))); |
@@ -203,8 +209,9 @@ static struct bin_attribute sysfs_optrom_attr = { | |||
203 | }; | 209 | }; |
204 | 210 | ||
205 | static ssize_t | 211 | static ssize_t |
206 | qla2x00_sysfs_write_optrom_ctl(struct kobject *kobj, char *buf, loff_t off, | 212 | qla2x00_sysfs_write_optrom_ctl(struct kobject *kobj, |
207 | size_t count) | 213 | struct bin_attribute *bin_attr, |
214 | char *buf, loff_t off, size_t count) | ||
208 | { | 215 | { |
209 | struct scsi_qla_host *ha = to_qla_host(dev_to_shost(container_of(kobj, | 216 | struct scsi_qla_host *ha = to_qla_host(dev_to_shost(container_of(kobj, |
210 | struct device, kobj))); | 217 | struct device, kobj))); |
@@ -282,8 +289,9 @@ static struct bin_attribute sysfs_optrom_ctl_attr = { | |||
282 | }; | 289 | }; |
283 | 290 | ||
284 | static ssize_t | 291 | static ssize_t |
285 | qla2x00_sysfs_read_vpd(struct kobject *kobj, char *buf, loff_t off, | 292 | qla2x00_sysfs_read_vpd(struct kobject *kobj, |
286 | size_t count) | 293 | struct bin_attribute *bin_attr, |
294 | char *buf, loff_t off, size_t count) | ||
287 | { | 295 | { |
288 | struct scsi_qla_host *ha = to_qla_host(dev_to_shost(container_of(kobj, | 296 | struct scsi_qla_host *ha = to_qla_host(dev_to_shost(container_of(kobj, |
289 | struct device, kobj))); | 297 | struct device, kobj))); |
@@ -301,8 +309,9 @@ qla2x00_sysfs_read_vpd(struct kobject *kobj, char *buf, loff_t off, | |||
301 | } | 309 | } |
302 | 310 | ||
303 | static ssize_t | 311 | static ssize_t |
304 | qla2x00_sysfs_write_vpd(struct kobject *kobj, char *buf, loff_t off, | 312 | qla2x00_sysfs_write_vpd(struct kobject *kobj, |
305 | size_t count) | 313 | struct bin_attribute *bin_attr, |
314 | char *buf, loff_t off, size_t count) | ||
306 | { | 315 | { |
307 | struct scsi_qla_host *ha = to_qla_host(dev_to_shost(container_of(kobj, | 316 | struct scsi_qla_host *ha = to_qla_host(dev_to_shost(container_of(kobj, |
308 | struct device, kobj))); | 317 | struct device, kobj))); |
@@ -330,8 +339,9 @@ static struct bin_attribute sysfs_vpd_attr = { | |||
330 | }; | 339 | }; |
331 | 340 | ||
332 | static ssize_t | 341 | static ssize_t |
333 | qla2x00_sysfs_read_sfp(struct kobject *kobj, char *buf, loff_t off, | 342 | qla2x00_sysfs_read_sfp(struct kobject *kobj, |
334 | size_t count) | 343 | struct bin_attribute *bin_attr, |
344 | char *buf, loff_t off, size_t count) | ||
335 | { | 345 | { |
336 | struct scsi_qla_host *ha = to_qla_host(dev_to_shost(container_of(kobj, | 346 | struct scsi_qla_host *ha = to_qla_host(dev_to_shost(container_of(kobj, |
337 | struct device, kobj))); | 347 | struct device, kobj))); |