From: Stephen Rothwell <sfr@canb.auug.org.au> To: Greg KH <greg@kroah.com> Cc: linux-next@vger.kernel.org, linux-kernel@vger.kernel.org, "Eric W. Biederman" <ebiederm@xmission.com>, David Miller <davem@davemloft.net>, <netdev@vger.kernel.org>, Mikulas Patocka <mpatocka@redhat.com> Subject: linux-next: manual merge of the driver-core tree with the net-next tree Date: Tue, 25 Oct 2011 19:07:21 +1100 [thread overview] Message-ID: <20111025190721.0fe8674b55e7a0b25902113a@canb.auug.org.au> (raw) [-- Attachment #1: Type: text/plain, Size: 3516 bytes --] Hi Greg, Today's linux-next merge of the driver-core tree got a conflict in fs/sysfs/dir.c between commit 23396180a977 ("sysfs: Remove support for tagged directories with untagged members") from the net-next tree and commits 4f72c0cab405 ("sysfs: use rb-tree for name lookups") and a406f75840e1 ("sysfs: use rb-tree for inode number lookup") from the driver-core tree. I fixed it up (I think - see below) and can carry the fix as necessary. -- Cheers, Stephen Rothwell sfr@canb.auug.org.au diff --cc fs/sysfs/dir.c index 26f370a,83bb9d1..0000000 --- a/fs/sysfs/dir.c +++ b/fs/sysfs/dir.c @@@ -547,22 -558,36 +565,43 @@@ struct sysfs_dirent *sysfs_find_dirent( const void *ns, const unsigned char *name) { - struct sysfs_dirent *sd; + struct rb_node *p = parent_sd->s_dir.name_tree.rb_node; + struct sysfs_dirent *found = NULL; + if (!!sysfs_ns_type(parent_sd) != !!ns) { + WARN(1, KERN_WARNING "sysfs: ns %s in '%s' for '%s'\n", + sysfs_ns_type(parent_sd)? "required": "invalid", + parent_sd->s_name, name); + return NULL; + } + - for (sd = parent_sd->s_dir.children; sd; sd = sd->s_sibling) { - if (sd->s_ns != ns) - continue; - if (!strcmp(sd->s_name, name)) - return sd; + while (p) { + int c; + #define node rb_entry(p, struct sysfs_dirent, name_node) + c = strcmp(name, node->s_name); + if (c < 0) { + p = node->name_node.rb_left; + } else if (c > 0) { + p = node->name_node.rb_right; + } else { + found = node; + p = node->name_node.rb_left; + } + #undef node } - return NULL; + + if (found && ns) { + while (found->s_ns && found->s_ns != ns) { + p = rb_next(&found->name_node); + if (!p) + return NULL; + found = rb_entry(p, struct sysfs_dirent, name_node); + if (strcmp(name, found->s_name)) + return NULL; + } + } + + return found; } /** @@@ -895,12 -918,28 +932,28 @@@ static struct sysfs_dirent *sysfs_dir_p pos = NULL; } if (!pos && (ino > 1) && (ino < INT_MAX)) { - pos = parent_sd->s_dir.children; - while (pos && (ino > pos->s_ino)) - pos = pos->s_sibling; + struct rb_node *p = parent_sd->s_dir.inode_tree.rb_node; + while (p) { + #define node rb_entry(p, struct sysfs_dirent, inode_node) + if (ino < node->s_ino) { + pos = node; + p = node->inode_node.rb_left; + } else if (ino > node->s_ino) { + p = node->inode_node.rb_right; + } else { + pos = node; + break; + } + #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; + else + pos = rb_entry(p, struct sysfs_dirent, inode_node); } - while (pos && pos->s_ns != ns) - pos = pos->s_sibling; return pos; } @@@ -908,10 -947,13 +961,13 @@@ static struct sysfs_dirent *sysfs_dir_n struct sysfs_dirent *parent_sd, ino_t ino, struct sysfs_dirent *pos) { pos = sysfs_dir_pos(ns, parent_sd, ino, pos); - if (pos) - pos = pos->s_sibling; - while (pos && pos->s_ns != ns) - pos = pos->s_sibling; + if (pos) do { + struct rb_node *p = rb_next(&pos->inode_node); + if (!p) + 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; } [-- Attachment #2: Type: application/pgp-signature, Size: 836 bytes --]
WARNING: multiple messages have this Message-ID (diff)
From: Stephen Rothwell <sfr@canb.auug.org.au> To: Greg KH <greg@kroah.com> Cc: linux-next@vger.kernel.org, linux-kernel@vger.kernel.org, "Eric W. Biederman" <ebiederm@xmission.com>, David Miller <davem@davemloft.net>, netdev@vger.kernel.org, Mikulas Patocka <mpatocka@redhat.com> Subject: linux-next: manual merge of the driver-core tree with the net-next tree Date: Tue, 25 Oct 2011 19:07:21 +1100 [thread overview] Message-ID: <20111025190721.0fe8674b55e7a0b25902113a@canb.auug.org.au> (raw) [-- Attachment #1: Type: text/plain, Size: 3516 bytes --] Hi Greg, Today's linux-next merge of the driver-core tree got a conflict in fs/sysfs/dir.c between commit 23396180a977 ("sysfs: Remove support for tagged directories with untagged members") from the net-next tree and commits 4f72c0cab405 ("sysfs: use rb-tree for name lookups") and a406f75840e1 ("sysfs: use rb-tree for inode number lookup") from the driver-core tree. I fixed it up (I think - see below) and can carry the fix as necessary. -- Cheers, Stephen Rothwell sfr@canb.auug.org.au diff --cc fs/sysfs/dir.c index 26f370a,83bb9d1..0000000 --- a/fs/sysfs/dir.c +++ b/fs/sysfs/dir.c @@@ -547,22 -558,36 +565,43 @@@ struct sysfs_dirent *sysfs_find_dirent( const void *ns, const unsigned char *name) { - struct sysfs_dirent *sd; + struct rb_node *p = parent_sd->s_dir.name_tree.rb_node; + struct sysfs_dirent *found = NULL; + if (!!sysfs_ns_type(parent_sd) != !!ns) { + WARN(1, KERN_WARNING "sysfs: ns %s in '%s' for '%s'\n", + sysfs_ns_type(parent_sd)? "required": "invalid", + parent_sd->s_name, name); + return NULL; + } + - for (sd = parent_sd->s_dir.children; sd; sd = sd->s_sibling) { - if (sd->s_ns != ns) - continue; - if (!strcmp(sd->s_name, name)) - return sd; + while (p) { + int c; + #define node rb_entry(p, struct sysfs_dirent, name_node) + c = strcmp(name, node->s_name); + if (c < 0) { + p = node->name_node.rb_left; + } else if (c > 0) { + p = node->name_node.rb_right; + } else { + found = node; + p = node->name_node.rb_left; + } + #undef node } - return NULL; + + if (found && ns) { + while (found->s_ns && found->s_ns != ns) { + p = rb_next(&found->name_node); + if (!p) + return NULL; + found = rb_entry(p, struct sysfs_dirent, name_node); + if (strcmp(name, found->s_name)) + return NULL; + } + } + + return found; } /** @@@ -895,12 -918,28 +932,28 @@@ static struct sysfs_dirent *sysfs_dir_p pos = NULL; } if (!pos && (ino > 1) && (ino < INT_MAX)) { - pos = parent_sd->s_dir.children; - while (pos && (ino > pos->s_ino)) - pos = pos->s_sibling; + struct rb_node *p = parent_sd->s_dir.inode_tree.rb_node; + while (p) { + #define node rb_entry(p, struct sysfs_dirent, inode_node) + if (ino < node->s_ino) { + pos = node; + p = node->inode_node.rb_left; + } else if (ino > node->s_ino) { + p = node->inode_node.rb_right; + } else { + pos = node; + break; + } + #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; + else + pos = rb_entry(p, struct sysfs_dirent, inode_node); } - while (pos && pos->s_ns != ns) - pos = pos->s_sibling; return pos; } @@@ -908,10 -947,13 +961,13 @@@ static struct sysfs_dirent *sysfs_dir_n struct sysfs_dirent *parent_sd, ino_t ino, struct sysfs_dirent *pos) { pos = sysfs_dir_pos(ns, parent_sd, ino, pos); - if (pos) - pos = pos->s_sibling; - while (pos && pos->s_ns != ns) - pos = pos->s_sibling; + if (pos) do { + struct rb_node *p = rb_next(&pos->inode_node); + if (!p) + 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; } [-- Attachment #2: Type: application/pgp-signature, Size: 836 bytes --]
next reply other threads:[~2011-10-25 8:07 UTC|newest] Thread overview: 32+ messages / expand[flat|nested] mbox.gz Atom feed top 2011-10-25 8:07 Stephen Rothwell [this message] 2011-10-25 8:07 ` linux-next: manual merge of the driver-core tree with the net-next tree Stephen Rothwell 2013-02-04 4:34 Stephen Rothwell 2013-02-04 4:34 ` Stephen Rothwell 2013-02-04 4:38 Stephen Rothwell 2013-02-04 4:38 ` Stephen Rothwell 2013-02-04 4:59 ` Greg KH 2013-08-01 5:21 Stephen Rothwell 2013-08-01 5:21 ` Stephen Rothwell 2013-08-02 0:28 ` Greg KH 2014-12-01 7:19 Stephen Rothwell 2014-12-01 7:19 ` Stephen Rothwell 2014-12-01 7:34 ` Arend van Spriel 2014-12-01 7:34 ` Arend van Spriel 2014-12-03 8:36 ` Jeremiah Mahler 2014-12-03 10:51 ` Jeremiah Mahler 2014-12-03 12:49 ` Arend van Spriel 2014-12-03 12:49 ` Arend van Spriel 2014-12-03 16:21 ` Greg KH 2014-12-03 20:07 ` Arend van Spriel 2014-12-03 20:07 ` Arend van Spriel 2014-12-03 21:06 ` Jeremiah Mahler 2014-12-03 21:41 ` Jeremiah Mahler 2014-12-04 10:19 ` Jeremiah Mahler 2014-12-04 11:41 ` Arend van Spriel 2018-07-23 5:12 Stephen Rothwell 2018-07-23 6:20 ` Greg KH 2018-08-15 23:42 ` Stephen Rothwell 2018-08-16 0:05 ` Rajat Jain 2023-01-30 4:32 Stephen Rothwell 2023-01-30 12:31 ` Andy Shevchenko 2023-01-30 16:00 ` Greg KH
Reply instructions: You may reply publicly to this message via plain-text email using any one of the following methods: * Save the following mbox file, import it into your mail client, and reply-to-all from there: mbox Avoid top-posting and favor interleaved quoting: https://en.wikipedia.org/wiki/Posting_style#Interleaved_style * Reply using the --to, --cc, and --in-reply-to switches of git-send-email(1): git send-email \ --in-reply-to=20111025190721.0fe8674b55e7a0b25902113a@canb.auug.org.au \ --to=sfr@canb.auug.org.au \ --cc=davem@davemloft.net \ --cc=ebiederm@xmission.com \ --cc=greg@kroah.com \ --cc=linux-kernel@vger.kernel.org \ --cc=linux-next@vger.kernel.org \ --cc=mpatocka@redhat.com \ --cc=netdev@vger.kernel.org \ /path/to/YOUR_REPLY https://kernel.org/pub/software/scm/git/docs/git-send-email.html * If your mail client supports setting the In-Reply-To header via mailto: links, try the mailto: linkBe sure your reply has a Subject: header at the top and a blank line before the message body.
This is an external index of several public inboxes, see mirroring instructions on how to clone and mirror all data and code used by this external index.