MCPcopy Create free account
hub / github.com/RT-Thread/rt-thread / _shrink_varea

Function _shrink_varea

components/mm/mm_aspace.c:913–939  ·  view source on GitHub ↗

* modify the property of existed varea by shrink its size. Mem_obj is * notified to released the resource. */

Source from the content-addressed store, hash-verified

911 * notified to released the resource.
912 */
913static rt_err_t _shrink_varea(rt_varea_t varea, void *new_va, rt_size_t size)
914{
915 rt_err_t error;
916 rt_aspace_t aspace;
917 void *old_va;
918
919 if (varea->mem_obj && varea->mem_obj->on_varea_shrink)
920 error = varea->mem_obj->on_varea_shrink(varea, new_va, size);
921 else
922 error = -RT_EPERM;
923
924 if (error == RT_EOK)
925 {
926 aspace = varea->aspace;
927 old_va = varea->start;
928 varea->size = size;
929
930 if (old_va != new_va)
931 {
932 varea->start = new_va;
933 varea->offset += ((long)new_va - (long)old_va) >> MM_PAGE_SHIFT;
934 _aspace_bst_remove(aspace, varea);
935 _aspace_bst_insert(aspace, varea);
936 }
937 }
938 return error;
939}
940
941static rt_err_t _split_varea(rt_varea_t existed, char *ex_end, char *unmap_start, char *unmap_end, rt_size_t unmap_len)
942{

Callers 1

_remove_overlapped_vareaFunction · 0.85

Calls 2

_aspace_bst_removeFunction · 0.70
_aspace_bst_insertFunction · 0.70

Tested by

no test coverage detected