diff options
author | Linus Torvalds <torvalds@linux-foundation.org> | 2008-01-25 20:19:08 -0500 |
---|---|---|
committer | Linus Torvalds <torvalds@linux-foundation.org> | 2008-01-25 20:19:08 -0500 |
commit | 9b73e76f3cf63379dcf45fcd4f112f5812418d0a (patch) | |
tree | 4e6bef87cd0cd6d848fc39a5ae25b981dbbe035b /fs | |
parent | 50d9a126240f9961cfdd063336bbeb91f77a7dce (diff) | |
parent | 23c3e290fb9ce38cabc2822b47583fc8702411bf (diff) |
Merge git://git.kernel.org/pub/scm/linux/kernel/git/jejb/scsi-misc-2.6
* git://git.kernel.org/pub/scm/linux/kernel/git/jejb/scsi-misc-2.6: (200 commits)
[SCSI] usbstorage: use last_sector_bug flag universally
[SCSI] libsas: abstract STP task status into a function
[SCSI] ultrastor: clean up inline asm warnings
[SCSI] aic7xxx: fix firmware build
[SCSI] aacraid: fib context lock for management ioctls
[SCSI] ch: remove forward declarations
[SCSI] ch: fix device minor number management bug
[SCSI] ch: handle class_device_create failure properly
[SCSI] NCR5380: fix section mismatch
[SCSI] sg: fix /proc/scsi/sg/devices when no SCSI devices
[SCSI] IB/iSER: add logical unit reset support
[SCSI] don't use __GFP_DMA for sense buffers if not required
[SCSI] use dynamically allocated sense buffer
[SCSI] scsi.h: add macro for enclosure bit of inquiry data
[SCSI] sd: add fix for devices with last sector access problems
[SCSI] fix pcmcia compile problem
[SCSI] aacraid: add Voodoo Lite class of cards.
[SCSI] aacraid: add new driver features flags
[SCSI] qla2xxx: Update version number to 8.02.00-k7.
[SCSI] qla2xxx: Issue correct MBC_INITIALIZE_FIRMWARE command.
...
Diffstat (limited to 'fs')
-rw-r--r-- | fs/sysfs/file.c | 11 | ||||
-rw-r--r-- | fs/sysfs/group.c | 26 |
2 files changed, 25 insertions, 12 deletions
diff --git a/fs/sysfs/file.c b/fs/sysfs/file.c index 8acf82bba44c..a271c87c4472 100644 --- a/fs/sysfs/file.c +++ b/fs/sysfs/file.c | |||
@@ -523,7 +523,11 @@ int sysfs_add_file_to_group(struct kobject *kobj, | |||
523 | struct sysfs_dirent *dir_sd; | 523 | struct sysfs_dirent *dir_sd; |
524 | int error; | 524 | int error; |
525 | 525 | ||
526 | dir_sd = sysfs_get_dirent(kobj->sd, group); | 526 | if (group) |
527 | dir_sd = sysfs_get_dirent(kobj->sd, group); | ||
528 | else | ||
529 | dir_sd = sysfs_get(kobj->sd); | ||
530 | |||
527 | if (!dir_sd) | 531 | if (!dir_sd) |
528 | return -ENOENT; | 532 | return -ENOENT; |
529 | 533 | ||
@@ -611,7 +615,10 @@ void sysfs_remove_file_from_group(struct kobject *kobj, | |||
611 | { | 615 | { |
612 | struct sysfs_dirent *dir_sd; | 616 | struct sysfs_dirent *dir_sd; |
613 | 617 | ||
614 | dir_sd = sysfs_get_dirent(kobj->sd, group); | 618 | if (group) |
619 | dir_sd = sysfs_get_dirent(kobj->sd, group); | ||
620 | else | ||
621 | dir_sd = sysfs_get(kobj->sd); | ||
615 | if (dir_sd) { | 622 | if (dir_sd) { |
616 | sysfs_hash_and_remove(dir_sd, attr->name); | 623 | sysfs_hash_and_remove(dir_sd, attr->name); |
617 | sysfs_put(dir_sd); | 624 | sysfs_put(dir_sd); |
diff --git a/fs/sysfs/group.c b/fs/sysfs/group.c index d1972374655a..0871c3dadce1 100644 --- a/fs/sysfs/group.c +++ b/fs/sysfs/group.c | |||
@@ -16,25 +16,31 @@ | |||
16 | #include "sysfs.h" | 16 | #include "sysfs.h" |
17 | 17 | ||
18 | 18 | ||
19 | static void remove_files(struct sysfs_dirent *dir_sd, | 19 | static void remove_files(struct sysfs_dirent *dir_sd, struct kobject *kobj, |
20 | const struct attribute_group *grp) | 20 | const struct attribute_group *grp) |
21 | { | 21 | { |
22 | struct attribute *const* attr; | 22 | struct attribute *const* attr; |
23 | int i; | ||
23 | 24 | ||
24 | for (attr = grp->attrs; *attr; attr++) | 25 | for (i = 0, attr = grp->attrs; *attr; i++, attr++) |
25 | sysfs_hash_and_remove(dir_sd, (*attr)->name); | 26 | if (!grp->is_visible || |
27 | grp->is_visible(kobj, *attr, i)) | ||
28 | sysfs_hash_and_remove(dir_sd, (*attr)->name); | ||
26 | } | 29 | } |
27 | 30 | ||
28 | static int create_files(struct sysfs_dirent *dir_sd, | 31 | static int create_files(struct sysfs_dirent *dir_sd, struct kobject *kobj, |
29 | const struct attribute_group *grp) | 32 | const struct attribute_group *grp) |
30 | { | 33 | { |
31 | struct attribute *const* attr; | 34 | struct attribute *const* attr; |
32 | int error = 0; | 35 | int error = 0, i; |
33 | 36 | ||
34 | for (attr = grp->attrs; *attr && !error; attr++) | 37 | for (i = 0, attr = grp->attrs; *attr && !error; i++, attr++) |
35 | error = sysfs_add_file(dir_sd, *attr, SYSFS_KOBJ_ATTR); | 38 | if (!grp->is_visible || |
39 | grp->is_visible(kobj, *attr, i)) | ||
40 | error |= | ||
41 | sysfs_add_file(dir_sd, *attr, SYSFS_KOBJ_ATTR); | ||
36 | if (error) | 42 | if (error) |
37 | remove_files(dir_sd, grp); | 43 | remove_files(dir_sd, kobj, grp); |
38 | return error; | 44 | return error; |
39 | } | 45 | } |
40 | 46 | ||
@@ -54,7 +60,7 @@ int sysfs_create_group(struct kobject * kobj, | |||
54 | } else | 60 | } else |
55 | sd = kobj->sd; | 61 | sd = kobj->sd; |
56 | sysfs_get(sd); | 62 | sysfs_get(sd); |
57 | error = create_files(sd, grp); | 63 | error = create_files(sd, kobj, grp); |
58 | if (error) { | 64 | if (error) { |
59 | if (grp->name) | 65 | if (grp->name) |
60 | sysfs_remove_subdir(sd); | 66 | sysfs_remove_subdir(sd); |
@@ -75,7 +81,7 @@ void sysfs_remove_group(struct kobject * kobj, | |||
75 | } else | 81 | } else |
76 | sd = sysfs_get(dir_sd); | 82 | sd = sysfs_get(dir_sd); |
77 | 83 | ||
78 | remove_files(sd, grp); | 84 | remove_files(sd, kobj, grp); |
79 | if (grp->name) | 85 | if (grp->name) |
80 | sysfs_remove_subdir(sd); | 86 | sysfs_remove_subdir(sd); |
81 | 87 | ||