diff options
author | Andreas Gruenbacher <agruen@linbit.com> | 2011-08-08 23:36:56 +0200 |
---|---|---|
committer | Maciej Wereski <m.wereski@partner.samsung.com> | 2015-04-03 11:44:54 +0200 |
commit | 52314c4b0c513205da9c51d1eed029f9b496c274 (patch) | |
tree | 070dc8f153d2e68c153eb6f945ab84ca798db24b | |
parent | 5761bd9dbd3edd6da4289359839e0ac2bf59eb96 (diff) | |
download | linux-3.10-52314c4b0c513205da9c51d1eed029f9b496c274.tar.gz linux-3.10-52314c4b0c513205da9c51d1eed029f9b496c274.tar.bz2 linux-3.10-52314c4b0c513205da9c51d1eed029f9b496c274.zip |
idr: Add new function idr_is_empty()before-iov
Signed-off-by: Andreas Gruenbacher <agruen@linbit.com>
Signed-off-by: Philipp Reisner <philipp.reisner@linbit.com>
-rw-r--r-- | include/linux/idr.h | 1 | ||||
-rw-r--r-- | lib/idr.c | 10 |
2 files changed, 11 insertions, 0 deletions
diff --git a/include/linux/idr.h b/include/linux/idr.h index 871a213a847..9c95d210458 100644 --- a/include/linux/idr.h +++ b/include/linux/idr.h @@ -85,6 +85,7 @@ void idr_remove(struct idr *idp, int id); void idr_free(struct idr *idp, int id); void idr_destroy(struct idr *idp); void idr_init(struct idr *idp); +bool idr_is_empty(struct idr *idp); /** * idr_preload_end - end preload section started with idr_preload() diff --git a/lib/idr.c b/lib/idr.c index dd06ccb3d2c..78713ff394e 100644 --- a/lib/idr.c +++ b/lib/idr.c @@ -872,6 +872,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 |