mirror of
https://git.kernel.org/pub/scm/linux/kernel/git/stable/linux.git
synced 2024-09-27 12:57:53 +00:00
idr: Add new function idr_is_empty()
Signed-off-by: Andreas Gruenbacher <agruen@linbit.com> Signed-off-by: Philipp Reisner <philipp.reisner@linbit.com>
This commit is contained in:
parent
8e22943430
commit
05f7a7d6a7
2 changed files with 11 additions and 0 deletions
|
@ -85,6 +85,7 @@ void idr_remove(struct idr *idp, int id);
|
||||||
void idr_free(struct idr *idp, int id);
|
void idr_free(struct idr *idp, int id);
|
||||||
void idr_destroy(struct idr *idp);
|
void idr_destroy(struct idr *idp);
|
||||||
void idr_init(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()
|
* idr_preload_end - end preload section started with idr_preload()
|
||||||
|
|
10
lib/idr.c
10
lib/idr.c
|
@ -869,6 +869,16 @@ void idr_init(struct idr *idp)
|
||||||
}
|
}
|
||||||
EXPORT_SYMBOL(idr_init);
|
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
|
* DOC: IDA description
|
||||||
|
|
Loading…
Reference in a new issue