Source-Changes-HG archive
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index][Old Index]
[src/netbsd-6]: src Pull up following revision(s) (requested by rmind in tick...
details: https://anonhg.NetBSD.org/src/rev/a7809b29d7ea
branches: netbsd-6
changeset: 774327:a7809b29d7ea
user: riz <riz%NetBSD.org@localhost>
date: Thu Jul 12 18:35:10 2012 +0000
description:
Pull up following revision(s) (requested by rmind in ticket #413):
common/lib/libc/gen/ptree.c: revision 1.6
sys/sys/ptree.h: revision 1.6
ptree: add context argument. OK matt@
diffstat:
common/lib/libc/gen/ptree.c | 25 ++++++++++++-------------
sys/sys/ptree.h | 23 ++++++++++++++---------
2 files changed, 26 insertions(+), 22 deletions(-)
diffs (139 lines):
diff -r a84548b91487 -r a7809b29d7ea common/lib/libc/gen/ptree.c
--- a/common/lib/libc/gen/ptree.c Thu Jul 12 18:32:05 2012 +0000
+++ b/common/lib/libc/gen/ptree.c Thu Jul 12 18:35:10 2012 +0000
@@ -1,4 +1,4 @@
-/* $NetBSD: ptree.c,v 1.5 2009/06/07 03:12:40 yamt Exp $ */
+/* $NetBSD: ptree.c,v 1.5.8.1 2012/07/12 18:35:10 riz 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 2009/06/07 03:12:40 yamt Exp $");
+__KERNEL_RCSID(0, "$NetBSD: ptree.c,v 1.5.8.1 2012/07/12 18:35:10 riz 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 2009/06/07 03:12:40 yamt Exp $");
+__RCSID("$NetBSD: ptree.c,v 1.5.8.1 2012/07/12 18:35:10 riz Exp $");
#endif /* _KERNEL || _STANDALONE */
#ifdef _LIBC
@@ -124,8 +124,8 @@
pt_bitoff_t *bitoff_p, pt_slot_t *slots_p)
{
return (*pt->pt_ops->ptto_matchnode)(NODETOKEY(pt, target),
- (ptn != NULL ? NODETOKEY(pt, ptn) : NULL), max_bitoff,
- bitoff_p, slots_p);
+ (ptn != NULL ? NODETOKEY(pt, ptn) : NULL),
+ max_bitoff, bitoff_p, slots_p, pt->pt_context);
}
static inline pt_slot_t
@@ -136,8 +136,7 @@
if (bitlen == 0)
return PT_SLOT_ROOT;
return (*pt->pt_ops->ptto_testnode)(NODETOKEY(pt, target),
- PTN_BRANCH_BITOFF(ptn),
- bitlen);
+ PTN_BRANCH_BITOFF(ptn), bitlen, pt->pt_context);
}
static inline bool
@@ -145,15 +144,14 @@
const pt_node_t *ptn, pt_bitoff_t bitoff, pt_bitlen_t bitlen)
{
return (*pt->pt_ops->ptto_matchkey)(key, NODETOKEY(pt, ptn),
- bitoff, bitlen);
+ bitoff, bitlen, pt->pt_context);
}
static inline pt_slot_t
ptree_testkey(const pt_tree_t *pt, const void *key, const pt_node_t *ptn)
{
- return (*pt->pt_ops->ptto_testkey)(key,
- PTN_BRANCH_BITOFF(ptn),
- PTN_BRANCH_BITLEN(ptn));
+ return (*pt->pt_ops->ptto_testkey)(key, PTN_BRANCH_BITOFF(ptn),
+ PTN_BRANCH_BITLEN(ptn), pt->pt_context);
}
static inline void
@@ -166,12 +164,13 @@
}
void
-ptree_init(pt_tree_t *pt, const pt_tree_ops_t *ops, size_t node_offset,
- size_t key_offset)
+ptree_init(pt_tree_t *pt, const pt_tree_ops_t *ops, void *context,
+ size_t node_offset, size_t key_offset)
{
memset(pt, 0, sizeof(*pt));
pt->pt_node_offset = node_offset;
pt->pt_key_offset = key_offset;
+ pt->pt_context = context;
pt->pt_ops = ops;
}
diff -r a84548b91487 -r a7809b29d7ea sys/sys/ptree.h
--- a/sys/sys/ptree.h Thu Jul 12 18:32:05 2012 +0000
+++ b/sys/sys/ptree.h Thu Jul 12 18:35:10 2012 +0000
@@ -1,4 +1,5 @@
-/* $NetBSD: ptree.h,v 1.4 2011/07/30 16:37:05 christos Exp $ */
+/* $NetBSD: ptree.h,v 1.4.8.1 2012/07/12 18:35:10 riz Exp $ */
+
/*-
* Copyright (c) 2008 The NetBSD Foundation, Inc.
* All rights reserved.
@@ -27,6 +28,7 @@
* ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
* POSSIBILITY OF SUCH DAMAGE.
*/
+
#ifndef _SYS_PTREE_H_
#define _SYS_PTREE_H_
@@ -155,12 +157,14 @@
#endif /* _PT_PRIVATE */
typedef struct pt_tree_ops {
- bool (*ptto_matchnode)(const void *, const void *, pt_bitoff_t,
- pt_bitoff_t *, pt_slot_t *);
- bool (*ptto_matchkey)(const void *, const void *, pt_bitoff_t,
- pt_bitlen_t);
- pt_slot_t (*ptto_testnode)(const void *, pt_bitoff_t, pt_bitlen_t);
- pt_slot_t (*ptto_testkey)(const void *, pt_bitoff_t, pt_bitlen_t);
+ bool (*ptto_matchnode)(const void *, const void *,
+ pt_bitoff_t, pt_bitoff_t *, pt_slot_t *, void *);
+ bool (*ptto_matchkey)(const void *, const void *,
+ pt_bitoff_t, pt_bitlen_t, void *);
+ pt_slot_t (*ptto_testnode)(const void *,
+ pt_bitoff_t, pt_bitlen_t, void *);
+ pt_slot_t (*ptto_testkey)(const void *,
+ pt_bitoff_t, pt_bitlen_t, void *);
} pt_tree_ops_t;
typedef struct pt_tree {
@@ -170,13 +174,14 @@
const pt_tree_ops_t *pt_ops;
size_t pt_node_offset;
size_t pt_key_offset;
- uintptr_t pt_spare[4];
+ void *pt_context;
+ uintptr_t pt_spare[3];
} pt_tree_t;
#define PT_FILTER_MASK 0x00000001 /* node is a mask */
typedef bool (*pt_filter_t)(void *, const void *, int);
-void ptree_init(pt_tree_t *, const pt_tree_ops_t *, size_t, size_t);
+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);
void * ptree_find_filtered_node(pt_tree_t *, void *, pt_filter_t, void *);
Home |
Main Index |
Thread Index |
Old Index