diff options
| author | Andreas Gruenbacher <agruen@linbit.com> | 2011-08-08 17:36:56 -0400 |
|---|---|---|
| committer | Philipp Reisner <philipp.reisner@linbit.com> | 2014-02-17 10:27:47 -0500 |
| commit | 05f7a7d6a7d23a877063857cf2df1dffec5a96dc (patch) | |
| tree | 680e8b69e8ca9c6e8e793b226eb5392241bbec8d /lib | |
| parent | 8e2294343017d6b9a3026538e58ffe0d8bda3843 (diff) | |
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')
| -rw-r--r-- | lib/idr.c | 10 |
1 files changed, 10 insertions, 0 deletions
| @@ -869,6 +869,16 @@ void idr_init(struct idr *idp) | |||
| 869 | } | 869 | } |
| 870 | EXPORT_SYMBOL(idr_init); | 870 | EXPORT_SYMBOL(idr_init); |
| 871 | 871 | ||
| 872 | static int idr_has_entry(int id, void *p, void *data) | ||
| 873 | { | ||
| 874 | return 1; | ||
| 875 | } | ||
| 876 | |||
| 877 | bool idr_is_empty(struct idr *idp) | ||
| 878 | { | ||
| 879 | return !idr_for_each(idp, idr_has_entry, NULL); | ||
| 880 | } | ||
| 881 | EXPORT_SYMBOL(idr_is_empty); | ||
| 872 | 882 | ||
| 873 | /** | 883 | /** |
| 874 | * DOC: IDA description | 884 | * DOC: IDA description |
