Source-Changes-HG archive

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

[src/netbsd-6]: src Pull up revisions:



details:   https://anonhg.NetBSD.org/src/rev/367ca8218bda
branches:  netbsd-6
changeset: 775514:367ca8218bda
user:      jdc <jdc%NetBSD.org@localhost>
date:      Sat Nov 24 18:15:22 2012 +0000

description:
Pull up revisions:
  src/common/lib/libc/gen/ptree.c revision 1.10
  src/sys/sys/ptree.h revision 1.8
(requested by rmind in ticket #717).

Add a ptree_mask_node_p to determine if an item is a mask node, and what
its non-mask length is.

diffstat:

 common/lib/libc/gen/ptree.c |  20 +++++++++++++++++---
 sys/sys/ptree.h             |   3 ++-
 2 files changed, 19 insertions(+), 4 deletions(-)

diffs (62 lines):

diff -r 16870cbf287c -r 367ca8218bda common/lib/libc/gen/ptree.c
--- a/common/lib/libc/gen/ptree.c       Sat Nov 24 18:10:10 2012 +0000
+++ b/common/lib/libc/gen/ptree.c       Sat Nov 24 18:15:22 2012 +0000
@@ -1,4 +1,4 @@
-/*     $NetBSD: ptree.c,v 1.5.8.2 2012/07/16 22:10:46 riz Exp $        */
+/*     $NetBSD: ptree.c,v 1.5.8.3 2012/11/24 18:15:22 jdc Exp $        */
 
 /*-
  * Copyright (c) 2008 The NetBSD Foundation, Inc.
@@ -40,7 +40,7 @@
 #include <sys/types.h>
 #include <sys/systm.h>
 #include <lib/libkern/libkern.h>
-__KERNEL_RCSID(0, "$NetBSD: ptree.c,v 1.5.8.2 2012/07/16 22:10:46 riz Exp $");
+__KERNEL_RCSID(0, "$NetBSD: ptree.c,v 1.5.8.3 2012/11/24 18:15:22 jdc Exp $");
 #else
 #include <stddef.h>
 #include <stdint.h>
@@ -53,7 +53,7 @@
 #else
 #define        KASSERT(e)      do { } while (/*CONSTCOND*/ 0)
 #endif
-__RCSID("$NetBSD: ptree.c,v 1.5.8.2 2012/07/16 22:10:46 riz Exp $");
+__RCSID("$NetBSD: ptree.c,v 1.5.8.3 2012/11/24 18:15:22 jdc Exp $");
 #endif /* _KERNEL || _STANDALONE */
 
 #ifdef _LIBC
@@ -1214,3 +1214,17 @@
 #endif
        return ok;
 }
+
+bool
+ptree_mask_node_p(pt_tree_t *pt, const void *item, pt_bitlen_t *lenp)
+{
+       const pt_node_t * const mask = ITEMTONODE(pt, item);
+
+       if (!PTN_ISMASK_P(mask))
+               return false;
+
+       if (lenp != NULL)
+               *lenp = PTN_MASK_BITLEN(mask);
+
+       return true;
+}
diff -r 16870cbf287c -r 367ca8218bda sys/sys/ptree.h
--- a/sys/sys/ptree.h   Sat Nov 24 18:10:10 2012 +0000
+++ b/sys/sys/ptree.h   Sat Nov 24 18:15:22 2012 +0000
@@ -1,4 +1,4 @@
-/*     $NetBSD: ptree.h,v 1.4.8.2 2012/07/16 22:10:47 riz Exp $        */
+/*     $NetBSD: ptree.h,v 1.4.8.3 2012/11/24 18:15:22 jdc Exp $        */
 
 /*-
  * Copyright (c) 2008 The NetBSD Foundation, Inc.
@@ -184,6 +184,7 @@
 void   ptree_init(pt_tree_t *, const pt_tree_ops_t *, void *, size_t, size_t);
 bool   ptree_insert_node(pt_tree_t *, void *);
 bool   ptree_insert_mask_node(pt_tree_t *, void *, pt_bitlen_t);
+bool   ptree_mask_node_p(pt_tree_t *, const void *, pt_bitlen_t *);
 void * ptree_find_filtered_node(pt_tree_t *, const void *, pt_filter_t, void *);
 #define        ptree_find_node(pt,key) \
        ptree_find_filtered_node((pt), (key), NULL, NULL)



Home | Main Index | Thread Index | Old Index