summaryrefslogtreecommitdiff
path: root/include/linux
diff options
context:
space:
mode:
authorAndrew Morton <akpm@osdl.org>2004-04-18 22:05:29 -0700
committerLinus Torvalds <torvalds@ppc970.osdl.org>2004-04-18 22:05:29 -0700
commit8cc89540826b8426aaaef985c8d76443ceb9a990 (patch)
tree2fa62cde6a62935cd99193d424695a07e839e53d /include/linux
parentef29bf03ef66e8c00f2917668ffb0c15e75bce8b (diff)
[PATCH] idr.c: extra features enhancements
From: Jim Houston <jim.houston@comcast.net> - Adds idr_get_new_above(), whihc permits us to do a first-fit search from a specified offset rather than always from zero. - Add IDR_INIT() DEFINE_IDR() constructors. Often idr's are singletons and having to cook up an initcall for them is a pain. This is needed by the "Increase number of dynamic inodes in procfs" patch.
Diffstat (limited to 'include/linux')
-rw-r--r--include/linux/idr.h12
1 files changed, 12 insertions, 0 deletions
diff --git a/include/linux/idr.h b/include/linux/idr.h
index b3a58338ed32..0aeae77806c7 100644
--- a/include/linux/idr.h
+++ b/include/linux/idr.h
@@ -23,6 +23,7 @@
# error "BITS_PER_LONG is not 32 or 64"
#endif
+#define IDR_SIZE (1 << IDR_BITS)
#define IDR_MASK ((1 << IDR_BITS)-1)
/* Define the size of the id's */
@@ -53,6 +54,17 @@ struct idr {
spinlock_t lock;
};
+#define IDR_INIT(name) \
+{ \
+ .top = NULL, \
+ .id_free = NULL, \
+ .count = 0, \
+ .layers = 0, \
+ .id_free_cnt = 0, \
+ .lock = SPIN_LOCK_UNLOCKED, \
+}
+#define DEFINE_IDR(name) struct idr name = IDR_INIT(name)
+
/*
* This is what we export.
*/