Source-Changes-HG archive

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index][Old Index]

[src/trunk]: src Rename rb.h to rbtree.h, as it is more appropriate (c.f. ptr...



details:   https://anonhg.NetBSD.org/src/rev/c98a012882d4
branches:  trunk
changeset: 757820:c98a012882d4
user:      matt <matt%NetBSD.org@localhost>
date:      Sat Sep 25 01:42:38 2010 +0000

description:
Rename rb.h to rbtree.h, as it is more appropriate (c.f. ptree.h).  Also
helps find code that hasn't been updated to use the new rbtree API.

diffstat:

 common/lib/libc/gen/rb.c          |    6 +-
 common/lib/libprop/prop_rb_impl.h |    4 +-
 distrib/sets/lists/comp/mi        |    5 +-
 sys/fs/udf/udf.h                  |    4 +-
 sys/kern/subr_lockdebug.c         |    6 +-
 sys/net/npf/npf_impl.h            |    4 +-
 sys/nfs/nfsmount.h                |    4 +-
 sys/nfs/nfsnode.h                 |    4 +-
 sys/sys/Makefile                  |    4 +-
 sys/sys/rb.h                      |  194 --------------------------------------
 sys/sys/rbtree.h                  |  194 ++++++++++++++++++++++++++++++++++++++
 sys/uvm/uvm_map.h                 |    4 +-
 sys/uvm/uvm_object.h              |    4 +-
 sys/uvm/uvm_page.h                |    4 +-
 14 files changed, 221 insertions(+), 220 deletions(-)

diffs (truncated from 625 to 300 lines):

diff -r 5e638da08f3a -r c98a012882d4 common/lib/libc/gen/rb.c
--- a/common/lib/libc/gen/rb.c  Sat Sep 25 01:19:39 2010 +0000
+++ b/common/lib/libc/gen/rb.c  Sat Sep 25 01:42:38 2010 +0000
@@ -1,4 +1,4 @@
-/*     $NetBSD: rb.c,v 1.7 2010/09/24 22:51:51 rmind Exp $     */
+/*     $NetBSD: rb.c,v 1.8 2010/09/25 01:42:38 matt Exp $      */
 
 /*-
  * Copyright (c) 2001 The NetBSD Foundation, Inc.
@@ -70,9 +70,9 @@
 #endif
 
 #ifdef RBTEST
-#include "rb.h"
+#include "rbtree.h"
 #else
-#include <sys/rb.h>
+#include <sys/rbtree.h>
 #endif
 
 static void rb_tree_insert_rebalance(struct rb_tree *, struct rb_node *);
diff -r 5e638da08f3a -r c98a012882d4 common/lib/libprop/prop_rb_impl.h
--- a/common/lib/libprop/prop_rb_impl.h Sat Sep 25 01:19:39 2010 +0000
+++ b/common/lib/libprop/prop_rb_impl.h Sat Sep 25 01:42:38 2010 +0000
@@ -1,4 +1,4 @@
-/*     $NetBSD: prop_rb_impl.h,v 1.7 2008/06/30 20:14:09 matt Exp $    */
+/*     $NetBSD: prop_rb_impl.h,v 1.8 2010/09/25 01:42:38 matt Exp $    */
 
 /*-
  * Copyright (c) 2001 The NetBSD Foundation, Inc.
@@ -33,7 +33,7 @@
 #define        _PROP_RB_IMPL_H_
 
 #ifdef __NetBSD__
-#include <sys/rb.h>
+#include <sys/rbtree.h>
 
 /*
  * Define local names for common rb_tree functions.
diff -r 5e638da08f3a -r c98a012882d4 distrib/sets/lists/comp/mi
--- a/distrib/sets/lists/comp/mi        Sat Sep 25 01:19:39 2010 +0000
+++ b/distrib/sets/lists/comp/mi        Sat Sep 25 01:42:38 2010 +0000
@@ -1,4 +1,4 @@
-#      $NetBSD: mi,v 1.1509 2010/09/24 21:53:00 christos Exp $
+#      $NetBSD: mi,v 1.1510 2010/09/25 01:42:38 matt Exp $
 #
 # Note: don't delete entries from here - mark them as "obsolete" instead.
 #
@@ -2086,7 +2086,8 @@
 ./usr/include/sys/queue.h                      comp-c-include
 ./usr/include/sys/radioio.h                    comp-c-include
 ./usr/include/sys/ras.h                                comp-c-include
-./usr/include/sys/rb.h                         comp-c-include
+./usr/include/sys/rb.h                         comp-obsolete           obsolete
+./usr/include/sys/rbtree.h                     comp-c-include
 ./usr/include/sys/reboot.h                     comp-c-include
 ./usr/include/sys/resource.h                   comp-c-include
 ./usr/include/sys/resourcevar.h                        comp-c-include
diff -r 5e638da08f3a -r c98a012882d4 sys/fs/udf/udf.h
--- a/sys/fs/udf/udf.h  Sat Sep 25 01:19:39 2010 +0000
+++ b/sys/fs/udf/udf.h  Sat Sep 25 01:42:38 2010 +0000
@@ -1,4 +1,4 @@
-/* $NetBSD: udf.h,v 1.42 2010/09/24 22:51:50 rmind Exp $ */
+/* $NetBSD: udf.h,v 1.43 2010/09/25 01:42:40 matt Exp $ */
 
 /*
  * Copyright (c) 2006, 2008 Reinoud Zandijk
@@ -30,7 +30,7 @@
 #define _FS_UDF_UDF_H_
 
 #include <sys/queue.h>
-#include <sys/rb.h>
+#include <sys/rbtree.h>
 #include <sys/uio.h>
 #include <sys/mutex.h>
 
diff -r 5e638da08f3a -r c98a012882d4 sys/kern/subr_lockdebug.c
--- a/sys/kern/subr_lockdebug.c Sat Sep 25 01:19:39 2010 +0000
+++ b/sys/kern/subr_lockdebug.c Sat Sep 25 01:42:38 2010 +0000
@@ -1,4 +1,4 @@
-/*     $NetBSD: subr_lockdebug.c,v 1.42 2010/09/24 22:51:50 rmind Exp $        */
+/*     $NetBSD: subr_lockdebug.c,v 1.43 2010/09/25 01:42:39 matt Exp $ */
 
 /*-
  * Copyright (c) 2006, 2007, 2008 The NetBSD Foundation, Inc.
@@ -34,7 +34,7 @@
  */
 
 #include <sys/cdefs.h>
-__KERNEL_RCSID(0, "$NetBSD: subr_lockdebug.c,v 1.42 2010/09/24 22:51:50 rmind Exp $");
+__KERNEL_RCSID(0, "$NetBSD: subr_lockdebug.c,v 1.43 2010/09/25 01:42:39 matt Exp $");
 
 #include "opt_ddb.h"
 
@@ -48,7 +48,7 @@
 #include <sys/cpu.h>
 #include <sys/atomic.h>
 #include <sys/lock.h>
-#include <sys/rb.h>
+#include <sys/rbtree.h>
 
 #include <machine/lock.h>
 
diff -r 5e638da08f3a -r c98a012882d4 sys/net/npf/npf_impl.h
--- a/sys/net/npf/npf_impl.h    Sat Sep 25 01:19:39 2010 +0000
+++ b/sys/net/npf/npf_impl.h    Sat Sep 25 01:42:38 2010 +0000
@@ -1,4 +1,4 @@
-/*     $NetBSD: npf_impl.h,v 1.2 2010/09/16 04:53:27 rmind Exp $       */
+/*     $NetBSD: npf_impl.h,v 1.3 2010/09/25 01:42:39 matt Exp $        */
 
 /*-
  * Copyright (c) 2009-2010 The NetBSD Foundation, Inc.
@@ -37,7 +37,7 @@
 #ifndef _NPF_IMPL_H_
 #define _NPF_IMPL_H_
 
-#include <sys/rb.h>
+#include <sys/rbtree.h>
 #include <sys/hash.h>
 #include <sys/queue.h>
 #include <sys/types.h>
diff -r 5e638da08f3a -r c98a012882d4 sys/nfs/nfsmount.h
--- a/sys/nfs/nfsmount.h        Sat Sep 25 01:19:39 2010 +0000
+++ b/sys/nfs/nfsmount.h        Sat Sep 25 01:42:38 2010 +0000
@@ -1,4 +1,4 @@
-/*     $NetBSD: nfsmount.h,v 1.49 2009/03/14 14:46:11 dsl Exp $        */
+/*     $NetBSD: nfsmount.h,v 1.50 2010/09/25 01:42:39 matt Exp $       */
 
 /*
  * Copyright (c) 1989, 1993
@@ -42,7 +42,7 @@
 #include <sys/rwlock.h>
 #include <sys/mutex.h>
 #include <sys/disk.h>
-#include <sys/rb.h>
+#include <sys/rbtree.h>
 #endif
 
 /*
diff -r 5e638da08f3a -r c98a012882d4 sys/nfs/nfsnode.h
--- a/sys/nfs/nfsnode.h Sat Sep 25 01:19:39 2010 +0000
+++ b/sys/nfs/nfsnode.h Sat Sep 25 01:42:38 2010 +0000
@@ -1,4 +1,4 @@
-/*      $NetBSD: nfsnode.h,v 1.71 2009/03/14 14:46:11 dsl Exp $        */
+/*      $NetBSD: nfsnode.h,v 1.72 2010/09/25 01:42:39 matt Exp $       */
 
 /*
  * Copyright (c) 1989, 1993
@@ -40,7 +40,7 @@
 
 #include <sys/condvar.h>
 #include <sys/mutex.h>
-#include <sys/rb.h>
+#include <sys/rbtree.h>
 
 #ifndef _NFS_NFS_H_
 #include <nfs/nfs.h>
diff -r 5e638da08f3a -r c98a012882d4 sys/sys/Makefile
--- a/sys/sys/Makefile  Sat Sep 25 01:19:39 2010 +0000
+++ b/sys/sys/Makefile  Sat Sep 25 01:42:38 2010 +0000
@@ -1,4 +1,4 @@
-#      $NetBSD: Makefile,v 1.127 2010/06/01 13:52:08 tnozaki Exp $
+#      $NetBSD: Makefile,v 1.128 2010/09/25 01:42:40 matt Exp $
 
 .include <bsd.sys.mk>
 
@@ -27,7 +27,7 @@
        param.h pipe.h pmc.h poll.h pool.h power.h proc.h \
        protosw.h pset.h ptrace.h ptree.h \
        queue.h \
-       ras.h rb.h reboot.h radioio.h resource.h resourcevar.h rmd160.h \
+       ras.h rbtree.h reboot.h radioio.h resource.h resourcevar.h rmd160.h \
        rnd.h rwlock.h sa.h satypes.h \
        scanio.h sched.h scsiio.h sdt.h select.h selinfo.h sem.h sha1.h \
        sha2.h shm.h siginfo.h signal.h signalvar.h sigtypes.h simplelock.h \
diff -r 5e638da08f3a -r c98a012882d4 sys/sys/rb.h
--- a/sys/sys/rb.h      Sat Sep 25 01:19:39 2010 +0000
+++ /dev/null   Thu Jan 01 00:00:00 1970 +0000
@@ -1,194 +0,0 @@
-/*     $NetBSD: rb.h,v 1.14 2010/09/24 22:51:51 rmind Exp $    */
-
-/*-
- * Copyright (c) 2001 The NetBSD Foundation, Inc.
- * All rights reserved.
- *
- * This code is derived from software contributed to The NetBSD Foundation
- * by Matt Thomas <matt%3am-software.com@localhost>.
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions
- * are met:
- * 1. Redistributions of source code must retain the above copyright
- *    notice, this list of conditions and the following disclaimer.
- * 2. Redistributions in binary form must reproduce the above copyright
- *    notice, this list of conditions and the following disclaimer in the
- *    documentation and/or other materials provided with the distribution.
- *
- * THIS SOFTWARE IS PROVIDED BY THE NETBSD FOUNDATION, INC. AND CONTRIBUTORS
- * ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED
- * TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
- * PURPOSE ARE DISCLAIMED.  IN NO EVENT SHALL THE FOUNDATION OR CONTRIBUTORS
- * BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
- * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
- * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
- * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
- * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
- * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
- * POSSIBILITY OF SUCH DAMAGE.
- */
-
-#ifndef _SYS_RB_H_
-#define        _SYS_RB_H_
-
-#if defined(_KERNEL) || defined(_STANDALONE)
-#include <sys/types.h>
-#else
-#include <stdbool.h>
-#include <inttypes.h>
-#endif
-#include <sys/queue.h>
-#include <sys/endian.h>
-
-__BEGIN_DECLS
-
-typedef struct rb_node {
-       struct rb_node *rb_nodes[2];
-#define        RB_DIR_LEFT             0
-#define        RB_DIR_RIGHT            1
-#define        RB_DIR_OTHER            1
-#define        rb_left                 rb_nodes[RB_DIR_LEFT]
-#define        rb_right                rb_nodes[RB_DIR_RIGHT]
-
-       /*
-        * rb_info contains the two flags and the parent back pointer.
-        * We put the two flags in the low two bits since we know that
-        * rb_node will have an alignment of 4 or 8 bytes.
-        */
-       uintptr_t rb_info;
-#define        RB_FLAG_POSITION        0x2
-#define        RB_FLAG_RED             0x1
-#define        RB_FLAG_MASK            (RB_FLAG_POSITION|RB_FLAG_RED)
-#define        RB_FATHER(rb) \
-    ((struct rb_node *)((rb)->rb_info & ~RB_FLAG_MASK))
-#define        RB_SET_FATHER(rb, father) \
-    ((void)((rb)->rb_info = (uintptr_t)(father)|((rb)->rb_info & RB_FLAG_MASK)))
-
-#define        RB_SENTINEL_P(rb)       ((rb) == NULL)
-#define        RB_LEFT_SENTINEL_P(rb)  RB_SENTINEL_P((rb)->rb_left)
-#define        RB_RIGHT_SENTINEL_P(rb) RB_SENTINEL_P((rb)->rb_right)
-#define        RB_FATHER_SENTINEL_P(rb) RB_SENTINEL_P(RB_FATHER((rb)))
-#define        RB_CHILDLESS_P(rb) \
-    (RB_SENTINEL_P(rb) || (RB_LEFT_SENTINEL_P(rb) && RB_RIGHT_SENTINEL_P(rb)))
-#define        RB_TWOCHILDREN_P(rb) \
-    (!RB_SENTINEL_P(rb) && !RB_LEFT_SENTINEL_P(rb) && !RB_RIGHT_SENTINEL_P(rb))
-
-#define        RB_POSITION(rb) \
-    (((rb)->rb_info & RB_FLAG_POSITION) ? RB_DIR_RIGHT : RB_DIR_LEFT)
-#define        RB_RIGHT_P(rb)          (RB_POSITION(rb) == RB_DIR_RIGHT)
-#define        RB_LEFT_P(rb)           (RB_POSITION(rb) == RB_DIR_LEFT)
-#define        RB_RED_P(rb)            (!RB_SENTINEL_P(rb) && ((rb)->rb_info & RB_FLAG_RED) != 0)
-#define        RB_BLACK_P(rb)          (RB_SENTINEL_P(rb) || ((rb)->rb_info & RB_FLAG_RED) == 0)
-#define        RB_MARK_RED(rb)         ((void)((rb)->rb_info |= RB_FLAG_RED))
-#define        RB_MARK_BLACK(rb)       ((void)((rb)->rb_info &= ~RB_FLAG_RED))
-#define        RB_INVERT_COLOR(rb)     ((void)((rb)->rb_info ^= RB_FLAG_RED))
-#define        RB_ROOT_P(rbt, rb)      ((rbt)->rbt_root == (rb))
-#define        RB_SET_POSITION(rb, position) \
-    ((void)((position) ? ((rb)->rb_info |= RB_FLAG_POSITION) : \
-    ((rb)->rb_info &= ~RB_FLAG_POSITION)))
-#define        RB_ZERO_PROPERTIES(rb)  ((void)((rb)->rb_info &= ~RB_FLAG_MASK))
-#define        RB_COPY_PROPERTIES(dst, src) \
-    ((void)((dst)->rb_info ^= ((dst)->rb_info ^ (src)->rb_info) & RB_FLAG_MASK))
-#define RB_SWAP_PROPERTIES(a, b) do { \
-    uintptr_t xorinfo = ((a)->rb_info ^ (b)->rb_info) & RB_FLAG_MASK; \
-    (a)->rb_info ^= xorinfo; \
-    (b)->rb_info ^= xorinfo; \
-  } while (/*CONSTCOND*/ 0)
-#ifdef RBDEBUG
-       TAILQ_ENTRY(rb_node) rb_link;
-#endif
-} rb_node_t;
-
-#define RB_TREE_MIN(T) rb_tree_iterate((T), NULL, RB_DIR_LEFT)
-#define RB_TREE_MAX(T) rb_tree_iterate((T), NULL, RB_DIR_RIGHT)
-#define RB_TREE_FOREACH(N, T) \
-    for ((N) = RB_TREE_MIN(T); (N); \
-       (N) = rb_tree_iterate((T), (N), RB_DIR_RIGHT))
-#define RB_TREE_FOREACH_REVERSE(N, T) \
-    for ((N) = RB_TREE_MAX(T); (N); \
-       (N) = rb_tree_iterate((T), (N), RB_DIR_LEFT))
-
-#ifdef RBDEBUG
-TAILQ_HEAD(rb_node_qh, rb_node);
-
-#define        RB_TAILQ_REMOVE(a, b, c)                TAILQ_REMOVE(a, b, c)
-#define        RB_TAILQ_INIT(a)                        TAILQ_INIT(a)
-#define        RB_TAILQ_INSERT_HEAD(a, b, c)           TAILQ_INSERT_HEAD(a, b, c)
-#define        RB_TAILQ_INSERT_BEFORE(a, b, c)         TAILQ_INSERT_BEFORE(a, b, c)
-#define        RB_TAILQ_INSERT_AFTER(a, b, c, d)       TAILQ_INSERT_AFTER(a, b, c, d)
-#else
-#define        RB_TAILQ_REMOVE(a, b, c)                do { } while (/*CONSTCOND*/0)



Home | Main Index | Thread Index | Old Index