From be34cfc5875d1a620611b37950cfb83bf69700d6 Mon Sep 17 00:00:00 2001 From: Slava Shwartsman Date: Wed, 5 Dec 2018 13:15:57 +0000 Subject: [PATCH] linuxkpi: implement idr_is_empty() and ida_is_empty(). Submitted by: kib@ Approved by: hselasky (mentor) MFC after: 1 week Sponsored by: Mellanox Technologies --- sys/compat/linuxkpi/common/include/linux/idr.h | 9 +++++++++ 1 file changed, 9 insertions(+) diff --git a/sys/compat/linuxkpi/common/include/linux/idr.h b/sys/compat/linuxkpi/common/include/linux/idr.h index 3018f393ed35..70ca675dfeb4 100644 --- a/sys/compat/linuxkpi/common/include/linux/idr.h +++ b/sys/compat/linuxkpi/common/include/linux/idr.h @@ -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_ */