From 8cc89540826b8426aaaef985c8d76443ceb9a990 Mon Sep 17 00:00:00 2001 From: Andrew Morton Date: Sun, 18 Apr 2004 22:05:29 -0700 Subject: [PATCH] idr.c: extra features enhancements From: Jim Houston - 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. --- include/linux/idr.h | 12 ++++++++++++ 1 file changed, 12 insertions(+) (limited to 'include/linux') 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. */ -- cgit v1.2.3