Linux kernel mirror (for testing) git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
kernel os linux

idr: Add new function idr_is_empty()

Signed-off-by: Andreas Gruenbacher <agruen@linbit.com>
Signed-off-by: Philipp Reisner <philipp.reisner@linbit.com>

authored by

Andreas Gruenbacher and committed by
Philipp Reisner
05f7a7d6 8e229434

+11
+1
include/linux/idr.h
··· 85 85 void idr_free(struct idr *idp, int id); 86 86 void idr_destroy(struct idr *idp); 87 87 void idr_init(struct idr *idp); 88 + bool idr_is_empty(struct idr *idp); 88 89 89 90 /** 90 91 * idr_preload_end - end preload section started with idr_preload()
+10
lib/idr.c
··· 869 869 } 870 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 884 * DOC: IDA description