Source-Changes-HG archive
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index][Old Index]
[src/riastradh-drm2]: src/sys/external/bsd/drm2 Add idr_for_each to Linux idr...
details: https://anonhg.NetBSD.org/src/rev/272b7312d2da
branches: riastradh-drm2
changeset: 788237:272b7312d2da
user: riastradh <riastradh%NetBSD.org@localhost>
date: Wed Jul 24 02:51:35 2013 +0000
description:
Add idr_for_each to Linux idr abstraction.
diffstat:
sys/external/bsd/drm2/include/linux/idr.h | 3 ++-
sys/external/bsd/drm2/linux/linux_idr.c | 22 ++++++++++++++++++++--
2 files changed, 22 insertions(+), 3 deletions(-)
diffs (56 lines):
diff -r 08cd83137d58 -r 272b7312d2da sys/external/bsd/drm2/include/linux/idr.h
--- a/sys/external/bsd/drm2/include/linux/idr.h Wed Jul 24 02:51:20 2013 +0000
+++ b/sys/external/bsd/drm2/include/linux/idr.h Wed Jul 24 02:51:35 2013 +0000
@@ -1,4 +1,4 @@
-/* $NetBSD: idr.h,v 1.1.2.4 2013/07/24 02:07:46 riastradh Exp $ */
+/* $NetBSD: idr.h,v 1.1.2.5 2013/07/24 02:51:35 riastradh Exp $ */
/*-
* Copyright (c) 2013 The NetBSD Foundation, Inc.
@@ -52,5 +52,6 @@
void idr_remove_all(struct idr *);
int idr_pre_get(struct idr *, int);
int idr_get_new_above(struct idr *, void *, int, int *);
+int idr_for_each(struct idr *, int (*)(int, void *, void *), void *);
#endif /* _LINUX_IDR_H_ */
diff -r 08cd83137d58 -r 272b7312d2da sys/external/bsd/drm2/linux/linux_idr.c
--- a/sys/external/bsd/drm2/linux/linux_idr.c Wed Jul 24 02:51:20 2013 +0000
+++ b/sys/external/bsd/drm2/linux/linux_idr.c Wed Jul 24 02:51:35 2013 +0000
@@ -1,4 +1,4 @@
-/* $NetBSD: linux_idr.c,v 1.1.2.4 2013/07/24 02:07:46 riastradh Exp $ */
+/* $NetBSD: linux_idr.c,v 1.1.2.5 2013/07/24 02:51:35 riastradh Exp $ */
/*-
* Copyright (c) 2013 The NetBSD Foundation, Inc.
@@ -30,7 +30,7 @@
*/
#include <sys/cdefs.h>
-__KERNEL_RCSID(0, "$NetBSD: linux_idr.c,v 1.1.2.4 2013/07/24 02:07:46 riastradh Exp $");
+__KERNEL_RCSID(0, "$NetBSD: linux_idr.c,v 1.1.2.5 2013/07/24 02:51:35 riastradh Exp $");
#include <sys/param.h>
#include <sys/atomic.h>
@@ -219,3 +219,21 @@
return 0;
}
+
+int
+idr_for_each(struct idr *idr, int (*proc)(int, void *, void *), void *arg)
+{
+ struct idr_node *node = NULL;
+ int error = 0;
+
+ rw_enter(&idr->idr_lock, RW_READER);
+ while ((node = rb_tree_iterate(&idr->idr_tree, node, RB_DIR_RIGHT))
+ != NULL) {
+ error = (*proc)(node->in_index, node->in_data, arg);
+ if (error)
+ break;
+ }
+ rw_exit(&idr->idr_lock);
+
+ return error;
+}
Home |
Main Index |
Thread Index |
Old Index