diff options
author | Andreas Gruenbacher <agruen@linbit.com> | 2011-08-08 23:36:56 +0200 |
---|---|---|
committer | Philipp Reisner <philipp.reisner@linbit.com> | 2014-02-17 16:27:47 +0100 |
commit | 05f7a7d6a7d23a877063857cf2df1dffec5a96dc (patch) | |
tree | 680e8b69e8ca9c6e8e793b226eb5392241bbec8d /lib/idr.c | |
parent | drbd: Add missing error goto (diff) | |
download | linux-05f7a7d6a7d23a877063857cf2df1dffec5a96dc.tar.xz linux-05f7a7d6a7d23a877063857cf2df1dffec5a96dc.zip |
idr: Add new function idr_is_empty()
Signed-off-by: Andreas Gruenbacher <agruen@linbit.com>
Signed-off-by: Philipp Reisner <philipp.reisner@linbit.com>
Diffstat (limited to 'lib/idr.c')
-rw-r--r-- | lib/idr.c | 10 |
1 files changed, 10 insertions, 0 deletions
diff --git a/lib/idr.c b/lib/idr.c index bfe4db4e165f..1ba4956bfbff 100644 --- a/lib/idr.c +++ b/lib/idr.c @@ -869,6 +869,16 @@ void idr_init(struct idr *idp) } EXPORT_SYMBOL(idr_init); +static int idr_has_entry(int id, void *p, void *data) +{ + return 1; +} + +bool idr_is_empty(struct idr *idp) +{ + return !idr_for_each(idp, idr_has_entry, NULL); +} +EXPORT_SYMBOL(idr_is_empty); /** * DOC: IDA description |