lists.openwall.net   lists  /  announce  owl-users  owl-dev  john-users  john-dev  passwdqc-users  yescrypt  popa3d-users  /  oss-security  kernel-hardening  musl  sabotage  tlsify  passwords  /  crypt-dev  xvendor  /  Bugtraq  Full-Disclosure  linux-kernel  linux-netdev  linux-ext4  linux-hardening  linux-cve-announce  PHC 
Open Source and information security mailing list archives
 
Hash Suite: Windows password security audit tool. GUI, reports in PDF.
[<prev] [next>] [thread-next>] [day] [month] [year] [list]
Date:	Sun, 12 Jul 2009 02:00:09 +0400
From:	Cyrill Gorcunov <gorcunov@...il.com>
To:	Ingo Molnar <mingo@...e.hu>,
	Frederic Weisbecker <fweisbec@...il.com>
Cc:	LKML <linux-kernel@...r.kernel.org>,
	Peter Zijlstra <peterz@...radead.org>
Subject: [rfc -tip] lib,rb-tree - introduce rb_for_each helper

perftools already use a number of opencoded
for() iterators over rbtree. The patch introduce
rb_for_each helper for this purpose.

Signed-off-by: Cyrill Gorcunov <gorcunov@...nvz.org>
---

The real conversion for this macro usage should be
done later.

Also I think having rb_for_each_entry for being used
with container_of inbetween could be convinient as
well.

Anyway if we don't need such a helper -- just drop
the patch.

 include/linux/rbtree.h |    3 +++
 1 file changed, 3 insertions(+)

Index: linux-2.6.git/include/linux/rbtree.h
=====================================================================
--- linux-2.6.git.orig/include/linux/rbtree.h
+++ linux-2.6.git/include/linux/rbtree.h
@@ -145,6 +145,9 @@ extern struct rb_node *rb_prev(const str
 extern struct rb_node *rb_first(const struct rb_root *);
 extern struct rb_node *rb_last(const struct rb_root *);
 
+#define rb_for_each(nd, root) \
+	for (nd = rb_first((root)); nd; nd = rb_next(nd))
+
 /* Fast replacement of a single node without remove/rebalance/add/rebalance */
 extern void rb_replace_node(struct rb_node *victim, struct rb_node *new, 
 			    struct rb_root *root);
--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@...r.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ