diff options
-rw-r--r-- | fs/sysfs/dir.c | 17 | ||||
-rw-r--r-- | fs/sysfs/inode.c | 2 | ||||
-rw-r--r-- | fs/sysfs/sysfs.h | 3 |
3 files changed, 12 insertions, 10 deletions
diff --git a/fs/sysfs/dir.c b/fs/sysfs/dir.c index 48a3ed4f4537..4ad9422566a8 100644 --- a/fs/sysfs/dir.c +++ b/fs/sysfs/dir.c | |||
@@ -26,7 +26,7 @@ static DEFINE_IDA(sysfs_ino_ida); | |||
26 | * @sd: sysfs_dirent of interest | 26 | * @sd: sysfs_dirent of interest |
27 | * | 27 | * |
28 | * Link @sd into its sibling list which starts from | 28 | * Link @sd into its sibling list which starts from |
29 | * sd->s_parent->s_children. | 29 | * sd->s_parent->s_dir.children. |
30 | * | 30 | * |
31 | * Locking: | 31 | * Locking: |
32 | * mutex_lock(sysfs_mutex) | 32 | * mutex_lock(sysfs_mutex) |
@@ -40,9 +40,9 @@ static void sysfs_link_sibling(struct sysfs_dirent *sd) | |||
40 | 40 | ||
41 | /* Store directory entries in order by ino. This allows | 41 | /* Store directory entries in order by ino. This allows |
42 | * readdir to properly restart without having to add a | 42 | * readdir to properly restart without having to add a |
43 | * cursor into the s_children list. | 43 | * cursor into the s_dir.children list. |
44 | */ | 44 | */ |
45 | for (pos = &parent_sd->s_children; *pos; pos = &(*pos)->s_sibling) { | 45 | for (pos = &parent_sd->s_dir.children; *pos; pos = &(*pos)->s_sibling) { |
46 | if (sd->s_ino < (*pos)->s_ino) | 46 | if (sd->s_ino < (*pos)->s_ino) |
47 | break; | 47 | break; |
48 | } | 48 | } |
@@ -55,7 +55,7 @@ static void sysfs_link_sibling(struct sysfs_dirent *sd) | |||
55 | * @sd: sysfs_dirent of interest | 55 | * @sd: sysfs_dirent of interest |
56 | * | 56 | * |
57 | * Unlink @sd from its sibling list which starts from | 57 | * Unlink @sd from its sibling list which starts from |
58 | * sd->s_parent->s_children. | 58 | * sd->s_parent->s_dir.children. |
59 | * | 59 | * |
60 | * Locking: | 60 | * Locking: |
61 | * mutex_lock(sysfs_mutex) | 61 | * mutex_lock(sysfs_mutex) |
@@ -64,7 +64,8 @@ static void sysfs_unlink_sibling(struct sysfs_dirent *sd) | |||
64 | { | 64 | { |
65 | struct sysfs_dirent **pos; | 65 | struct sysfs_dirent **pos; |
66 | 66 | ||
67 | for (pos = &sd->s_parent->s_children; *pos; pos = &(*pos)->s_sibling) { | 67 | for (pos = &sd->s_parent->s_dir.children; *pos; |
68 | pos = &(*pos)->s_sibling) { | ||
68 | if (*pos == sd) { | 69 | if (*pos == sd) { |
69 | *pos = sd->s_sibling; | 70 | *pos = sd->s_sibling; |
70 | sd->s_sibling = NULL; | 71 | sd->s_sibling = NULL; |
@@ -570,7 +571,7 @@ struct sysfs_dirent *sysfs_find_dirent(struct sysfs_dirent *parent_sd, | |||
570 | { | 571 | { |
571 | struct sysfs_dirent *sd; | 572 | struct sysfs_dirent *sd; |
572 | 573 | ||
573 | for (sd = parent_sd->s_children; sd; sd = sd->s_sibling) | 574 | for (sd = parent_sd->s_dir.children; sd; sd = sd->s_sibling) |
574 | if (!strcmp(sd->s_name, name)) | 575 | if (!strcmp(sd->s_name, name)) |
575 | return sd; | 576 | return sd; |
576 | return NULL; | 577 | return NULL; |
@@ -722,7 +723,7 @@ static void __sysfs_remove_dir(struct sysfs_dirent *dir_sd) | |||
722 | 723 | ||
723 | pr_debug("sysfs %s: removing dir\n", dir_sd->s_name); | 724 | pr_debug("sysfs %s: removing dir\n", dir_sd->s_name); |
724 | sysfs_addrm_start(&acxt, dir_sd); | 725 | sysfs_addrm_start(&acxt, dir_sd); |
725 | pos = &dir_sd->s_children; | 726 | pos = &dir_sd->s_dir.children; |
726 | while (*pos) { | 727 | while (*pos) { |
727 | struct sysfs_dirent *sd = *pos; | 728 | struct sysfs_dirent *sd = *pos; |
728 | 729 | ||
@@ -922,7 +923,7 @@ static int sysfs_readdir(struct file * filp, void * dirent, filldir_t filldir) | |||
922 | mutex_lock(&sysfs_mutex); | 923 | mutex_lock(&sysfs_mutex); |
923 | 924 | ||
924 | /* Skip the dentries we have already reported */ | 925 | /* Skip the dentries we have already reported */ |
925 | pos = parent_sd->s_children; | 926 | pos = parent_sd->s_dir.children; |
926 | while (pos && (filp->f_pos > pos->s_ino)) | 927 | while (pos && (filp->f_pos > pos->s_ino)) |
927 | pos = pos->s_sibling; | 928 | pos = pos->s_sibling; |
928 | 929 | ||
diff --git a/fs/sysfs/inode.c b/fs/sysfs/inode.c index c40fb9fdd04c..2210cf0005fe 100644 --- a/fs/sysfs/inode.c +++ b/fs/sysfs/inode.c | |||
@@ -127,7 +127,7 @@ static int sysfs_count_nlink(struct sysfs_dirent *sd) | |||
127 | struct sysfs_dirent *child; | 127 | struct sysfs_dirent *child; |
128 | int nr = 0; | 128 | int nr = 0; |
129 | 129 | ||
130 | for (child = sd->s_children; child; child = child->s_sibling) | 130 | for (child = sd->s_dir.children; child; child = child->s_sibling) |
131 | if (sysfs_type(child) == SYSFS_DIR) | 131 | if (sysfs_type(child) == SYSFS_DIR) |
132 | nr++; | 132 | nr++; |
133 | 133 | ||
diff --git a/fs/sysfs/sysfs.h b/fs/sysfs/sysfs.h index 60405a6e4c22..42b0327d1624 100644 --- a/fs/sysfs/sysfs.h +++ b/fs/sysfs/sysfs.h | |||
@@ -1,6 +1,8 @@ | |||
1 | /* type-specific structures for sysfs_dirent->s_* union members */ | 1 | /* type-specific structures for sysfs_dirent->s_* union members */ |
2 | struct sysfs_elem_dir { | 2 | struct sysfs_elem_dir { |
3 | struct kobject *kobj; | 3 | struct kobject *kobj; |
4 | /* children list starts here and goes through sd->s_sibling */ | ||
5 | struct sysfs_dirent *children; | ||
4 | }; | 6 | }; |
5 | 7 | ||
6 | struct sysfs_elem_symlink { | 8 | struct sysfs_elem_symlink { |
@@ -28,7 +30,6 @@ struct sysfs_dirent { | |||
28 | atomic_t s_active; | 30 | atomic_t s_active; |
29 | struct sysfs_dirent *s_parent; | 31 | struct sysfs_dirent *s_parent; |
30 | struct sysfs_dirent *s_sibling; | 32 | struct sysfs_dirent *s_sibling; |
31 | struct sysfs_dirent *s_children; | ||
32 | const char *s_name; | 33 | const char *s_name; |
33 | 34 | ||
34 | union { | 35 | union { |