1#include <mem/alloc.h>
2
3LINKER_SECTION_EXTERN(struct alloc_flag_ex_desc, alloc_flag_ex_descs);
4
5size_t
6alloc_flag_ex_get_desc(enum alloc_flags flag,
7 struct alloc_flag_ex_desc out[ALLOC_FLAG_EX_DESC_MAX]) {
8
9 size_t idx = 0;
10 struct alloc_flag_ex_desc *exd;
11
12 linker_section_for_each_object(exd, alloc_flag_ex_descs) {
13 if (flag & exd->flag) {
14 out[idx++] = *exd;
15 if (idx == ALLOC_FLAG_EX_DESC_MAX)
16 return idx;
17 }
18 }
19
20 return idx;
21}
22