Implement ida_free() and ida_alloc_max() in the LinuxKPI.

Submitted by:		Johannes Lundberg <johalun0@gmail.com>
MFC after:		1 week
Sponsored by:		Limelight Networks
Sponsored by:		Mellanox Technologies
This commit is contained in:
hselasky 2019-03-13 18:02:47 +00:00
parent eb6b83e1b3
commit 13e21f62ea
2 changed files with 15 additions and 0 deletions
sys/compat/linuxkpi/common
include/linux
src

@ -112,6 +112,7 @@ struct ida {
int ida_pre_get(struct ida *ida, gfp_t gfp_mask);
int ida_get_new_above(struct ida *ida, int starting_id, int *p_id);
void ida_remove(struct ida *ida, int id);
void ida_free(struct ida *ida, int id);
void ida_destroy(struct ida *ida);
void ida_init(struct ida *ida);
@ -126,6 +127,13 @@ ida_get_new(struct ida *ida, int *p_id)
return (ida_get_new_above(ida, 0, p_id));
}
static inline int
ida_alloc_max(struct ida *ida, unsigned int max, gfp_t gfp)
{
return (ida_simple_get(ida, 0, max, gfp));
}
static inline bool
ida_is_empty(struct ida *ida)
{

@ -796,6 +796,13 @@ ida_remove(struct ida *ida, int id)
idr_remove(&ida->idr, id);
}
void
ida_free(struct ida *ida, int id)
{
ida_remove(ida, id);
}
void
ida_init(struct ida *ida)
{