avl_adpt.h 1.2 KB

12345678910111213141516171819202122232425262728293031323334353637383940
  1. /*
  2. * Copyright (c) 2006-2022, RT-Thread Development Team
  3. *
  4. * SPDX-License-Identifier: Apache-2.0
  5. *
  6. * Change Logs:
  7. * Date Author Notes
  8. * 2022-11-14 WangXiaoyao the first version
  9. */
  10. #ifndef __MM_AVL_ADPT_H__
  11. #define __MM_AVL_ADPT_H__
  12. #include <avl.h>
  13. #include <rtdef.h>
  14. #include <rtthread.h>
  15. #include <stdint.h>
  16. #define VAREA_ENTRY(pnode) \
  17. (pnode) \
  18. ? rt_container_of(rt_container_of(pnode, struct _aspace_node, node), \
  19. struct rt_varea, node) \
  20. : 0
  21. #define ASPACE_VAREA_NEXT(pva) (VAREA_ENTRY(util_avl_next(&pva->node.node)))
  22. #define ASPACE_VAREA_FIRST(aspace) (VAREA_ENTRY(util_avl_first(&aspace->tree.tree)))
  23. #define ASPACE_VAREA_LAST(aspace) (VAREA_ENTRY(util_avl_last(&aspace->tree.tree)))
  24. #define ASPACE_VAREA_PREV(pva) (VAREA_ENTRY(util_avl_prev(&pva->node.node)))
  25. typedef struct _aspace_node
  26. {
  27. struct util_avl_struct node;
  28. } *_aspace_node_t;
  29. typedef struct _aspace_tree
  30. {
  31. struct util_avl_root tree;
  32. } *_aspace_tree_t;
  33. #endif /* __MM_AVL_ADPT_H__ */