summaryrefslogtreecommitdiff
path: root/include/linux
diff options
context:
space:
mode:
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.
*/