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 Implement idr_remove_all.
details: https://anonhg.NetBSD.org/src/rev/bca4a4f89796
branches: riastradh-drm2
changeset: 788076:bca4a4f89796
user: riastradh <riastradh%NetBSD.org@localhost>
date: Wed Jul 24 02:07:09 2013 +0000
description:
Implement idr_remove_all.
diffstat:
sys/external/bsd/drm2/include/linux/idr.h | 3 ++-
sys/external/bsd/drm2/linux/linux_idr.c | 20 ++++++++++++++++++--
2 files changed, 20 insertions(+), 3 deletions(-)
diffs (58 lines):
diff -r 7d166ea56abe -r bca4a4f89796 sys/external/bsd/drm2/include/linux/idr.h
--- a/sys/external/bsd/drm2/include/linux/idr.h Wed Jul 24 02:06:53 2013 +0000
+++ b/sys/external/bsd/drm2/include/linux/idr.h Wed Jul 24 02:07:09 2013 +0000
@@ -1,4 +1,4 @@
-/* $NetBSD: idr.h,v 1.1.2.2 2013/07/24 00:50:36 riastradh Exp $ */
+/* $NetBSD: idr.h,v 1.1.2.3 2013/07/24 02:07:09 riastradh Exp $ */
/*-
* Copyright (c) 2013 The NetBSD Foundation, Inc.
@@ -48,6 +48,7 @@
void idr_destroy(struct idr *);
void *idr_find(struct idr *, int);
void idr_remove(struct idr *, int);
+void idr_remove_all(struct idr *);
int idr_pre_get(struct idr *, int);
int idr_get_new_above(struct idr *, void *, int, int *);
diff -r 7d166ea56abe -r bca4a4f89796 sys/external/bsd/drm2/linux/linux_idr.c
--- a/sys/external/bsd/drm2/linux/linux_idr.c Wed Jul 24 02:06:53 2013 +0000
+++ b/sys/external/bsd/drm2/linux/linux_idr.c Wed Jul 24 02:07:09 2013 +0000
@@ -1,4 +1,4 @@
-/* $NetBSD: linux_idr.c,v 1.1.2.2 2013/07/24 01:56:48 riastradh Exp $ */
+/* $NetBSD: linux_idr.c,v 1.1.2.3 2013/07/24 02:07:09 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.2 2013/07/24 01:56:48 riastradh Exp $");
+__KERNEL_RCSID(0, "$NetBSD: linux_idr.c,v 1.1.2.3 2013/07/24 02:07:09 riastradh Exp $");
#include <sys/param.h>
#include <sys/atomic.h>
@@ -134,6 +134,22 @@
kmem_free(node, sizeof(*node));
}
+void
+idr_remove_all(struct idr *idr)
+{
+ struct idr_node *node;
+
+ rw_enter(&idr->idr_lock, RW_WRITER);
+ while ((node = rb_tree_iterate(&idr->idr_tree, NULL, RB_DIR_RIGHT)) !=
+ NULL) {
+ rb_tree_remove_node(&idr->idr_tree, node);
+ rw_exit(&idr->idr_lock);
+ kmem_free(node, sizeof(*node));
+ rw_enter(&idr->idr_lock, RW_WRITER);
+ }
+ rw_exit(&idr->idr_lock);
+}
+
int
idr_pre_get(struct idr *idr, int flags __unused /* XXX */)
{
Home |
Main Index |
Thread Index |
Old Index