diff options
author | Tejun Heo <htejun@gmail.com> | 2007-09-20 03:05:12 -0400 |
---|---|---|
committer | Greg Kroah-Hartman <gregkh@suse.de> | 2007-10-12 17:51:11 -0400 |
commit | bc747f37a0f089b9366f7385ff870e12911f2383 (patch) | |
tree | b23e81c5136486bc081770dd83595e658437ace8 /fs/sysfs/dir.c | |
parent | dc2f75f0e0cac645c22c85bcf429683b3fa0d2d9 (diff) |
sysfs: move sysfs_dirent->s_children into sysfs_dirent->s_dir
Children list head is only meaninful for directory nodes. Move it
into s_dir. This doesn't save any space currently but it will with
further changes.
Signed-off-by: Tejun Heo <htejun@gmail.com>
Acked-by: Cornelia Huck <cornelia.huck@de.ibm.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@suse.de>
Diffstat (limited to 'fs/sysfs/dir.c')
-rw-r--r-- | fs/sysfs/dir.c | 17 |
1 files changed, 9 insertions, 8 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 | ||