linuxkpi: implement idr_is_empty() and ida_is_empty().

Submitted by:   kib@
Approved by:    hselasky (mentor)
MFC after:      1 week
Sponsored by:   Mellanox Technologies
This commit is contained in:
slavash 2018-12-05 13:15:57 +00:00
parent 9899d78b5d
commit 94db4c71a7

View File

@ -91,6 +91,7 @@ void idr_init(struct idr *idp);
int idr_alloc(struct idr *idp, void *ptr, int start, int end, gfp_t);
int idr_alloc_cyclic(struct idr *idp, void *ptr, int start, int end, gfp_t);
int idr_for_each(struct idr *idp, int (*fn)(int id, void *p, void *data), void *data);
bool idr_is_empty(struct idr *idp);
#define idr_for_each_entry(idp, entry, id) \
for ((id) = 0; ((entry) = idr_get_next(idp, &(id))) != NULL; ++(id))
@ -122,7 +123,15 @@ void ida_simple_remove(struct ida *ida, unsigned int id);
static inline int
ida_get_new(struct ida *ida, int *p_id)
{
return (ida_get_new_above(ida, 0, p_id));
}
static inline bool
ida_is_empty(struct ida *ida)
{
return (idr_is_empty(&ida->idr));
}
#endif /* _LINUX_IDR_H_ */