idr: Add new APIs to support unsigned long
The following new APIs are added:
int idr_alloc_ext(struct idr *idr, void *ptr, unsigned long *index,
unsigned long start, unsigned long end, gfp_t gfp);
void *idr_remove_ext(struct idr *idr, unsigned long id);
void *idr_find_ext(const struct idr *idr, unsigned long id);
void *idr_replace_ext(struct idr *idr, void *ptr, unsigned long id);
void *idr_get_next_ext(struct idr *idr, unsigned long *nextid);
Signed-off-by: Chris Mi <chrism@mellanox.com>
Signed-off-by: Jiri Pirko <jiri@mellanox.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
This commit is contained in:
committed by
David S. Miller
parent
c2f8a6cee6
commit
388f79fda7
@@ -357,8 +357,25 @@ int radix_tree_split(struct radix_tree_root *, unsigned long index,
|
||||
unsigned new_order);
|
||||
int radix_tree_join(struct radix_tree_root *, unsigned long index,
|
||||
unsigned new_order, void *);
|
||||
void __rcu **idr_get_free(struct radix_tree_root *, struct radix_tree_iter *,
|
||||
gfp_t, int end);
|
||||
|
||||
void __rcu **idr_get_free_cmn(struct radix_tree_root *root,
|
||||
struct radix_tree_iter *iter, gfp_t gfp,
|
||||
unsigned long max);
|
||||
static inline void __rcu **idr_get_free(struct radix_tree_root *root,
|
||||
struct radix_tree_iter *iter,
|
||||
gfp_t gfp,
|
||||
int end)
|
||||
{
|
||||
return idr_get_free_cmn(root, iter, gfp, end > 0 ? end - 1 : INT_MAX);
|
||||
}
|
||||
|
||||
static inline void __rcu **idr_get_free_ext(struct radix_tree_root *root,
|
||||
struct radix_tree_iter *iter,
|
||||
gfp_t gfp,
|
||||
unsigned long end)
|
||||
{
|
||||
return idr_get_free_cmn(root, iter, gfp, end - 1);
|
||||
}
|
||||
|
||||
enum {
|
||||
RADIX_TREE_ITER_TAG_MASK = 0x0f, /* tag index in lower nybble */
|
||||
|
||||
Reference in New Issue
Block a user