1#ifndef __VSF_LINUX_IDR_H__
2#define __VSF_LINUX_IDR_H__
11#ifndef VSF_LINUX_CFG_IDA_MAX
12# define VSF_LINUX_CFG_IDA_MAX 1024
21#define IDA_INIT(__NAME) { 0 }
22#define DEFINE_IDA(__NAME) struct ida __NAME = IDA_INIT(__NAME)
24extern int ida_alloc_range(
struct ida *ida,
unsigned int __min_to_avoid_conflict,
unsigned int __max_to_avoid_confilict,
gfp_t);
25static inline void ida_free(
struct ida *ida,
unsigned int id)
32static inline void ida_init(
struct ida *ida)
34 memset(ida, 0,
sizeof(*ida));
36static inline void ida_destroy(
struct ida *ida)
40static inline int ida_alloc(
struct ida *ida,
gfp_t gfp)
44static inline int ida_alloc_min(
struct ida *ida,
unsigned int __min_to_avoid_conflict,
gfp_t gfp)
48static inline int ida_alloc_max(
struct ida *ida,
unsigned int __max_to_avoid_confilict,
gfp_t gfp)
53static inline bool ida_is_empty(
const struct ida *ida)
56 bool is_empty = ida->id_cnt == 0;
61#define ida_simple_get(ida, start, end, gfp) ida_alloc_range(ida, start, (end) - 1, gfp)
62#define ida_simple_remove(ida, id) ida_free(ida, id)
unsigned int gfp_t
Definition gfp.h:10
int ida_alloc_range(struct ida *ida, unsigned int __min_to_avoid_conflict, unsigned int __max_to_avoid_confilict, gfp_t)
Definition vsf_linux_core.c:725
#define VSF_LINUX_CFG_IDA_MAX
Definition idr.h:12
void * memset(void *s, int ch, size_t n)
uintalu_t vsf_protect_t
Definition vsf_arch_abstraction.h:53
#define vsf_protect_int
Definition vsf_arch_abstraction.h:321
#define vsf_unprotect_int
Definition vsf_arch_abstraction.h:322
#define vsf_declare_bitmap(__name, __bit_size)
Definition vsf_bitmap.h:95
#define vsf_bitmap_clear(__bitmap_ptr, __bit)
Definition vsf_bitmap.h:110
#define vsf_bitmap(__name)
Definition vsf_bitmap.h:93