From b9e2780d576a010d4aba1e69f247170bf3718d6b Mon Sep 17 00:00:00 2001 From: "Eric W. Biederman" Date: Tue, 25 Oct 2011 05:38:41 -0700 Subject: sysfs: Remove support for tagged directories with untagged members (again) In commit 8a9ea3237e7e ("Merge git://.../davem/net-next") where my sysfs changes from the net tree merged with the sysfs rbtree changes from Mickulas Patocka the conflict resolution failed to preserve the simplified property that was the point of my changes. That is sysfs_find_dirent can now say something is a match if and only s_name and s_ns match what we are looking for, and sysfs_readdir can simply return all of the directory entries where s_ns matches the directory that we should be returning. Now that we are back to exact matches we can tweak sysfs_find_dirent and the name rb_tree to order sysfs_dirents by s_ns s_name and remove the second loop in sysfs_find_dirent. However that change seems a bit much for a conflict resolution so it can come later. Signed-off-by: Eric W. Biederman Signed-off-by: Linus Torvalds --- fs/sysfs/dir.c | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) (limited to 'fs/sysfs/dir.c') diff --git a/fs/sysfs/dir.c b/fs/sysfs/dir.c index 0344ee70a47..48ffbdf0d01 100644 --- a/fs/sysfs/dir.c +++ b/fs/sysfs/dir.c @@ -590,8 +590,8 @@ struct sysfs_dirent *sysfs_find_dirent(struct sysfs_dirent *parent_sd, #undef node } - if (found && ns) { - while (found->s_ns && found->s_ns != ns) { + if (found) { + while (found->s_ns != ns) { p = rb_next(&found->name_node); if (!p) return NULL; @@ -947,7 +947,7 @@ static struct sysfs_dirent *sysfs_dir_pos(const void *ns, #undef node } } - while (pos && pos->s_ns && pos->s_ns != ns) { + while (pos && pos->s_ns != ns) { struct rb_node *p = rb_next(&pos->inode_node); if (!p) pos = NULL; @@ -967,7 +967,7 @@ static struct sysfs_dirent *sysfs_dir_next_pos(const void *ns, pos = NULL; else pos = rb_entry(p, struct sysfs_dirent, inode_node); - } while (pos && pos->s_ns && pos->s_ns != ns); + } while (pos && pos->s_ns != ns); return pos; } -- cgit v1.2.3